Bug 173027 - Others group is not sorted
Summary: Others group is not sorted
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
: 188622 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-17 13:05 UTC by heikki.lehvaslaiho
Modified: 2009-08-14 23:02 UTC (History)
5 users (show)

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


Attachments
Wrong alphabetic sorting inside the group "Others" (trunk) (43.34 KB, image/png)
2009-08-14 20:44 UTC, Peter Penz
Details
Almost a correct fix (1008 bytes, patch)
2009-08-14 22:15 UTC, Rafael Fernández López
Details

Note You need to log in before you can comment on or make changes to this bug.
Description heikki.lehvaslaiho 2008-10-17 13:05:33 UTC
Version:           1.1 (using 4.1.2 (KDE 4.1.2), Kubuntu packages)
Compiler:          gcc
OS:                Linux (i686) release 2.6.24-19-generic

When using 'View Mode -> Icons', 'Sort By -> Names' and 'Show in Groups', the files with names starting with a letter are correctly grouped and sorted, but the last group 'Others' with file names starting with numbers is not sorted at all. 

Unselecting 'Show in Groups' shows all files together and correctly sorted.

Try this in a new directory with
$ touch 1 2 3 4 5 6 7 aa aaa ab ac bb0 bb1 bb2
Comment 1 Frank Reininghaus 2008-10-18 22:23:35 UTC
Thanks for the bug report. I can confirm this in 4.1.2 (Kubuntu) and trunk rev. 873100.
Comment 2 Dario Andres 2008-12-19 20:48:58 UTC
I can reproduce this bug using:

Qt: 4.4.3
KDE: 4.1.85 (KDE 4.1.85 (KDE 4.2 Beta2))
kdelibs svn rev. 899058 / kdebase svn rev. 899058
on ArchLinux x86_64 - Kernel 2.6.27.8

A workaround is:

Re-sort by size (icons aren't grouped) and then
Re-sort by Name again

Now the files in the Other group are ordered.
Comment 3 Peter Penz 2008-12-20 13:54:47 UTC
SVN commit 899245 by ppenz:

Assure that the items within the "Others" group are sorted too, when sorting by name and using categorization.

@Rafael: Could you please have a look whether this patch is OK? It fixes bug 173027 but it is unclear for me why the deleted lines had been added at all. Thanks :-)

CCMAIL: ereslibre@kde.org
BUG: 173027

 M  +0 -4      dolphinmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=899245
Comment 4 Peter Penz 2008-12-22 08:18:20 UTC
SVN commit 900071 by ppenz:

revert SVN commit 899245: The patch does not work as expected.

CCMAIL: ereslibre@kde.org
CCBUG: 173027

 M  +4 -0      dolphinmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=900071
Comment 5 Peter Penz 2008-12-22 08:19:09 UTC
I had to reopen this issue again, as the patch does not work as expected :-(
Comment 6 Frank Reininghaus 2009-04-01 22:56:52 UTC
*** Bug 188622 has been marked as a duplicate of this bug. ***
Comment 7 Rafael Fernández López 2009-08-14 10:48:16 UTC
This is fixed in trunk (KDE 4.4). Please reopen if you can still reproduce this issue in trunk.

Since the fix has been a complete rewrite of KCategorizedView (from what I understand), this cannot be backported to KDE 4.3.x series.
Comment 8 Michiel de Bruijne 2009-08-14 18:31:53 UTC
(In reply to comment #7)
> This is fixed in trunk (KDE 4.4). Please reopen if you can still reproduce this
> issue in trunk.
> 
> Since the fix has been a complete rewrite of KCategorizedView (from what I
> understand), this cannot be backported to KDE 4.3.x series.

----

Thanks a lot! I will test the new version and report if I'm still able to reproduce this.
Comment 9 Peter Penz 2009-08-14 20:43:26 UTC
@Rafael: The issue is still there on trunk :-( I've attached a screenshot... The screenshot shows:
- (x) Sort by Name
- [x] Folders First
- [x] Show in Groups

I know from my patches at comment 3 that the fix is non-trivial, but I'll give it a try again.
Comment 10 Peter Penz 2009-08-14 20:44:16 UTC
Created attachment 36158 [details]
Wrong alphabetic sorting inside the group "Others" (trunk)
Comment 11 Rafael Fernández López 2009-08-14 21:50:06 UTC
Ok, now I could reproduce it.

So it seems that KCategorizedSortFilterProxyModel (kdeui/itemviews) on lessThan method is returning before asking subSortLessThan().

Still investigating...
Comment 12 Rafael Fernández López 2009-08-14 22:15:31 UTC
Created attachment 36159 [details]
Almost a correct fix

Fixes this bug but introduces another one.

For example, a file starting with "Ñ" or "ñ" is not placed between "M" and "N", where it belongs, but between "Z" and "Others".
Comment 13 Peter Penz 2009-08-14 22:36:59 UTC
SVN commit 1011495 by ppenz:

- Fixed issue that the items inside the "Other" category are sorted in a wrong manner.

- Removed redundant code.

BUG: 173027

 M  +2 -6      dolphinmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1011495
Comment 14 Peter Penz 2009-08-14 22:38:09 UTC
SVN commit 1011496 by ppenz:

Backport of SVN commit 1011495:

- Fixed issue that the items inside the "Other" category are sorted in a wrong
manner.

- Removed redundant code.

CCBUG: 173027


 M  +2 -6      dolphinmodel.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1011496
Comment 15 Rafael Fernández López 2009-08-14 22:43:25 UTC
I am not sure this fix is the correct...

I think there are characters over 'Z', so it doesn't actually matter if the second is the "ReplacementCharacter", because the first one (Z) is not the highest one... I am writing another patch... and you can have a look...
Comment 16 Rafael Fernández López 2009-08-14 22:58:25 UTC
Anyway, tested your fix and works here. Mine was getting more complicated. Hoping yours is completely fine, but not sure about it...
Comment 17 Peter Penz 2009-08-14 23:02:10 UTC
Thanks Rafael! I tried several approaches and for me it is unclear in general
how the sortRoleData() can influence the sort order of items _within_ a
group... (I did not investigate in detail the KCategorized* classes) E. g. when
using '[' instead of 'Z' (where '[' has a unicode of Z + 1) the sorting within
the group is wrong again. When using 'Z' the sorting is OK, but then there is a
conflict with the Z-group...