┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kfileitemmodelrolesupdater.cpp
diff options
context:
space:
mode:
authorMéven Car <[email protected]>2023-04-25 16:09:05 +0200
committerMéven Car <[email protected]>2023-04-29 10:47:40 +0000
commit47e4c64e6ac5fab00221febf2cbb4f2851c40684 (patch)
treedb30f19aaea9eea4b9df665e2854c6ba46f05661 /src/kitemviews/kfileitemmodelrolesupdater.cpp
parentbd40f21a0a3e15a70bdfa82dfdb6863512413452 (diff)
KFileItemModelRolesUpdater: test isSlow in `startDirectorySizeCounting`
NO_CHANGELOG
Diffstat (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp')
-rw-r--r--src/kitemviews/kfileitemmodelrolesupdater.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp
index 1a849dcd5..e0e61cd49 100644
--- a/src/kitemviews/kfileitemmodelrolesupdater.cpp
+++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp
@@ -1214,8 +1214,9 @@ void KFileItemModelRolesUpdater::applySortRole(int index)
}
data.insert("type", item.mimeComment());
- } else if (m_model->sortRole() == "size" && item.isLocalFile() && !item.isSlow() && item.isDir()) {
+ } else if (m_model->sortRole() == "size" && item.isLocalFile() && item.isDir()) {
startDirectorySizeCounting(item, index);
+ return;
} else {
// Probably the sort role is a baloo role - just determine all roles.
data = rolesData(item, index);
@@ -1277,6 +1278,10 @@ bool KFileItemModelRolesUpdater::applyResolvedRoles(int index, ResolveHint hint)
void KFileItemModelRolesUpdater::startDirectorySizeCounting(const KFileItem &item, int index)
{
+ if (item.isSlow()) {
+ return;
+ }
+
// Tell m_directoryContentsCounter that we want to count the items
// inside the directory. The result will be received in slotDirectoryContentsCountReceived.
if (m_scanDirectories && item.isLocalFile()) {
@@ -1294,7 +1299,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.isSlow() && item.isDir()) {
+ if ((getSizeRole || getIsExpandableRole) && item.isDir()) {
startDirectorySizeCounting(item, index);
}