]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/folderexpander.cpp
* Use Nepomuk for getting the meta data instead of KFileMetaInfo.
[dolphin.git] / src / folderexpander.cpp
index 93ab6789506e257744e98b8a31d1cbfc7358aa3f..7fe775944e4fc5ae99db87d27fa68f1fb8b73e1c 100644 (file)
@@ -20,7 +20,7 @@
 #include "folderexpander.h"
 #include "dolphinview.h"
 
-#include "dolphinsettings.h"
+#include "settings/dolphinsettings.h"
 #include "dolphin_generalsettings.h"
 
 #include <QtCore/QTimer>
@@ -112,18 +112,20 @@ void FolderExpander::autoExpandTimeout()
     Q_ASSERT(m_dirModel != 0);
     KFileItem itemToExpand = m_dirModel->itemForIndex(indexToExpand);
 
-    if (itemToExpand.isNull()) {
+    if (itemToExpand.isNull() || itemToExpand == m_dirModel->itemForIndex(QModelIndex())) {
+        // The second clause occurs when we are expanding the folder represented
+        // by the view, which is a case we should ignore (#182618).
         return;
     }
 
     if (itemToExpand.isDir()) {
         QTreeView* treeView = qobject_cast<QTreeView*>(m_view);
-        if (treeView != 0) {
+        if ((treeView != 0) && treeView->itemsExpandable()) {
             // Toggle expanded state of this directory.
             treeView->setExpanded(proxyIndexToExpand, !treeView->isExpanded(proxyIndexToExpand));
         }
         else {
-            emit enterDir(proxyIndexToExpand, m_view);
+            emit enterDir(proxyIndexToExpand);
         }
     }
 }