mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +00:00
Re-enable expandable folders for network top level folders (remote:/)
Added a hash table for target url to url mapping. So when the dir lister sends us the target url as directory url, we can use the url mapping table to get the right "Dolphin internal" directory url, which is the non-target url. BUG: 306219 FIXED-IN: 4.11.0 REVIEW: 111252
This commit is contained in:
parent
1634501b0e
commit
391d36edf7
|
@ -124,8 +124,10 @@ void KFileItemModel::loadDirectory(const KUrl& url)
|
|||
void KFileItemModel::refreshDirectory(const KUrl& url)
|
||||
{
|
||||
// Refresh all expanded directories first (Bug 295300)
|
||||
foreach (const KUrl& expandedUrl, m_expandedDirs) {
|
||||
m_dirLister->openUrl(expandedUrl, KDirLister::Reload);
|
||||
QHashIterator<KUrl, KUrl> expandedDirs(m_expandedDirs);
|
||||
while (expandedDirs.hasNext()) {
|
||||
expandedDirs.next();
|
||||
m_dirLister->openUrl(expandedDirs.value(), KDirLister::Reload);
|
||||
}
|
||||
|
||||
m_dirLister->openUrl(url, KDirLister::Reload);
|
||||
|
@ -432,11 +434,12 @@ bool KFileItemModel::setExpanded(int index, bool expanded)
|
|||
|
||||
const KFileItem item = m_itemData.at(index)->item;
|
||||
const KUrl url = item.url();
|
||||
const KUrl targetUrl = item.targetUrl();
|
||||
if (expanded) {
|
||||
m_expandedDirs.insert(url);
|
||||
m_expandedDirs.insert(targetUrl, url);
|
||||
m_dirLister->openUrl(url, KDirLister::Keep);
|
||||
} else {
|
||||
m_expandedDirs.remove(url);
|
||||
m_expandedDirs.remove(targetUrl);
|
||||
m_dirLister->stop(url);
|
||||
|
||||
removeFilteredChildren(KFileItemList() << item);
|
||||
|
@ -478,7 +481,7 @@ int KFileItemModel::expandedParentsCount(int index) const
|
|||
|
||||
QSet<KUrl> KFileItemModel::expandedDirectories() const
|
||||
{
|
||||
return m_expandedDirs;
|
||||
return m_expandedDirs.values().toSet();
|
||||
}
|
||||
|
||||
void KFileItemModel::restoreExpandedDirectories(const QSet<KUrl>& urls)
|
||||
|
@ -755,8 +758,13 @@ void KFileItemModel::slotItemsAdded(const KUrl& directoryUrl, const KFileItemLis
|
|||
{
|
||||
Q_ASSERT(!items.isEmpty());
|
||||
|
||||
KUrl parentUrl = directoryUrl;
|
||||
parentUrl.adjustPath(KUrl::RemoveTrailingSlash);
|
||||
KUrl parentUrl;
|
||||
if (m_expandedDirs.contains(directoryUrl)) {
|
||||
parentUrl = m_expandedDirs.value(directoryUrl);
|
||||
} else {
|
||||
parentUrl = directoryUrl;
|
||||
parentUrl.adjustPath(KUrl::RemoveTrailingSlash);
|
||||
}
|
||||
|
||||
if (m_requestRole[ExpandedParentsCountRole]) {
|
||||
KFileItem item = items.first();
|
||||
|
@ -1337,7 +1345,7 @@ QHash<QByteArray, QVariant> KFileItemModel::retrieveData(const KFileItem& item,
|
|||
}
|
||||
|
||||
if (m_requestRole[IsExpandableRole]) {
|
||||
data.insert(sharedValue("isExpandable"), item.isDir() && item.url() == item.targetUrl());
|
||||
data.insert(sharedValue("isExpandable"), item.isDir());
|
||||
}
|
||||
|
||||
if (m_requestRole[ExpandedParentsCountRole]) {
|
||||
|
|
|
@ -466,8 +466,8 @@ private:
|
|||
// Cache for KFileItemModel::groups()
|
||||
mutable QList<QPair<int, QVariant> > m_groups;
|
||||
|
||||
// Stores the URLs of the expanded directories.
|
||||
QSet<KUrl> m_expandedDirs;
|
||||
// Stores the URLs (key: target url, value: url) of the expanded directories.
|
||||
QHash<KUrl, KUrl> m_expandedDirs;
|
||||
|
||||
// URLs that must be expanded. The expanding is initially triggered in setExpanded()
|
||||
// and done step after step in slotCompleted().
|
||||
|
|
Loading…
Reference in a new issue