From b8c718a6fd9810f9e91303ed50402de4ab417a49 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 6 Sep 2011 23:42:42 +0200 Subject: 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. --- src/views/dolphinview.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/views/dolphinview.cpp') 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,QSet)), @@ -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(current)); + + KFileItemModel* fileItemModel = static_cast(current); + m_versionControlObserver->setModel(fileItemModel); +} + void DolphinView::slotSelectionChanged(const QSet& current, const QSet& previous) { const int currentCount = current.count(); -- cgit v1.3