]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/views/versioncontrol/versioncontrolobserver.cpp
Merge branch 'KDE/4.10'
[dolphin.git] / src / views / versioncontrol / versioncontrolobserver.cpp
index ac47090690b15cc489665746c296fca87914b10a..64bc268679df0c7218f38c1a11ae4b9a7f9e115a 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "dolphin_versioncontrolsettings.h"
 
-#include <KDirLister>
 #include <KLocale>
 #include <KService>
 #include <KServiceTypeTrader>
@@ -30,6 +29,7 @@
 
 #include "updateitemstatesthread.h"
 
+#include <QFile>
 #include <QMutexLocker>
 #include <QTimer>
 
@@ -90,7 +90,17 @@ KFileItemModel* VersionControlObserver::model() const
 QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) const
 {
     QList<QAction*> actions;
-    if (!m_model) {
+
+    bool hasNullItems = false;
+    foreach (const KFileItem& item, items) {
+        if (item.isNull()) {
+            kWarning() << "Requesting version-control-actions for empty items";
+            hasNullItems = true;
+            break;
+        }
+    }
+
+    if (!m_model || hasNullItems) {
         return actions;
     }
 
@@ -235,7 +245,7 @@ void VersionControlObserver::updateItemStates()
         connect(m_updateItemStatesThread, SIGNAL(finished()),
                 m_updateItemStatesThread, SLOT(deleteLater()));
     }
-    if (m_updateItemStatesThread->isRunning()) {
+    else {
         // An update is currently ongoing. Wait until the thread has finished
         // the update (see slotThreadFinished()).
         m_pendingItemStatesUpdate = true;
@@ -298,7 +308,6 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director
     // Verify whether the current directory contains revision information
     // like .svn, .git, ...
     foreach (KVersionControlPlugin* plugin, plugins) {
-        // Use the KDirLister cache to check for .svn, .git, ... files
         const QString fileName = directory.path(KUrl::AddTrailingSlash) + plugin->fileName();
         if (QFile::exists(fileName)) {
             return plugin;