X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/85aec92f819eae5a6189bd3ec25cff44dce3ae19..b1c9b5126d:/src/folderexpander.cpp?ds=inline diff --git a/src/folderexpander.cpp b/src/folderexpander.cpp index 574f0a304..7fe775944 100644 --- a/src/folderexpander.cpp +++ b/src/folderexpander.cpp @@ -20,7 +20,7 @@ #include "folderexpander.h" #include "dolphinview.h" -#include "dolphinsettings.h" +#include "settings/dolphinsettings.h" #include "dolphin_generalsettings.h" #include @@ -110,20 +110,22 @@ void FolderExpander::autoExpandTimeout() QModelIndex indexToExpand = m_proxyModel->mapToSource(proxyIndexToExpand); KDirModel* m_dirModel = qobject_cast< KDirModel* >(m_proxyModel->sourceModel()); Q_ASSERT(m_dirModel != 0); - KFileItem itemToExpand = m_dirModel->itemForIndex(indexToExpand ); + 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 *viewAsTreeView = qobject_cast(m_view); - if (viewAsTreeView != 0) { + QTreeView* treeView = qobject_cast(m_view); + if ((treeView != 0) && treeView->itemsExpandable()) { // Toggle expanded state of this directory. - viewAsTreeView->setExpanded(proxyIndexToExpand, !viewAsTreeView->isExpanded(proxyIndexToExpand)); + treeView->setExpanded(proxyIndexToExpand, !treeView->isExpanded(proxyIndexToExpand)); } else { - emit enterDir(proxyIndexToExpand, m_view); + emit enterDir(proxyIndexToExpand); } } }