Bug 286726 - Folders are sorted with uppercase before lowercase
Summary: Folders are sorted with uppercase before lowercase
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 1.99
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords: reproducible
Depends on:
Blocks:
 
Reported: 2011-11-15 21:11 UTC by Frederik Schwarzer
Modified: 2013-01-10 14:28 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.0


Attachments
Sorting issue shown by expander? (127.99 KB, video/ogg)
2011-11-20 01:51 UTC, Frederik Schwarzer
Details
Sort-Issue: Use details-view + sort by type (352 bytes, application/x-gzip)
2011-11-20 11:31 UTC, Peter Penz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frederik Schwarzer 2011-11-15 21:11:24 UTC
Version:           unspecified (using Devel) 
OS:                Linux

Hi,

Dolphin now sorts folders in the way that folders starting with uppercase letters are shown before those with lowercase letters. That feels strange, since the casing does not matter much, does it?

Regards


Reproducible: Didn't try

Steps to Reproduce:
Open a folder with several folders with different casing, e.g.

A, a, B, b, C, c

Actual Results:  
A
B
C
a
b
c

Expected Results:  
A
a
B
b
C
c
Comment 1 Frederik Schwarzer 2011-11-15 21:24:01 UTC
On the command line the following is printed. Maybe it is related.

dolphin(12567) KFileItemModel::onSortRoleChanged: The sort-role has been changed to a role that has not been received yet
Comment 2 Peter Penz 2011-11-16 08:34:59 UTC
Thanks for the report, but I cannot reproduce the issue. Could you please check in the "Sort By" menu which role is used for sorting? Please also check whether "View -> [ ] Show in Groups" is disabled and whether the files are not folders (folders are always sorted before files if "Sort By -> [x] Folders First" is checked). The warning might indicate that a sort-role has been chosen where the data is received asynchronously (e.g. "Sort by Type")
Comment 3 Frederik Schwarzer 2011-11-17 23:35:53 UTC
I was talking about folders only. Folder B is sorted before folder a.
View mode is "Details", sort order is "Ascending" - "By Type".
(BTW: With that sort order, loading of a folder's content becomes quite jumpy. Is it possible to show the content after it has been sorted and before that just a buysy indicator?)
"Show folders first" is enabled, "Show in groups" is disabled.
It's the same with "natural sorting" enabled or disabled.

Please ask me if you need more info.
Comment 4 Peter Penz 2011-11-18 09:08:55 UTC
Thanks, this should be sufficient to have a look.

> BTW: With that sort order, loading of a folder's
> content becomes quite jumpy. Is it possible to
> show the content after it has been sorted and
> before that just a buysy indicator?

The reason why it jumps is that determining the type of a file can be timeconsuming and it is done asynchronously. It would be possible to show a busy indicator, but this could take several seconds for some folders so I'm not sure if this is the best way... Probably a combination might be fine: Showing the content in background and a kind of transparent overlay that indicates that still some loading is ongoing. I won't be able to implement such a indication for the 2.0 release but agree that this should be improved later.
Comment 5 Frederik Schwarzer 2011-11-20 01:51:04 UTC
Created attachment 65863 [details]
Sorting issue shown by expander?

Today I noticed something that I think might be connected. I am too tired to explain it, so I will attach a little video. It's a bit jumpy but I hope it shows the problem well.
Comment 6 Peter Penz 2011-11-20 11:31:17 UTC
Created attachment 65866 [details]
Sort-Issue: Use details-view + sort by type
Comment 7 Peter Penz 2011-11-20 11:33:21 UTC
Thanks for the video! I could reproduce the issue here and have attached your directory-example. I'll investigate into this a little bit later as I first need to finish 2 feature regressions in Dolphin 2.0 before doing some bugfixing again (the "Folders" panel does not work yet and opening folders automatically when dragging is also not implemented).
Comment 8 Todd 2011-12-11 14:34:52 UTC
I can confirm that the case-sensitive sorting issue is present in almost all sorting modes, with both "show in groups" enabled or disabled and "folders first" enabled or disabled.  

It does not occur when sorting by "name", but with all other sorting modes besides "date" it sorts names in a case-sensitive manner (I was not able to test date because I could not make two files with identical creation times).  So I think it is likely an issue with all sort modes besides "name".

So it occurs at the very least with: size, permissions, owner, group, type, link destination, and path.
Comment 9 Peter Penz 2011-12-13 22:44:17 UTC
Git commit 821c45ebc45a58ff87aaa593d447f7e54db4f7cc by Peter Penz.
Committed on 13/12/2011 at 23:38.
Pushed by ppenz into branch 'master'.

Fix several sort-issues

- Treeview: When sorting descending assure that the parent item is still
  ordered before the child items and not afterwards.
- Treeview: When sorting by other roles than names expansionsLevelCompare()
  had been buggy and resulted in ordering child items below wrong parent
  items.
- General: When sorting by another role than names and the role of
  two items had been equal a case sensitive sorting of the names had
  been done. This has been fixed by using the default name sorting
  as fallback.

BUG: 286726
FIXED-IN: 4.8.0

M  +93   -23   dolphin/src/kitemviews/kfileitemmodel.cpp
M  +11   -0    dolphin/src/kitemviews/kfileitemmodel.h

http://commits.kde.org/kde-baseapps/821c45ebc45a58ff87aaa593d447f7e54db4f7cc
Comment 10 David Sugar 2013-01-10 14:28:04 UTC
First, let me start this off by saying that some of us absolutely HATE AaBbCc ordering!  Like many, I use a lead upper case character to make a filename appear early in sorting to make it stand out and easy to find in a long directory list.  Every other filemanager I have worked with (nautilus, thunar, etc) either respects collation order from the LC env settings, or offers an explicit config option for case sensitive/insensitve name ordering. 

This may in fact be very easy to solve.  In the current dolphin codebase (4.9.4), I note that in kitemviews/kfileitemmodel.cpp ::stringCompare already has all the smarts to do either sensitive or insensitive ordering.  However, the KFileItemModel() constructor initializes m_caseSensitivity to Qt::CaseInsensitive.  I did my own local build setting the constructor to Qt::CaseInsenstive and was greatly pleased with the result....

What I am really suggesting is there should be a new KGlobalSettings for sensitive/insenstive filename ordering, and that m_caseSensitive get set based on that, rather than hardcoding one choice or the other on the world...