]> 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 62a2383d4256603ed3cfb3814a51c4d9805bbf47..d93e434da16a1bb84af4ca7588787f69a13ce2d6 100644 (file)
@@ -79,6 +79,7 @@ void KFileItemListWidget::setLayout(Layout layout)
     if (m_layout != layout) {
         m_layout = layout;
         m_dirtyLayout = true;
+        updateAdditionalInfoTextColor();
         update();
     }
 }
@@ -230,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)