Change TreeItem Compare function from < operator to QString::localeAwareCompare
ClosedPublic

Authored by jen6 on Apr 8 2019, 6:27 PM.

Details

Summary

In TreeItem, there has two compare function itemNameLessThan and itemDescriptionLessThan.
Those two functions were use < operator to compare string. But it doesn't consider about locale.
So change compare function to QString::localeAwareCompare
BUG: 404393

Test Plan

Based on bug attachment, I add the Á and A to test it.

Diff Detail

Repository
R103 KMenu Editor
Branch
comparePatch
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10627
Build 10645: arc lint + arc unit
jen6 created this revision.Apr 8 2019, 6:27 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 8 2019, 6:27 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
jen6 requested review of this revision.Apr 8 2019, 6:27 PM
cfeck added a comment.Apr 8 2019, 9:07 PM

Are the toLower() calls really needed? I would have expected that localeAwareCompare() is case insensitive by default.

Also, please use return x instead of return (x).

jen6 added a comment.Apr 9 2019, 1:54 AM

Are the toLower() calls really needed? I would have expected that localeAwareCompare() is case insensitive by default.

Also, please use return x instead of return (x).

Yep It seems the localeAwareCompare is insensitive by default. I'll change it

jen6 updated this revision to Diff 55792.Apr 9 2019, 2:00 AM

remove toUpper when string comparing

QString::localeAwareCompare is insensitive by default. So toUpper is not needed.
and return without ();

cfeck accepted this revision.Apr 9 2019, 8:39 AM
This revision is now accepted and ready to land.Apr 9 2019, 8:39 AM
This revision was automatically updated to reflect the committed changes.