Bug 492016 - kiB, MiB, GiB TiB and KB, MB, GB TB
Summary: kiB, MiB, GiB TiB and KB, MB, GB TB
Status: REPORTED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (other bugs)
Version First Reported In: 21.12.3
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-22 02:55 UTC by vmelkon
Modified: 2024-08-23 18:16 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vmelkon 2024-08-22 02:55:23 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
kiB, MiB, GiB TiB and  KB, MB, GB TB

STEPS TO REPRODUCE
1. Nothing
2. 
3. 

OBSERVED RESULT
KDE Partition Manager shows data size as kiB, MiB, GiB TiB and so on even though we tell the KDE framework to use something else.
We tell KDE what to do via the file
$KDEHOME/.config/kdeglobals

In that file, create a section called
[Locale]

and just below, that add the line
BinaryUnitDialect=1

Setting to 0 gives you the current default of IEC units.
Setting to 1 gives you JEDEC units.
Setting to 2 gives you metric (yes, real powers-of-10, lowercase k instead of K, metric units).

Other applications, such as Ark and K3b respect this value since they use a certain API from the KDE framework.

This issue was raised for Dolphin, which was eventually fixed. Please see
https://bugs.kde.org/show_bug.cgi?id=57240


EXPECTED RESULT
Setting to 0 gives you the current default of IEC units.
Setting to 1 gives you JEDEC units.
Setting to 2 gives you metric (yes, real powers-of-10, lowercase k instead of K, metric units).


SOFTWARE/OS VERSIONS
Kubuntu 22.04 (with all the latest updates)
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 5.24.7
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
I would do the change myself but I assume it is complicated. I tried to do it once for Dolphin but I was never able to compile Dolphin.
Very Important: Always write highly configurable software. A PC is something that is owned by the user. It is his world.
My opinion is that all software should be configurable in certain aspects. Even Wikipedia can be setup to show the formats, the date formats, the number formats that we want. Too often, it is not done.
Comment 1 Andrius Štikonas 2024-08-22 08:26:08 UTC
We do use that frameworks API https://invent.kde.org/system/kpmcore/-/blob/master/src/util/capacity.cpp?ref_type=heads#L129 though maybe we don't update unit names, so it still shows MiB...
Comment 2 vmelkon 2024-08-23 18:16:23 UTC
I think I had seen code like that somewhere:
KFormat().formatByteSize(size, precision);  (This comes from the link you gave)

I think there is no need to hardcode the unit (kiB, MiB, GiB, TiB) since the KDE framework automatically generates the number and the unit. I don't know exactly which of their functions does it.