diff options
| author | Peter Penz <[email protected]> | 2011-09-06 23:42:42 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-09-06 23:45:41 +0200 |
| commit | b8c718a6fd9810f9e91303ed50402de4ab417a49 (patch) | |
| tree | f6e22b028cb0932c44dc29ea6c494f121c6f8dc9 /src/views/dolphinview.cpp | |
| parent | 7a91492cff931c0c4e0d38dd0aee77d9dcb29373 (diff) | |
First step to reactivate version control plugin functionality
- Add a DolphinFileItemListWidget that provides icon-overlays
and colored text for the version state (implementation is
missing yet)
- Allow KFileItemListWidget to have custom text colors
- Update interface of VersionControlObserver to work with
KFileItemModel instead of the old model-interface.
Diffstat (limited to 'src/views/dolphinview.cpp')
| -rw-r--r-- | src/views/dolphinview.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index 200de7904..bb9b52365 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -65,6 +65,7 @@ #include "draganddrophelper.h" #include "renamedialog.h" #include "settings/dolphinsettings.h" +#include "versioncontrol/versioncontrolobserver.h" #include "viewmodecontroller.h" #include "viewproperties.h" #include "views/tooltips/tooltipmanager.h" @@ -92,7 +93,8 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : m_currentItemIndex(-1), m_restoredContentsPosition(), m_createdItemUrl(), - m_selectedItems() + m_selectedItems(), + m_versionControlObserver(0) { m_topLayout = new QVBoxLayout(this); m_topLayout->setSpacing(0); @@ -176,6 +178,7 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : connect(controller, SIGNAL(itemHovered(int)), this, SLOT(slotItemHovered(int))); connect(controller, SIGNAL(itemUnhovered(int)), this, SLOT(slotItemUnhovered(int))); connect(controller, SIGNAL(itemDropEvent(int,QGraphicsSceneDragDropEvent*)), this, SLOT(slotItemDropEvent(int,QGraphicsSceneDragDropEvent*))); + connect(controller, SIGNAL(modelChanged(KItemModelBase*,KItemModelBase*)), this, SLOT(slotModelChanged(KItemModelBase*,KItemModelBase*))); KItemListSelectionManager* selectionManager = controller->selectionManager(); connect(selectionManager, SIGNAL(selectionChanged(QSet<int>,QSet<int>)), @@ -183,6 +186,12 @@ DolphinView::DolphinView(const KUrl& url, QWidget* parent) : m_toolTipManager = new ToolTipManager(this); + m_versionControlObserver = new VersionControlObserver(this); + m_versionControlObserver->setModel(fileItemModel()); + connect(m_versionControlObserver, SIGNAL(infoMessage(QString)), this, SIGNAL(infoMessage(QString))); + connect(m_versionControlObserver, SIGNAL(errorMessage(QString)), this, SIGNAL(errorMessage(QString))); + connect(m_versionControlObserver, SIGNAL(operationCompletedMessage(QString)), this, SIGNAL(operationCompletedMessage(QString))); + applyViewProperties(); m_topLayout->addWidget(m_container); @@ -793,6 +802,15 @@ void DolphinView::slotItemDropEvent(int index, QGraphicsSceneDragDropEvent* even DragAndDropHelper::dropUrls(destItem, url(), &dropEvent, this); } +void DolphinView::slotModelChanged(KItemModelBase* current, KItemModelBase* previous) +{ + Q_UNUSED(previous); + Q_ASSERT(qobject_cast<KFileItemModel*>(current)); + + KFileItemModel* fileItemModel = static_cast<KFileItemModel*>(current); + m_versionControlObserver->setModel(fileItemModel); +} + void DolphinView::slotSelectionChanged(const QSet<int>& current, const QSet<int>& previous) { const int currentCount = current.count(); |
