diff options
| author | Peter Penz <[email protected]> | 2007-05-08 21:52:09 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-05-08 21:52:09 +0000 |
| commit | 53dcdd804af21d999df35cddd7e80e06620b0df2 (patch) | |
| tree | 7239652714f782b16c8036fe9ba532aa77331847 | |
| parent | 13b36768575964d9009e94c38cd37db61d823632 (diff) | |
prevent loading items twice in the tree view
svn path=/trunk/KDE/kdebase/apps/; revision=662690
| -rw-r--r-- | src/treeviewsidebarpage.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/treeviewsidebarpage.cpp b/src/treeviewsidebarpage.cpp index 4c97f3833..8c1c153d6 100644 --- a/src/treeviewsidebarpage.cpp +++ b/src/treeviewsidebarpage.cpp @@ -22,6 +22,7 @@ #include "dolphinmainwindow.h" #include "dolphinsortfilterproxymodel.h" #include "dolphinview.h" +#include "dolphinsettings.h" #include "sidebartreeview.h" #include "treeviewcontextmenu.h" @@ -34,7 +35,6 @@ #include <QItemSelectionModel> #include <QTreeView> #include <QVBoxLayout> -#include "dolphinsettings.h" TreeViewSidebarPage::TreeViewSidebarPage(QWidget* parent) : SidebarPage(parent), @@ -202,10 +202,19 @@ void TreeViewSidebarPage::loadTree(const KUrl& url) connect(m_dirLister, SIGNAL(completed()), this, SLOT(expandSelectionParent())); + // Implementation note: It is important to remove the trailing slash from + // the parent URL, as the directories from the dir lister (KDirLister::directories()) + // don't have a trailing slash and hence KUrl::List::contains() would fail... KUrl parentUrl = url.upUrl(); + parentUrl.adjustPath(KUrl::RemoveTrailingSlash); while (!parentUrl.isParentOf(baseUrl)) { - m_dirLister->openUrl(parentUrl, true, false); + if (m_dirLister->directories().contains(parentUrl)) { + m_dirLister->updateDirectory(parentUrl); + } else { + m_dirLister->openUrl(parentUrl, true, false); + } parentUrl = parentUrl.upUrl(); + parentUrl.adjustPath(KUrl::RemoveTrailingSlash); } } } |
