From 53dcdd804af21d999df35cddd7e80e06620b0df2 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 8 May 2007 21:52:09 +0000 Subject: [PATCH] prevent loading items twice in the tree view svn path=/trunk/KDE/kdebase/apps/; revision=662690 --- src/treeviewsidebarpage.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/treeviewsidebarpage.cpp b/src/treeviewsidebarpage.cpp index 4c97f38334..8c1c153d61 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 #include #include -#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); } } }