Hi everyone,
Plasma's Device Notifier applet offers actions for devices, such as
"open in file manager", "download images", "format partition" provided
through Solid actions. Those are basically special desktop files with a
predicate that Solid runs against your drives to determine whether the
action should be offered or not.
I want to add this functionality to places outside of Plasma, e.g.
Dolphin. Fetching those actions is just simple QStandardPaths finding
desktop files in a special location.
However, the Exec line can contain a few special placeholders, e.g. %f
for the mount path of the device the action was executed on, or %i for
its ID. This is done through a KMacroExpander in the hotplug data engine
in plasma-workspace [1].
Now the big question: Where can I put this class so I can use it from
Dolphin, KIO, maybe others?
* Solid - logical place, but can't because it's Tier 1 and cannot depend
on KCoreAddons where KMacroExpander lives
* KService - where the launcher jobs are supposed to go (I heard) but
that doesn't depend on Solid and I am not sure it's a good idea to add
it as a dep for that
* KCompletion - err..?
* KIO - alongside DesktopExecParser, sounds related but also is pretty
random.
Or should we add a `setDevice(Solid::Device)` method to
CommandLauncherJob and, if set, do the expansion under the hood?
Suggestions welcome.
Cheers
Kai Uwe
PS: If we hadn't killed SolidUiServer I could have delegated this work
to it over a DBus call ;)
PPS: I am glad SolidUiServer is dead.
[1]
https://invent.kde.org/plasma/plasma-workspace/-/blob/master/dataengines/hotplug/deviceserviceaction.cpp#L93