Commit ca113afa authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Folder View] Assume root of a protocol is always a folder

Differential Revision: https://phabricator.kde.org/D18721
parent 75f26287
......@@ -1386,6 +1386,13 @@ bool FolderModel::isDir(const QModelIndex &index, const KDirModel *dirModel) con
return false;
}
// Assume the root folder of a protocol is always a folder.
// This avoids spinning up e.g. trash KIO slave just to check whether trash:/ is a folder.
if (url.path() == QLatin1String("/")) {
m_isDirCache.insert(item.url(), true);
return true;
}
if (KProtocolInfo::protocolClass(url.scheme()) != QStringLiteral(":local")) {
return false;
}
......
......@@ -317,7 +317,7 @@ class FOLDERPLUGIN_TESTS_EXPORT FolderModel : public QSortFilterProxyModel, publ
KDirModel *m_dirModel;
KDirWatch *m_dirWatch;
QString m_url;
QHash<QUrl, bool> m_isDirCache;
mutable QHash<QUrl, bool> m_isDirCache;
mutable QHash<QUrl, KIO::StatJob *> m_isDirJobs;
QItemSelectionModel *m_selectionModel;
QItemSelection m_pinnedSelection;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment