From eadbf920b5dffdf2d1548240c25ec2eaf835aad5 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Fri, 4 Nov 2011 21:54:01 +0100 Subject: Don't use mixed units in size-column of details-view This makes it tricky to compare the filesizes without adjusting the sort-order, so now all sizes in the size-column are shown in KiB or KB (dependent on the KLocale setting). BUG: 219932 FIXED-IN: 4.8.0 Related fixes: - Stay consistent with the rounding when using the KiB/KB unit in the statusbar. - Fix sorting-by-size issue for folders - Show "Unknown" in the size-column when the number of items cannot be determined. --- src/kitemviews/kfileitemlistwidget.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/kitemviews/kfileitemlistwidget.cpp') diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index 5f659a1f6..d6b892658 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -192,13 +192,18 @@ QString KFileItemListWidget::roleText(const QByteArray& role, const QHash(); text = i18ncp("@item:intable", "%1 item", "%1 items", size); } } else { - const KIO::filesize_t size = roleValue.value(); - text = KIO::convertSize(size); + // Show the size in kilobytes (always round up) + const KLocale* locale = KGlobal::locale(); + const int roundInc = (locale->binaryUnitDialect() == KLocale::MetricBinaryDialect) ? 499 : 511; + const KIO::filesize_t size = roleValue.value() + roundInc; + text = locale->formatByteSize(size, 0, KLocale::DefaultBinaryDialect, KLocale::UnitKiloByte); } break; } -- cgit v1.3