diff options
Diffstat (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemmodelrolesupdater.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index 14e7f00ff..7050d21c9 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -743,16 +743,18 @@ 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() && item.isLocalFile()) { - const QString path = item.localPath(); - const int count = subItemsCount(path); - if (count >= 0) { + if ((getSizeRole || getIsExpandableRole) && item.isDir()) { + if (item.isLocalFile()) { + const QString path = item.localPath(); + const int count = subItemsCount(path); if (getSizeRole) { - data.insert("size", KIO::filesize_t(count)); + data.insert("size", count); } if (getIsExpandableRole) { data.insert("isExpandable", count > 0); } + } else if (getSizeRole) { + data.insert("size", -1); // -1 indicates an unknown number of items } } |
