]> cloud.milkyroute.net Git - dolphin.git/commitdiff
If the revision states have been changed because of executing a SVN context menu...
authorPeter Penz <peter.penz19@gmail.com>
Thu, 30 Jul 2009 06:21:35 +0000 (06:21 +0000)
committerPeter Penz <peter.penz19@gmail.com>
Thu, 30 Jul 2009 06:21:35 +0000 (06:21 +0000)
svn path=/trunk/KDE/kdebase/apps/; revision=1004412

src/revisioncontrolobserver.cpp
src/revisioncontrolobserver.h

index b37acb4cbb0df9f9bcbae6eeef8fba205ba25f26..6ecba64c588c307ea8892947b0d14e7973677c1a 100644 (file)
@@ -105,6 +105,7 @@ RevisionControlObserver::RevisionControlObserver(QAbstractItemView* view) :
     QObject(view),
     m_pendingItemStatesUpdate(false),
     m_revisionedDirectory(false),
+    m_silentUpdate(false),
     m_view(view),
     m_dirLister(0),
     m_dolphinModel(0),
@@ -168,6 +169,13 @@ QList<QAction*> RevisionControlObserver::contextMenuActions(const QString& direc
 
 void RevisionControlObserver::delayedDirectoryVerification()
 {
+    m_silentUpdate = false;
+    m_dirVerificationTimer->start();
+}
+
+void RevisionControlObserver::silentDirectoryVerification()
+{
+    m_silentUpdate = true;
     m_dirVerificationTimer->start();
 }
 
@@ -213,7 +221,7 @@ void RevisionControlObserver::verifyDirectory()
             connect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
                     this, SLOT(delayedDirectoryVerification()));
             connect(m_plugin, SIGNAL(revisionStatesChanged()),
-                    this, SLOT(delayedDirectoryVerification()));
+                    this, SLOT(silentDirectoryVerification()));
         }
         updateItemStates();
     } else if (m_revisionedDirectory) {
@@ -228,13 +236,14 @@ void RevisionControlObserver::verifyDirectory()
         disconnect(m_dirLister, SIGNAL(newItems(const KFileItemList&)),
                    this, SLOT(delayedDirectoryVerification()));
         disconnect(m_plugin, SIGNAL(revisionStatesChanged()),
-                   this, SLOT(delayedDirectoryVerification()));
+                   this, SLOT(silentDirectoryVerification()));
     }
 }
 
 void RevisionControlObserver::applyUpdatedItemStates()
 {
     if (!m_updateItemStatesThread->retrievedItems()) {
+        // ignore m_silentUpdate for an error message
         emit errorMessage(i18nc("@info:status", "Update of revision information failed."));
         return;
     }
@@ -256,10 +265,12 @@ void RevisionControlObserver::applyUpdatedItemStates()
     m_dolphinModel->blockSignals(signalsBlocked);
     m_view->viewport()->repaint();
 
-    // Using an empty message results in clearing the previously shown information message and showing
-    // the default status bar information. This is useful as the user already gets feedback that the
-    // operation has been completed because of the icon emblems.
-    emit operationCompletedMessage(QString());
+    if (!m_silentUpdate) {
+        // Using an empty message results in clearing the previously shown information message and showing
+        // the default status bar information. This is useful as the user already gets feedback that the
+        // operation has been completed because of the icon emblems.
+        emit operationCompletedMessage(QString());
+    }
     
     if (m_pendingItemStatesUpdate) {
         m_pendingItemStatesUpdate = false;
@@ -298,7 +309,9 @@ void RevisionControlObserver::updateItemStates()
             itemStates.append(itemState);
         }
         
-        emit infoMessage(i18nc("@info:status", "Updating revision information..."));
+        if (!m_silentUpdate) {
+            emit infoMessage(i18nc("@info:status", "Updating revision information..."));
+        }
         m_updateItemStatesThread->setData(m_plugin, itemStates);
         m_updateItemStatesThread->start(); // applyUpdatedItemStates() is called when finished
     }
index 4decbda7f192d5aa4ff4d4fc3d78e939244703c7..c4df752c4ffdfde69719e7a199c2bba2f76666c8 100644 (file)
@@ -78,7 +78,21 @@ signals:
     void operationCompletedMessage(const QString& msg);
     
 private slots:
+    /**
+     * Invokes verifyDirectory() with a small delay. If delayedDirectoryVerification()
+     * is invoked before the delay has been exceeded, the delay will be reset. This
+     * assures that a lot of short requests for directory verification only result
+     * in one (expensive) call.
+     */
     void delayedDirectoryVerification();
+
+    /**
+     * Invokes verifyDirectory() with a small delay. In opposite to
+     * delayedDirectoryVerification() it and assures that the verification of
+     * the directory is done silently without information messages.
+     */
+    void silentDirectoryVerification();    
+
     void verifyDirectory();
     void applyUpdatedItemStates();
     
@@ -95,6 +109,8 @@ private:
     
     bool m_pendingItemStatesUpdate;
     bool m_revisionedDirectory;
+    bool m_silentUpdate; // if true, no messages will be send during the update
+                         // of revision states
     
     QAbstractItemView* m_view;
     KDirLister* m_dirLister;