Bug 404393

Summary: Sorting by name does not work as expected when some entry contains accented character
Product: [Applications] kmenuedit Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde.jen6
Priority: NOR Keywords: junior-jobs
Version: 5.15.0   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.16.0
Sentry Crash Report:
Attachments: screen recording of kmenuedit
screenshot - Dolphin sorts files/folders by name as expected
After patch sort result

Description Patrick Silva 2019-02-15 14:14:03 UTC
Created attachment 118106 [details]
screen recording of kmenuedit

SUMMARY
Watch the screen recording please. "Área de trabalho..." appears after "Kavantum Manager" after I sort the entries by name.
kmenuedit should sort the entries by name like Dolphin does with files/folders.

Operating System: Arch Linux 
KDE Plasma Version: 5.15.0
KDE Frameworks Version: 5.55.0
Qt Version: 5.12.1
Comment 1 Patrick Silva 2019-02-15 14:14:47 UTC
Created attachment 118107 [details]
screenshot - Dolphin sorts files/folders by name as expected
Comment 2 Christoph Feck 2019-03-09 00:49:04 UTC
https://cgit.kde.org/kmenuedit.git/tree/treeview.cpp#n144 shows the comparison is made using the QString::operator<(), which according to https://doc.qt.io/qt-5/qstring.html#querying-string-data is not locale-aware, and should be replaced with QString::localeAwareCompare().
Comment 3 songeon 2019-04-08 18:29:54 UTC
Hi I made an path based on Comment 2. Please review it.
https://phabricator.kde.org/D20386
Comment 4 songeon 2019-04-08 18:31:19 UTC
Created attachment 119301 [details]
After patch sort result
Comment 5 Christoph Feck 2019-04-25 19:46:38 UTC
Git commit fb171dff39c7976d8891b6c9a848857439e660ff by Christoph Feck, on behalf of Geon Son.
Committed on 25/04/2019 at 19:41.
Pushed by cfeck into branch 'master'.

Fix sorting to use locale-aware comparisons

In TreeItem, there are two compare functions, itemNameLessThan() and
itemDescriptionLessThan().
These two functions were using < operator to compare strings, which does
not consider the user's locale.

So change compare function to QString::localeAwareCompare()

TEST PLAN

Based on bug attachment, I add the Á and A to test it.
FIXED-IN: 5.16.0

Differential Revision: https://phabricator.kde.org/D20386

M  +4    -4    treeview.cpp

https://commits.kde.org/kmenuedit/fb171dff39c7976d8891b6c9a848857439e660ff