]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/versioncontrol/versioncontrolobserver.cpp
Sourcecode hierarchy cleanup: Move further files from src to src/views
[dolphin.git] / src / versioncontrol / versioncontrolobserver.cpp
index c5a0b982fc9df67a3f7ec81bf07d0b331df9f9e0..51337e097a45869229363c5b4db0402d131250e4 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "versioncontrolobserver.h"
 
-#include <dolphinmodel.h>
 #include "dolphin_versioncontrolsettings.h"
 
 #include <kdirlister.h>
@@ -36,6 +35,8 @@
 #include <QMutexLocker>
 #include <QTimer>
 
+#include <views/dolphinmodel.h>
+
 VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
     QObject(view),
     m_pendingItemStatesUpdate(false),
@@ -58,7 +59,7 @@ VersionControlObserver::VersionControlObserver(QAbstractItemView* view) :
         m_dirLister = m_dolphinModel->dirLister();
         connect(m_dirLister, SIGNAL(completed()),
                 this, SLOT(delayedDirectoryVerification()));
+
         // The verification timer specifies the timeout until the shown directory
         // is checked whether it is versioned. Per default it is assumed that users
         // don't iterate through versioned directories and a high timeout is used
@@ -131,7 +132,7 @@ void VersionControlObserver::silentDirectoryVerification()
 
 void VersionControlObserver::verifyDirectory()
 {
-    KUrl versionControlUrl = m_dirLister->url();
+    const KUrl versionControlUrl = m_dirLister->url();
     if (!versionControlUrl.isLocalFile()) {
         return;
     }
@@ -142,6 +143,15 @@ void VersionControlObserver::verifyDirectory()
 
     m_plugin = searchPlugin(versionControlUrl);
     if (m_plugin != 0) {
+        connect(m_plugin, SIGNAL(versionStatesChanged()),
+                this, SLOT(silentDirectoryVerification()));
+        connect(m_plugin, SIGNAL(infoMessage(QString)),
+                this, SIGNAL(infoMessage(QString)));
+        connect(m_plugin, SIGNAL(errorMessage(QString)),
+                this, SIGNAL(errorMessage(QString)));
+        connect(m_plugin, SIGNAL(operationCompletedMessage(QString)),
+                this, SIGNAL(operationCompletedMessage(QString)));
+
         if (!m_versionedDirectory) {
             m_versionedDirectory = true;
 
@@ -152,14 +162,6 @@ void VersionControlObserver::verifyDirectory()
                     this, SLOT(delayedDirectoryVerification()));
             connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
                     this, SLOT(delayedDirectoryVerification()));
-            connect(m_plugin, SIGNAL(versionStatesChanged()),
-                    this, SLOT(silentDirectoryVerification()));
-            connect(m_plugin, SIGNAL(infoMessage(const QString&)),
-                    this, SIGNAL(infoMessage(const QString&)));
-            connect(m_plugin, SIGNAL(errorMessage(const QString&)),
-                    this, SIGNAL(errorMessage(const QString&)));
-            connect(m_plugin, SIGNAL(operationCompletedMessage(const QString&)),
-                    this, SIGNAL(operationCompletedMessage(const QString&)));
         }
         updateItemStates();
     } else if (m_versionedDirectory) {
@@ -232,7 +234,7 @@ void VersionControlObserver::updateItemStates()
         m_pendingItemStatesUpdate = true;
         return;
     }
-    
+
     QList<ItemState> itemStates;
     addDirectory(QModelIndex(), itemStates);
     if (!itemStates.isEmpty()) {
@@ -250,7 +252,7 @@ void VersionControlObserver::addDirectory(const QModelIndex& parentIndex, QList<
     for (int row = 0; row < rowCount; ++row) {
         const QModelIndex index = m_dolphinModel->index(row, DolphinModel::Version, parentIndex);
         addDirectory(index, itemStates);
-        
+
         ItemState itemState;
         itemState.index = index;
         itemState.item = m_dolphinModel->itemForIndex(index);