Use natural sorting in ActivityModel
ClosedPublic

Authored by davidedmundson on Feb 12 2019, 12:55 PM.

Details

Summary

ActivityModel sorts internally.
It currently does a non-locale or number aware sort on user-facing
strings.

This patches uses QCollator.

This changes the order in the KCM.

It doesn't affect the order in the activity switcher as that has it's
own sorting proxy on top handling last used time.

It doesn't quite fix the issue in the bug report as PagerModel mixes
sources.

CCBUG: 404149

Test Plan

Set activities named
"10.asdf"
"1.foo"
"2.bar"

KCM now shows them in the order 1,2,10

Diff Detail

Repository
R6 KActivities
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 12 2019, 12:55 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
davidedmundson requested review of this revision.Feb 12 2019, 12:55 PM
ngraham accepted this revision.Feb 12 2019, 3:52 PM
ngraham added a subscriber: ngraham.

Clever!

I believe the bug is about the switcher though, not the KCM.

This revision is now accepted and ready to land.Feb 12 2019, 3:52 PM
apol added a subscriber: apol.Feb 12 2019, 6:18 PM
apol added inline comments.
src/imports/activitymodel.h
132

Do you think it would be possible to store the collator elsewhere?
Re-creating it is a bit expensive to be doing it nlogn times per sort (not that it won't work).

We don't support changing the application language at runtime (env vars don't change at runtime), so it shouldn't be a big deal (it could even be a static variable).

This revision was automatically updated to reflect the committed changes.