Bug 87286 - Natural Order Sorting: look at http://sourcefrog.net/projects/natsort
Summary: Natural Order Sorting: look at http://sourcefrog.net/projects/natsort
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
: 91391 121927 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-16 11:58 UTC by Tengo Colitis
Modified: 2010-05-16 20:03 UTC (History)
3 users (show)

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


Attachments
Patch for natural order sorting for dolphin (4.34 KB, patch)
2007-01-09 17:29 UTC, Dominic Battre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tengo Colitis 2004-08-16 11:58:25 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    SuSE RPMs
OS:                Linux

It would be a great feature of Konqueror if it would support "Natural Order" sorting like PHP. That means:
Normal Sorting:
1 img1.png
2 img100.png
3 img2.png
Natural Order sorting:
1 img1.png
2 img2.png
3 img100.png
I've read in the PHP Manual (www.php.net") that it's homepage is:
http://sourcefrog.net/projects/natsort
Here you can download it & see more examples. It's freeware.
Comment 1 Stefan Nikolaus 2004-12-29 19:18:56 UTC
*** This bug has been confirmed by popular vote. ***
Comment 2 Allan Sandfeld 2004-12-29 19:32:19 UTC
Rather than referring to an extern project. The sorting just needs to separate strings in text and number parts, and then sort each part individually (e.g. img=img and 2<100).
Comment 3 Christian Loose 2006-02-14 14:07:48 UTC
*** Bug 121927 has been marked as a duplicate of this bug. ***
Comment 4 Martin Ponce 2006-08-13 00:36:16 UTC
it makes sense to include this feature in KDE Bug Tracking System
see the item "version"
http://bugs.kde.org/query.cgi
Comment 5 Ian 2006-08-30 09:21:12 UTC
As long as there is an option to disable it, I am in favor.
Comment 6 Dominic Battre 2007-01-09 17:28:21 UTC
I talked to people on #kde-devel and was told that the underlying data model of Konqueror is going to be adopted to the QT 4.x means.  Hence I looked into dolphin which is supposed to use the new data model.

I adapted the code from http://sourcefrog.net/projects/natsort to work with QStrings (and Unicode/locales) and came up with the following patch.  Martin Pool agreed to relicense the code under GPL or LGPL.  It probably makes sense to move the natural order sorting code to kdelibs/kdecore/strings/kstringhandler.*.  What do you think?

I'd be happy to hear about reviews of the patch.
Comment 7 Dominic Battre 2007-01-09 17:29:35 UTC
Created attachment 19213 [details]
Patch for natural order sorting for dolphin
Comment 8 Danny Angelo Carminati Grein 2007-02-16 16:33:22 UTC
Will this get in trunk?
Comment 9 FiNeX 2007-06-24 01:19:32 UTC
Dolphin now use the natural sort. I imagine that konqueror will use the dolphin engine for viewing files right? We can live without this feature in KDE 3.x :-)
Comment 10 Dominic Battre 2007-11-30 22:44:27 UTC
I think we can close this request. The patch has been applied to Dolphin. Konqueror uses the dolphin part. File > Open uses natural sorting order as well.
Comment 11 Dotan Cohen 2007-12-01 15:18:33 UTC
So long as Konqueror in KDE4 uses natural sort, then we can close the bug. I don't think that I'll switch to Dolphin. As Konqueror uses the dolphin part, this should not be a problem. Thanks.
Comment 12 lenooh 2007-12-01 21:46:44 UTC
Which version of dolphin has natural sorting? I have 0.9.2 and it doesn't have natural sorting.
Comment 13 Tommi Tervo 2007-12-12 10:44:56 UTC
Fixed in KDE 4. Verified with konqueror 3.97 and dolphin 0.95
Comment 14 Tommi Tervo 2007-12-12 10:55:25 UTC
*** Bug 91391 has been marked as a duplicate of this bug. ***
Comment 15 Bill Robert 2007-12-24 20:47:49 UTC
Will there be/is there a way to disable natural sorting?
Comment 16 Gleb Litvjak 2007-12-24 23:50:17 UTC
Hmmm... Why would anyone want to disable natural sorting?
Comment 17 Bill Robert 2007-12-25 12:29:31 UTC
This may not occur that often, but sometimes maybe:
If you represent data of binary trees in the following way:
filename0 --> First branch to the left
filename1 --> First branch to the right
filename01 --> First branch to the left, then right
filename10 --> First branch to the right, then left

Then the non-natural sorting would make more sense.

Also, if you don't seperate Version numbers by dots, the non-natural sorting would be better:
filename2 --> Version 2
filename21 --> Version 2.1
filename3 --> Version 3

Of course, this are not common cases of use - but they are possible so I think there should be a way to enable/disable this for specific folders
Comment 18 Allan Sandfeld 2010-05-16 20:03:13 UTC
SVN commit 1127469 by carewolf:

Fix natural sort. It assumes too much about the structure of the name.
BUG: 234273
CCBUG: 87286


 M  +5 -1      kstringhandler.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1127469