┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/kitemviews')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp21
-rw-r--r--src/kitemviews/kfileitemmodel.h4
2 files changed, 10 insertions, 15 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
diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h
index ff816c85c..a792b089f 100644
--- a/src/kitemviews/kfileitemmodel.h
+++ b/src/kitemviews/kfileitemmodel.h
@@ -150,9 +150,9 @@ public:
void restoreExpandedUrls(const QSet<KUrl>& urls);
/**
- * Expands all parent-items of each URL given by \a urls.
+ * Expands all parent-items of \a url.
*/
- void setExpanded(const QSet<KUrl>& urls);
+ void expandParentItems(const KUrl& url);
void setNameFilter(const QString& nameFilter);
QString nameFilter() const;