┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/dolphinview.cpp')
-rw-r--r--src/views/dolphinview.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 78fd56d50..872853642 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -539,9 +539,12 @@ QString DolphinView::statusBarText() const
if (fileCount > 0 && folderCount > 0) {
summary = i18nc("@info:status folders, files (size)", "%1, %2 (%3)",
- foldersText, filesText, fileSizeText(totalFileSize));
+ foldersText, filesText,
+ KGlobal::locale()->formatByteSize(totalFileSize));
} else if (fileCount > 0) {
- summary = i18nc("@info:status files (size)", "%1 (%2)", filesText, fileSizeText(totalFileSize));
+ summary = i18nc("@info:status files (size)", "%1 (%2)",
+ filesText,
+ KGlobal::locale()->formatByteSize(totalFileSize));
} else if (folderCount > 0) {
summary = foldersText;
}
@@ -1471,27 +1474,4 @@ void DolphinView::updateWritableState()
}
}
-QString DolphinView::fileSizeText(KIO::filesize_t fileSize)
-{
- const KLocale* locale = KGlobal::locale();
- const unsigned int multiplier = (locale->binaryUnitDialect() == KLocale::MetricBinaryDialect)
- ? 1000 : 1024;
-
- QString text;
- if (fileSize < multiplier) {
- // Show the size in bytes
- text = locale->formatByteSize(fileSize, 0, KLocale::DefaultBinaryDialect, KLocale::UnitByte);
- } else if (fileSize < multiplier * multiplier) {
- // Show the size in kilobytes and always round up. This is done
- // for consistency with the values shown e.g. in the "Size" column
- // of the details-view.
- fileSize += (multiplier / 2) - 1;
- text = locale->formatByteSize(fileSize, 0, KLocale::DefaultBinaryDialect, KLocale::UnitKiloByte);
- } else {
- // Show the size in the best fitting unit having one decimal
- text = locale->formatByteSize(fileSize, 1);
- }
- return text;
-}
-
#include "dolphinview.moc"