Use natural sorting in ActivityModel
AcceptedPublic

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

Details

Reviewers
ngraham
Group Reviewers
Plasma
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
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8195
Build 8213: arc lint + arc unit
Restricted Application added a project: Frameworks. · View Herald TranscriptTue, Feb 12, 12:55 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
davidedmundson requested review of this revision.Tue, Feb 12, 12:55 PM
ngraham accepted this revision.Tue, Feb 12, 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.Tue, Feb 12, 3:52 PM
apol added a subscriber: apol.Tue, Feb 12, 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).