]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/folderexpander.cpp
SVN_SILENT: Minor coding style and format cleanups. No change of behavior has been...
[dolphin.git] / src / folderexpander.cpp
index 1aaf09ded6e02441ada8fecce36fc501bd7e246f..a2dfb137b29a2bfdc4c4ab45f7c2f5b807408e94 100644 (file)
  ***************************************************************************/
 
 #include "folderexpander.h"
-#include "dolphinview.h"
-
-#include "settings/dolphinsettings.h"
-#include "dolphin_generalsettings.h"
 
 #include <QtCore/QTimer>
 #include <QtGui/QAbstractItemView>
@@ -43,20 +39,15 @@ FolderExpander::FolderExpander(QAbstractItemView *view, QSortFilterProxyModel *p
     m_autoExpandTriggerTimer(0),
     m_autoExpandPos()
 {
-    // Validation.  If these fail, the event filter is never
-    // installed on the view and the FolderExpander is inactive.
     if (m_view == 0)  {
-        kWarning() << "Need a view!";
-        return; // Not valid.
+        return;
     }
     if (m_proxyModel == 0)  {
-        kWarning() << "Need a proxyModel!";
-        return; // Not valid.
+        return;
     }
-    KDirModel *m_dirModel = qobject_cast< KDirModel* >( m_proxyModel->sourceModel() );
+    KDirModel *m_dirModel = qobject_cast<KDirModel*>(m_proxyModel->sourceModel());
     if (m_dirModel == 0) {
-        kWarning() << "Expected m_proxyModel's sourceModel() to be a KDirModel!";
-        return; // Not valid.
+        return;
     }
 
     // Initialise auto-expand timer.
@@ -112,7 +103,9 @@ 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;
     }