From 1041f340a2ddb634476c5d84585a56c29e5a70fd Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 3 Feb 2012 23:07:33 +0100 Subject: Show the value "Unknown" for the item-count only after it has been verified During determining the item-count for directories just show an empty string until either the item-count has been calculated or if the item-count is unknown. Thanks to Nikita Skovoroda for the initial proof-of-concept patch. BUG: 291823 FIXED-IN: 4.8.1 --- src/kitemviews/kfileitemmodelrolesupdater.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/kitemviews/kfileitemmodelrolesupdater.cpp') 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 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 } } -- cgit v1.3.1