Review Request 118128: Use actual bytes formatter for sizes in KDirModel

Mark Gaiser markg85 at gmail.com
Wed May 14 14:38:04 UTC 2014



> On May 14, 2014, 2:13 p.m., Mark Gaiser wrote:
> > Ehh..
> > 
> > Does this mean that there is no way to get the actual byte size anymore?
> > 
> > In that case i think it would be better to introduce a new role: "HumanReadableSize" which does what your patch is doing now.
> > 
> > Note: i really think that this user facing value should be determined in either the view, not the model. Imho the model should always return the byte version where the view formats it to whatever it wants. This also eases sorting.
> 
> Martin Klapetek wrote:
>     I don't disagree, but since that role already returns formatted bytes string (QLocale().toString(..)), it actually already does not quite return the bytes you might want (some locales have thousands delimiter etc).

Revising my stance. The format is already "1.000.000" thus breaking sorting since that is just the default QAbstractItemModel::sort which means it's doing a local aware string comparison.

With that in mind: +1 to make it fully human readable thus accepting this patch.

However, it might be good to add a new role called "Bytes". Then KDirModel::sort should use the Bytes role when Size is provided. That should fix sorting based on size.


- Mark


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118128/#review57921
-----------------------------------------------------------


On May 14, 2014, 2:01 p.m., Martin Klapetek wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/118128/
> -----------------------------------------------------------
> 
> (Updated May 14, 2014, 2:01 p.m.)
> 
> 
> Review request for KDE Frameworks and David Faure.
> 
> 
> Repository: kio
> 
> 
> Description
> -------
> 
> Now I'm not sure if returning the unit together with the size won't break some things, but as it returns string already, I thought returning it in the "human readable" form would be better than always returning bytes.
> 
> 
> Diffs
> -----
> 
>   src/widgets/kdirmodel.cpp 70d5ee4 
> 
> Diff: https://git.reviewboard.kde.org/r/118128/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Martin Klapetek
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140514/fcdf79b7/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list