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/kfileitemlistwidget.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/kfileitemlistwidget.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemlistwidget.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index 7e28c5d37..d93e434da 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -231,11 +231,13 @@ QString KFileItemListWidget::roleText(const QByteArray& role, const QHash<QByteA if (values.value("isDir").toBool()) { // The item represents a directory. Show the number of sub directories // instead of the file size of the directory. - if (roleValue.isNull()) { - text = i18nc("@item:intable", "Unknown"); - } else { - const KIO::filesize_t size = roleValue.value<KIO::filesize_t>(); - text = i18ncp("@item:intable", "%1 item", "%1 items", size); + if (!roleValue.isNull()) { + const int count = roleValue.toInt(); + if (count < 0) { + text = i18nc("@item:intable", "Unknown"); + } else { + text = i18ncp("@item:intable", "%1 item", "%1 items", count); + } } } else { // Show the size in kilobytes (always round up) |
