[Patch]Iconview:save descending + directories first; sort by type improvement

Anna Nymos fnschy at yahoo.de
Tue Aug 26 20:59:51 BST 2003


On Saturday 23 August 2003 17:13, David Faure wrote:
> On Saturday 23 August 2003 02:04, Anna Nymos wrote:
> > The attached patch for konqueror iconview does the following:
> > - Save whether the items should be sorted ascending or descending

I didn't work because I relied on some magic I didn't see, but there wasn't such.
Now its fixed.

> The only nitpick is the order of the data members (in the Private class)
>    bool caseInsensitiveSort:1;
>     QString sortcriterion;
> +   bool dirsfirst:1;
> +   bool descending:1;
>  };
>
> The two bools should go before the QString, so that the existing bitfield
> can be extended with two new bits (otherwise it starts another bitfield,
> which defeats the point of using ":1" :)
One never stops learning :-), fixed now.

>
> > - When sorting by filetype, always sort by name within one filetype
> > (fixes http://bugs.kde.org/show_bug.cgi?id=58884)
>
> Hmm,
> -            case Type: key = item->item()->mimetype(); break; // ### slows
> down listing :-( +            case Type: key =
> item->item()->mimetype()+item->text().lower(); break; // ### slows down
> listing :-( I'm not sure this fix is 100% correct....
> If file "y" is x-tar and file "a" is x-targz, then "y" should be before
> "a", but the keys will be x-tary and x-targza so "y" will be after "a".
> This will show up as a bug if you also have a file "b" that is x-tar,
> because then the order will be "b" (x-tar), "a" (x-targz), "y" (x-tar), so
> the two x-tar files are not grouped together. (Phew, it wasn't easy to find
> a working testcase :)
>
> Not sure how to fix this properly though. At least using a separator that
> is low in the ascii table might help (might even be '\008' or so). Then I
> can't find a case that wouldn't be sorted correctly, since it ensures any
> x-tar file is sorted before any x-tar<something> file.

I used '\008' as you proposed. There is another instance of similar code at line 1145:
it->setKey( static_cast<KFileIVI *>( it )->item()->mimetype() + '~' + it->text().lower() );
Should both be '\008', '~' or left as it is now?

>
> Feel free to commit.

Waiting for your comments first...

Regards,
Anna Nymos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iconview.diff
Type: text/x-diff
Size: 7112 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20030826/92b706e6/attachment.diff>


More information about the kfm-devel mailing list