┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodel.cpp
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2012-02-03 19:09:42 +0100
committerFrank Reininghaus <[email protected]>2012-02-05 15:59:59 +0100
commitd0933155e2dc179cde49b4306ff7feee9ca47697 (patch)
tree80ec968e4538193d751b28f44d796db6d4f462fc /src/kitemviews/kfileitemmodel.cpp
parent72af3125a824722d9875d202dd156cd3f7d8fc46 (diff)
Replace setExpanded(const QSet<KUrl>&) by expandParentItems(const KUrl&)
The use case of this function (Folders Panel) requires the expansion of the parent items of a single URL, so it's not needed to handle a full set of URLs in this function. Moreover, the issue that not only the parents, but also the URLs themselves were expanded is fixed by this commit. (cherry picked from commit 89082ca391807abdc26d8985efe6b4c27183a9b1)
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index db9b71189..6cb7577f2 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -478,7 +478,7 @@ void KFileItemModel::restoreExpandedUrls(const QSet<KUrl>& urls)
m_urlsToExpand = urls;
}
-void KFileItemModel::setExpanded(const QSet<KUrl>& urls)
+void KFileItemModel::expandParentItems(const KUrl& url)
{
const KDirLister* dirLister = m_dirLister.data();
if (!dirLister) {
@@ -487,20 +487,15 @@ void KFileItemModel::setExpanded(const QSet<KUrl>& urls)
const int pos = dirLister->url().path().length();
- // Assure that each sub-path of the URLs that should be
- // expanded is added to m_urlsToExpand too. KDirLister
+ // Assure that each sub-path of the URL that should be
+ // expanded is added to m_urlsToExpand. KDirLister
// does not care whether the parent-URL has already been
// expanded.
- QSetIterator<KUrl> it1(urls);
- while (it1.hasNext()) {
- const KUrl& url = it1.next();
-
- KUrl urlToExpand = dirLister->url();
- const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
- for (int i = 0; i < subDirs.count(); ++i) {
- urlToExpand.addPath(subDirs.at(i));
- m_urlsToExpand.insert(urlToExpand);
- }
+ KUrl urlToExpand = dirLister->url();
+ const QStringList subDirs = url.path().mid(pos).split(QDir::separator());
+ for (int i = 0; i < subDirs.count() - 1; ++i) {
+ urlToExpand.addPath(subDirs.at(i));
+ m_urlsToExpand.insert(urlToExpand);
}
// KDirLister::open() must called at least once to trigger an initial