kwin/scripting
Martin Gräßlin 2764565f9d Allow Scripts to add menus to the UserActionsMenu
A script can register a callback through registerUserActionsMenu to be
informed when the UserActionsMenu is about to be shown. This menu calls
the Scripting component to gather actions to add to a Scripts submenu.

The Scripting component now asks all scripts for the actions, which will
invoke the registered callbacks with the Client for which the menu is to
be shown as argument.

The callback is supposed to return a JSON structure describing how the
menu should look like. The returned object can either be a menu item or
a complete menu. If multiple menu items or menus are supposed to be added
by the script it should just register multiple callbacks.

The structure for an item looks like the following:
{
    text: "My caption",
    checkable: true,
    checked: false,
    triggered: function (action) {
       print("The triggered action as parameter");
    }
}

The structure for a complete menu looks quite similar:
{
    text: "My menu caption",
    items: [
         {...}, {...} // items as described above
    ]
}

The C++ part of the script parses the returned object and generates
either QAction or QMenu from it. All objects become children of the
scripts QMenu provided by the UserActionsMenu.

Before the menu is shown again the existing menu is deleted to ensure
that no outdated values from no longer existing scripts are around. This
means the scripts are queried each time the menu is shown.

FEATURE: 303756
FIXED-IN: 4.10
REVIEW: 106285
2012-09-07 07:32:00 +02:00
..
documentation-global.xml Allow Scripts to add menus to the UserActionsMenu 2012-09-07 07:32:00 +02:00
kwinscript.desktop SVN_SILENT made messages (.desktop file) 2012-08-11 12:40:05 +02:00
meta.cpp
meta.h
scriptedeffect.cpp fix private slot name in connect 2012-06-07 18:22:09 +02:00
scriptedeffect.h Screen Edge bindings for Scripts and Scripted Effects 2012-05-15 17:54:31 +02:00
scripting.cpp Allow Scripts to add menus to the UserActionsMenu 2012-09-07 07:32:00 +02:00
scripting.h Allow Scripts to add menus to the UserActionsMenu 2012-09-07 07:32:00 +02:00
scriptingutils.cpp
scriptingutils.h Allow Scripts to add menus to the UserActionsMenu 2012-09-07 07:32:00 +02:00
timer.cpp
workspace_wrapper.cpp Fix incorrect connects of Activities in WorkspaceWrapper 2012-07-09 06:31:58 +02:00
workspace_wrapper.h missing include 2012-07-19 07:11:45 +02:00