[Panel Containment] Replace restore order logic by "algorithms"
ClosedPublic

Authored by broulik on Dec 28 2016, 1:41 PM.

Details

Summary

Replace the convoluted make an object with the order of applets by iterating them and then add them in order by a sort() and forEach().
This makes the code much easier to follow.

Test Plan

Verified that my applets are still added in the correct order. Also verified that applets not in the appletOrder are added at the end of the panel

Diff Detail

Repository
R119 Plasma Desktop
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik updated this revision to Diff 9415.Dec 28 2016, 1:41 PM
broulik retitled this revision from to [Panel Containment] Replace restore order logic by "algorithms".
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added a reviewer: Plasma.
broulik set the repository for this revision to R119 Plasma Desktop.
Restricted Application added a project: Plasma. · View Herald TranscriptDec 28 2016, 1:41 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
mart accepted this revision.Dec 28 2016, 3:51 PM
mart added a reviewer: mart.
This revision is now accepted and ready to land.Dec 28 2016, 3:51 PM
This revision was automatically updated to reflect the committed changes.

This has broken the initial panel population from a clean config.

I get all my applets added the wrong way round.
Reverting this patch fixes it.

I think it's this part:

appletsOrder["unordered"+i] = plasmoid.applets[i]

I think it's this part:

appletsOrder["unordered"+i] = plasmoid.applets[i]

My loop sorts elements that have no index last, maybe that's wrong somehow? It worked for me for when an applet isn't ordered yet but I can reproduce that adding a new "default" panel has its items wrong way round.