┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodelrolesupdater.cpp
diff options
context:
space:
mode:
authorAndrew Gunnerson <[email protected]>2023-02-05 21:44:23 -0500
committerMéven Car <[email protected]>2023-02-09 09:18:35 +0000
commit34e0a5488e3c2d1ed0ff291549934b7490474b5c (patch)
tree4a37a237c059448263d8d138136b7c2068a003dd /src/kitemviews/kfileitemmodelrolesupdater.cpp
parent24cc1483bcc1747a01a6cd1c5a018510e067e3b6 (diff)
KFileItemModelRolesUpdater: Skip directory item count if it isSlow()
This makes the behavior of kernel cifs/nfs mounts the same as with kio's smb://. It also helps reduce the chance of the UI hanging due to opendir/readdir slowing down stat calls on the UI thread. Signed-off-by: Andrew Gunnerson <[email protected]>
Diffstat (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp')
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index cf660cb9f..4af4f3024 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -1209,7 +1209,7 @@ void KFileItemModelRolesUpdater::applySortRole(int index)
}
data.insert("type", item.mimeComment());
- } else if (m_model->sortRole() == "size" && item.isLocalFile() && item.isDir()) {
+ } else if (m_model->sortRole() == "size" && item.isLocalFile() && !item.isSlow() && item.isDir()) {
const QString path = item.localPath();
if (m_scanDirectories) {
m_directoryContentsCounter->scanDirectory(path);
@@ -1280,7 +1280,7 @@ QHash<QByteArray, QVariant> KFileItemModelRolesUpdater::rolesData(const KFileIte
const bool getSizeRole = m_roles.contains("size");
const bool getIsExpandableRole = m_roles.contains("isExpandable");
- if ((getSizeRole || getIsExpandableRole) && item.isDir()) {
+ if ((getSizeRole || getIsExpandableRole) && !item.isSlow() && item.isDir()) {
if (item.isLocalFile()) {
// Tell m_directoryContentsCounter that we want to count the items
// inside the directory. The result will be received in slotDirectoryContentsCountReceived.