]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/kitemviews/kfileitemlistwidget.cpp
Show the value "Unknown" for the item-count only after it has been verified
[dolphin.git] / src / kitemviews / kfileitemlistwidget.cpp
index 7e28c5d371ef02d59274c12e6b3a7e59ec507c5d..d93e434da16a1bb84af4ca7588787f69a13ce2d6 100644 (file)
@@ -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)