Bug 404393 - Sorting by name does not work as expected when some entry contains accented character
Summary: Sorting by name does not work as expected when some entry contains accented c...
Status: RESOLVED FIXED
Alias: None
Product: kmenuedit
Classification: Applications
Component: general (show other bugs)
Version: 5.15.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2019-02-15 14:14 UTC by Patrick Silva
Modified: 2019-04-25 19:46 UTC (History)
1 user (show)

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


Attachments
screen recording of kmenuedit (506.51 KB, video/webm)
2019-02-15 14:14 UTC, Patrick Silva
Details
screenshot - Dolphin sorts files/folders by name as expected (64.56 KB, image/png)
2019-02-15 14:14 UTC, Patrick Silva
Details
After patch sort result (476.25 KB, image/png)
2019-04-08 18:31 UTC, songeon
Details

Note You need to log in before you can comment on or make changes to this bug.
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