Human readable display of file sizes, modification times and permissions
Robert Knight
robertknight at gmail.com
Sun Apr 29 19:56:17 BST 2007
Hello,
A long time bug-bear of mine in Konqueror is the display of
modification / access dates, file sizes and permissions in a format
which is difficult to read. KDE already has code for converting some
of these into more readable formats.
I would like to make alterations to the relevant parts of KDirModel
and KFileItem to display easier-to-understand text.
I wanted to get opinions on how the information ought to be displayed.
My current thoughts are:
Sizes:
Displayed in terms of the largest unit possible. eg. "33 MB".
KLocale::formatByteSize() can already be used to convert a size in
bytes into a suitable string. For directories, I think it would be
best to display the number of items in the directory ( or failing
that, an empty string ) , instead of the "4.0 KiB" which is currently
displayed, because that is not the size of the directory contents.
For empty files, I suggest displaying the string "Empty" rather than
"0 B". The problem with using an item count is that it takes time to
fetch the item counts for the subdirectories.
Modification Dates:
The current format is YYYY-MM-DD HH:MM:SS. For the time being, I
plan to use the FancyShortDate format defined in KLocale, since that
is straightforward. I think it would be useful in some places though
to have a relative time and date. I could probably use
KLocale::formatDuration for this, although at the moment it only goes
up to a count in days, and if my maths is correct, the duration can
only be a maximum of "6 weeks" or so because it takes an argument in
milliseconds as an unsigned int.
Permissions:
I am not sure how best to handle this. The present format (
"uuugggooo" ) is good for experienced users who know the format and
how to parse it, because it fits a lot of information into a very
short space. However I would have thought it meaningless for new KDE
users.
Attached is a trivial patch which implements the above. This breaks
sorting in KDirModel, which would need to reimplement
QAbstractItemModel::sort() I think to sort the model properly.
Regards,
Robert.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kio_human_readable_dates_and_sizes.patch
Type: text/x-diff
Size: 2444 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20070429/97198df0/attachment.patch>
More information about the kfm-devel
mailing list