Avoid asking model to create string-serialized icon data where possible.
ClosedPublic

Authored by hein on Jun 17 2016, 8:28 AM.

Details

Summary

Use LauncherUrlWithoutIcon data role where the icon is not needed, and
get LauncherUrl procedurally where it is.

This is a version of D1921 that avoids breaking the writing of the
fallback icon to config.

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.
hein updated this revision to Diff 4579.Jun 17 2016, 8:28 AM
hein retitled this revision from to Avoid asking model to create string-serialized icon data where possible..
hein updated this object.
hein edited the test plan for this revision. (Show Details)
hein added a reviewer: dfaure.
hein added a project: Plasma.
hein added a subscriber: plasma-devel.
dfaure edited edge metadata.Jun 17 2016, 8:39 AM

Maybe it should have been the other way around, LauncherUrlWithIcon where needed ;-)
(it seems the icon is only rarely needed)

applets/taskmanager/package/contents/ui/ContextMenu.qml
225

Is it expected that requestRemoveLauncher is "without icon" and requestAddLauncher is "with icon"? Seems asymmetric but I don't know enough about this to know if it's ok or not.

hein marked an inline comment as done.Jun 17 2016, 8:44 AM
hein added inline comments.
applets/taskmanager/package/contents/ui/ContextMenu.qml
225

It's ok because requestRemoveLauncher() (and for that matter launcherPosition()) will ignore the icon data when comparing URLs to remove them. It has to because window icons can change at runtime, so the disk-stored string-encoded icon for a launcher might be different from what the window has currently, but since it's still the same app, we do want to remove the launcher.

hein marked an inline comment as done.Jun 17 2016, 8:45 AM

I didn't like "WithIcon" because it sounds like it guarantees handing over an icon, but it's really a fallback - so would have to be LauncherUrlWithFallbackIcon, which is quite a mouthful. I think it's prettier to have LauncherUrl to be the full thing and opt into the restrictions :)

dfaure accepted this revision.Jun 17 2016, 8:48 AM
dfaure edited edge metadata.
This revision is now accepted and ready to land.Jun 17 2016, 8:48 AM
This revision was automatically updated to reflect the committed changes.