diff options
| author | Peter Penz <[email protected]> | 2012-02-03 23:07:33 +0100 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-02-03 23:12:12 +0100 |
| commit | 1041f340a2ddb634476c5d84585a56c29e5a70fd (patch) | |
| tree | b627a3c118e059215802b2bc4356395aac77271b /src/kitemviews/kfileitemmodelrolesupdater.cpp | |
| parent | 7bbdb66618625c2db58b0fce1999c433dc946dc5 (diff) | |
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
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 } } |
