6
"ContainmentActions" are components that respond to mouse events, usually by either performing an
7
action or showing a menu with multiple actions.
11
Introduced in: libplasma x.x (KDE 4.4.0)
15
ContainmentActions are plugins of ServiceType Plasma/ContainmentActions.
19
ContainmentAction plugins are registered using .desktop files. These files should be
20
named using the following naming scheme:
22
plasma-containmentactions-<pluginname>.desktop
24
If a containmentactions plugin provides a configuration UI,
25
it should include the line X-Plasma-HasConfigurationInterface=true.
27
All other entries should follow the standard .desktop specification,
28
supplemented by the standard KPluginInfo keys.
36
void contextEvent(QEvent *event);
37
Implement this method to get events. you'll probably want to check the event type and send different
38
events to your own methods; see the plugins in workspace for examples.
39
Currently you can expect to get mouse press, release, and wheel events.
40
If you're showing a menu you should use MousePress and ignore MouseRelease.
41
If you're performing an immediate action you should ignore MousePress and use MouseRelease.
43
The incoming event will always have the buttons and modifiers that the user configured as the trigger, so
44
there's no sense in checking those values.
46
void init(const KConfigGroup &config);
47
Do whatever initialization is needed here (not in the constructor).
49
A configuration UI can optionally be provided by overloading the configuration methods:
50
QWidget* createConfigurationInterface(QWidget* parent);
51
void configurationAccepted();
52
void save(KConfigGroup &config);
54
when configurationAccepted is called, you should read from your config UI and extract all your data
55
from it; the UI may be deleted after the function returns.
56
when save is called, save that data to the provided config group.
58
if your plugin needs to be configured before it is useful, call setConfigurationRequired() from
63
The Containment class supports loading and using containmentactions plugins.
64
Subclasses need do nothing to get this support. If a subclass has extra actions it wants in the
65
contextmenu, it can provide them in contextualActions() the same as before - but there's no longer
66
any need to return standard actions like "add widgets" and "run command".
68
ContextActions plugins to use are set using the setContainmentActions(const QString &trigger, const QString &pluginName)
69
method. an empty string removes any plugin set for the given trigger.
70
Trigg format is determined by the static function ContextActions::eventToString().
74
It is up to the host application to provide a configuration interface, such
75
as a dialog, to the user.
77
*** Plasma Desktop Implementation ***
79
A settings dialog is provided for the DesktopView (a second page in the same dialog as the wallpaper)
81
This dialog allows selecting one trigger for each installed plugin.
85
* Current UI in shells/desktop/ needs work.