how to enable telling KLocale::formatByteSize which format it should produce?

Marcel Partap mpartap at gmx.net
Mon Feb 23 10:45:42 GMT 2009


Hi dev crowd,
when working with scripts on webservers you often have files which are 
a few K big, and juggling with several modified versions of these you 
oftenly run into a problem with the overwrite dialog: the size is 
always shown as specified by IEC 60027-2. So two files 6136 and 6197 
bytes each show up as 6.0 KiB. The behaviour i had in mind was to 
compare the file sizes and change to the next finer grained unit size 
on which the file size change becomes visible. Now while the 
comparison code would be easy, KLocale::formatByteSize can't be told 
which output unit size to use. Now what would be the best way to make 
that possible with regard to API compatibility: new functions 
formatByteSizeTo[Ki/Mi/Gi/Ti]B or add an numed parameter? And btw the 
function doesn't seem to be ready for Files of more than 2^49 Bytes ;)
regards marcel.


-- 
  "Obstacles are those frightful things you see when you take
   your eyes off your goal."         -- Henry Ford (1863-1947)

   Change the world! Vote: http://hfopi.org/vote-future




More information about the kde-core-devel mailing list