Bug 343452 - Does not sort numbers naturally any longer
Summary: Does not sort numbers naturally any longer
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kio
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.24.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 349390 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-01-28 12:16 UTC by Chris Warrick
Modified: 2017-08-14 21:13 UTC (History)
23 users (show)

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


Attachments
Dolphin (KDE 4) vs Gwenview (KDE 5). (110.92 KB, image/png)
2015-01-28 12:16 UTC, Chris Warrick
Details
Enable natural sorting on the QCollator for KDirSortFilterProxyModel (621 bytes, patch)
2016-08-02 09:39 UTC, FeepingCreature
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Warrick 2015-01-28 12:16:12 UTC
Before, numbers in filenames were sorted naturally (1, 2, 3, …, 9, 10, 11, 12).  In version 5.0.0-pre, numbers are sorted ASCIIbetically — 1, 10, 11, 12, 3…

Reproducible: Always

Steps to Reproduce:
1. Open a folder with file names that end in (or contain) a number, without leading zeroes.

Actual Results:  
1, 10, 11, 12, 3, 4, 5, 6, 7, 8, 9

Expected Results:  
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12
Comment 1 Chris Warrick 2015-01-28 12:16:42 UTC
Created attachment 90745 [details]
Dolphin (KDE 4) vs Gwenview (KDE 5).
Comment 2 Greg Lepore 2015-04-20 12:18:30 UTC
Confirm that this is still occurring on Gwenview 5.0.0pre.
Comment 3 Spadge 2015-06-06 19:44:29 UTC
Gwenview still doesn't respect the "Natural sorting of items" setting in Dolphin.

dpkg -l gwenview* | grep ^ii
ii  gwenview       4:15.04.1-0ubuntu1~ubuntu15.04~ppa1 amd64        image viewer

Thanks
Comment 4 Najjar 2015-07-25 18:40:10 UTC
This bug is in the latest stable
pacman -Qs gwenview
local/gwenview 15.04.3-1

pacman -Qs plasma-desktop
local/plasma-desktop 5.3.2-2
Comment 5 Éric Brunet 2015-11-19 13:09:35 UTC
Confirmed in 15.08 in a up-to-date fedora 23 installation.
Comment 6 Russ Huguley 2016-06-03 12:23:06 UTC
Also in Kubuntu 16.04
gwenview 15.12.3
Comment 7 Ori 2016-06-28 11:26:59 UTC
Confirmed in in Kubuntu 16.04 (gwenview 15.12.3)
Comment 8 roten.ben 2016-07-12 01:56:08 UTC
Still occurs, very annoying.
Comment 9 FeepingCreature 2016-08-02 08:56:37 UTC
Confirm on gwenview 15.12.3, qt 5.7, kf5.24.0. This is really annoying.
Comment 10 Leszek Lesner 2016-08-02 09:02:02 UTC
*** This bug has been confirmed by popular vote. ***
Comment 11 FeepingCreature 2016-08-02 09:39:21 UTC
Created attachment 100413 [details]
Enable natural sorting on the QCollator for KDirSortFilterProxyModel

Turns out this is actually a bug in KIO. QCollator does not enable "numeric mode", which KDirSortFilterProxyModel advertises as enabled, by default, and KIO's KDirSortFilterProxyModel does not enable it at all. As a result, as far as I can tell, natural sort never worked in KF5/Qt5.

Patch for KIO is attached.
Comment 12 Burkhard Lück 2016-10-10 15:20:52 UTC
(In reply to FeepingCreature from comment #11)
> Created attachment 100413 [details]
> Enable natural sorting on the QCollator for KDirSortFilterProxyModel
> 
> Turns out this is actually a bug in KIO. QCollator does not enable "numeric
> mode", which KDirSortFilterProxyModel advertises as enabled, by default, and
> KIO's KDirSortFilterProxyModel does not enable it at all. As a result, as
> far as I can tell, natural sort never worked in KF5/Qt5.
> 
> Patch for KIO is attached.

Please upload your patch to https://git.reviewboard.kde.org (repository kio) and add group kdeframewotks as reviewers

Thanks
Comment 13 Leszek Lesner 2016-10-10 15:32:53 UTC
Was already uploaded there. See https://git.reviewboard.kde.org/r/128574/
Comment 14 Konstantinos Smanis 2016-11-13 00:54:12 UTC
*** Bug 349390 has been marked as a duplicate of this bug. ***
Comment 15 Konstantinos Smanis 2016-11-27 19:25:41 UTC
This bug managed to annoy the hell out of that itching part of my brain, so I did a little digging. I posted my review on https://git.reviewboard.kde.org/r/128574/
Comment 16 Nate Graham 2017-04-21 14:55:25 UTC
Konstantinos Smanis's patch got downstreamed into openSUSE's Plasma repo, and I can confirm that it works and resolves the issue. Can we get it moved alone here so Plasma users in other distros can benefit as well?
Comment 17 Nate Graham 2017-04-21 14:58:06 UTC
Er,  FeepingCreature's patch.

I know it's not perfect, but it does resolve the issue, and we can integrate the perfect fix afterwards, right?
Comment 18 Elvis Angelaccio 2017-04-28 15:22:31 UTC
Git commit f29bbfb1c17dbfa92b27fa6d5a1c86b06a71a6b8 by Elvis Angelaccio, on behalf of Mathis Beer.
Committed on 28/04/2017 at 15:21.
Pushed by elvisangelaccio into branch 'master'.

KDirSortFilterProxyModel: bring back natural sorting

This fixes a regression of the KF5 port.
FIXED-IN: 5.34
REVIEW: 128574

M  +1    -0    src/filewidgets/kdirsortfilterproxymodel.cpp

https://commits.kde.org/kio/f29bbfb1c17dbfa92b27fa6d5a1c86b06a71a6b8
Comment 19 Nate Graham 2017-08-14 21:13:11 UTC
*** Bug 236059 has been marked as a duplicate of this bug. ***