Warning, /plasma/plasma-desktop/design/containmentactions is written in an unsupported language. File is not indexed.

0001 ContainmentActions
0002 ==========
0003 
0004 Overview
0005 --------
0006 "ContainmentActions" are components that respond to mouse events, usually by either performing an
0007 action or showing a menu with multiple actions.
0008 
0009 Timeline
0010 --------
0011 Introduced in: libplasma x.x (KDE 4.4.0)
0012 
0013 Component Type
0014 --------------
0015 ContainmentActions are plugins of ServiceType Plasma/ContainmentActions.
0016 
0017 Component Description
0018 ---------------------
0019 ContainmentAction plugins are registered using .desktop files. These files should be
0020 named using the following naming scheme:
0021 
0022     plasma-containmentactions-<pluginname>.desktop
0023 
0024 If a containmentactions plugin provides a configuration UI,
0025 it should include the line X-Plasma-HasConfigurationInterface=true.
0026 
0027 All other entries should follow the standard .desktop specification,
0028 supplemented by the standard KPluginInfo keys.
0029 
0030 Component API
0031 -------------
0032 Subclasses: QObject
0033 
0034 *** Key Methods ***
0035 
0036         void contextEvent(QEvent *event);
0037 Implement this method to get events. you'll probably want to check the event type and send different
0038 events to your own methods; see the plugins in workspace for examples.
0039 Currently you can expect to get mouse press, release, and wheel events.
0040 If you're showing a menu you should use MousePress and ignore MouseRelease.
0041 If you're performing an immediate action you should ignore MousePress and use MouseRelease.
0042 
0043 The incoming event will always have the buttons and modifiers that the user configured as the trigger, so
0044 there's no sense in checking those values.
0045 
0046         void init(const KConfigGroup &config);
0047 Do whatever initialization is needed here (not in the constructor).
0048 
0049 A configuration UI can optionally be provided by overloading the configuration methods:
0050         QWidget* createConfigurationInterface(QWidget* parent);
0051         void configurationAccepted();
0052         void save(KConfigGroup &config);
0053 
0054 when configurationAccepted is called, you should read from your config UI and extract all your data
0055 from it; the UI may be deleted after the function returns.
0056 when save is called, save that data to the provided config group.
0057 
0058 if your plugin needs to be configured before it is useful, call setConfigurationRequired() from
0059 init().
0060 
0061 Containment Interface
0062 ---------------------
0063 The Containment class supports loading and using containmentactions plugins.
0064 Subclasses need do nothing to get this support. If a subclass has extra actions it wants in the
0065 contextmenu, it can provide them in contextualActions() the same as before - but there's no longer
0066 any need to return standard actions like "add widgets" and "show krunner".
0067 
0068 ContextActions plugins to use are set using the setContainmentActions(const QString &trigger, const QString &pluginName)
0069 method. an empty string removes any plugin set for the given trigger.
0070 Trigg format is determined by the static function ContextActions::eventToString().
0071 
0072 User Configuration
0073 ------------------
0074 It is up to the host application to provide a configuration interface, such
0075 as a dialog, to the user.
0076 
0077 *** Plasma Desktop Implementation ***
0078 
0079 A settings dialog is provided for the DesktopView (a second page in the same dialog as the wallpaper)
0080 
0081 This dialog allows selecting one trigger for each installed plugin.
0082 
0083 Future Work
0084 -----------
0085 * Current UI in shells/desktop/ needs work.
0086