Use icon chooser in Kicker and Dashboard configuration to select custom icon
ClosedPublic

Authored by dvratil on Aug 22 2017, 10:53 PM.

Details

Summary

Use KQuickAddons.IconDialog to choose a custom icon for the applet instead of just a plain old open file dialog with extension filter. This makes it possible to choose from actual icons like in KickOff which IMO is the most common use-case and is more user-friendly than having to find actual icon files in the filesystem (and which then get incorrectly scaled in the panel).

Diff Detail

Repository
R119 Plasma Desktop
Lint
Lint Skipped
Unit
Unit Tests Skipped
dvratil created this revision.Aug 22 2017, 10:53 PM
Restricted Application added a subscriber: plasma-devel. · View Herald TranscriptAug 22 2017, 10:53 PM

+1 from me

One can also choose a custom icon from file system in the icon dialog

davidedmundson added inline comments.
applets/kicker/package/contents/ui/ConfigGeneral.qml
26

this shouldn't be used in a config module.

Use QtQuick.Controls 1.x instead

broulik added inline comments.Aug 23 2017, 8:33 AM
applets/kicker/package/contents/ui/ConfigGeneral.qml
26

That's fine. Fwict this code is from Kickoff and there we have a QQC Button for the icon which inside has a Plasma panel SVG background and IconItem on top, so you get a "live preview" of how it looks with your current Plasma theme. We do not end up with white icon on white background.

hein added a subscriber: hein.Aug 23 2017, 11:39 AM

This was done intentionally in the past to allow people to pick random images and get the proper kind of URL back to feed into the Image (which isn't used anymore). Can you verify this workflow still works?

@hein Tested that, you can still choose an arbitrary image file in the filesystem through the dialog and the image is used correctly
@davidedmundson As Kai Uwe said, this is basically just copy-pasted from KickOff configuration code - do you still want me to change it to 1.x control?

hein added a comment.Aug 23 2017, 9:26 PM

Can you also check the following case:

  1. Use the old UI to
applets/kicker/package/contents/ui/ConfigGeneral.qml
123

This isn't OK - it needs to revert to the actual config default. Some distros change it to their branded icon and are very keen on wanting to override specifically the default rather than pre-setting a deviation. That's one reason why the old config format had cfg_icon and otherwise used cfg_useCustomButtonImage (while your approach here is to migrate everyone to cfg_icon by setting cfg_useCustomButtonImage to false when the UI is used).

@davidedmundson As Kai Uwe said, this is basically just copy-pasted from KickOff configuration code - do you still want me to change it to 1.x control?

No, if Kai says something is fine, it's probably fine.

BTW this change will also accidentally fix your blurry icon issue you showed me at Akademy.

broulik added inline comments.Aug 23 2017, 9:40 PM
applets/kicker/package/contents/ui/ConfigGeneral.qml
123

we could add a Q_INVOKABLE QVariant defaultValue() to KDeclarative ConfigPropertyMap so we could query this, like we already have an bool isImmutable()

dvratil updated this revision to Diff 18635.Aug 23 2017, 9:44 PM

Fix fallback to cfg_icon instead of hardcoded start-here-kde.

BTW this change will also accidentally fix your blurry icon issue you showed me at Akademy.

This change is a fix for the blurry icon which accidentally improves the config UI ;-)

hein accepted this revision.Aug 26 2017, 8:45 AM
This revision is now accepted and ready to land.Aug 26 2017, 8:45 AM
This revision was automatically updated to reflect the committed changes.

This change *is* a fix for the blurry icon which accidentally improves the config UI ;-)

Well not really, for absolute paths you're just avoding a bug in IconItem. See https://bugs.kde.org/show_bug.cgi?id=383513