diff options
| author | Peter Penz <[email protected]> | 2012-04-09 09:44:05 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2012-04-09 09:50:17 +0200 |
| commit | 16e5740828a6f66c6437100f9e66c90bbee498d0 (patch) | |
| tree | 0865a361b70ef5a840afdf8822bbf17427267f2e /src/views | |
| parent | e0ac8b61fb907ac19f9bebf01cb5be17d4c88ba8 (diff) | |
Revert the 2.0 decision to always use KB for file-sizes
The feedback on bugs.kde.org has shown that the previous behavior
(= show size with best-matching unit) is preferred by most users.
I initially wanted to make this configurable, but for implementing
it in a non-hacky way extending KLocale from kdelibs would have
been required. I'm not sure whether the usecase in Dolphin justifies
having such a configuration in KLocale - however as kdelibs is frozen
at the moment this is no option and the old behavior has been
restored.
BUG: 289850
FIXED-IN: 4.9.0
Diffstat (limited to 'src/views')
| -rw-r--r-- | src/views/dolphinview.cpp | 30 | ||||
| -rw-r--r-- | src/views/dolphinview.h | 6 |
2 files changed, 5 insertions, 31 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" diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h index 71128569a..130657b16 100644 --- a/src/views/dolphinview.h +++ b/src/views/dolphinview.h @@ -716,12 +716,6 @@ private: */ void updateWritableState(); - /** - * Returns the text for the filesize by converting it to the best fitting - * unit. - */ - static QString fileSizeText(KIO::filesize_t fileSize); - private: bool m_active; bool m_tabsForFiles; |
