Kross
#include <plugin.h>
Inherits Plugin.
Public Member Functions | |
ScriptingPlugin (QObject *parent=0) | |
ScriptingPlugin (const QString &collectionName, const QString &userActionsFile, const QString &referenceActionsDir=QString(), QObject *parent=0) | |
virtual | ~ScriptingPlugin () |
void | addObject (QObject *object, const QString &name, ChildrenInterface::Options options) |
void | addObject (QObject *object, const QString &name=QString()) |
virtual void | setDOMDocument (const QDomDocument &document, bool merge=false) |
Protected Slots | |
virtual void | slotEditScriptActions () |
virtual void | slotResetScriptActions () |
Detailed Description
The ScriptingPlugin class loads additional actions stored in rc files with the KrossScripting format:
The 'name' attribute in collection element will be used to match the menu object name. If no menu already exists with this name, a new one is created. In this example, the user will see a menu item with the text "Dummy Script" in "File" menu, which will execute the dummy_script.py script.
By default it tries to find kross rc files in APPDATA%/scripts directory. Clients of this class can use slotEditScriptActions() as a way to override and/or extend the default script actions (if they exist at all).
You may create multiple instances of ScriptingPlugin by using alternative c'tor.
Definition at line 60 of file ui/plugin.h.
Constructor & Destructor Documentation
|
explicit |
Constructor.
Definition at line 66 of file ui/plugin.cpp.
ScriptingPlugin::ScriptingPlugin | ( | const QString & | collectionName, |
const QString & | userActionsFile, | ||
const QString & | referenceActionsDir = QString() , |
||
QObject * | parent = 0 |
||
) |
Allows having actions defined in a custom location, eg for project-specific actions.
- Parameters
-
userActionsFile scripts.rc filepath – file may be modified by user referenceActionsDir dir – APPDATA%/scripts/referenceActionsDir% contains standard actions for this plugin instance; has a lower priority than userActionsFile.
Definition at line 74 of file ui/plugin.cpp.
|
virtual |
Destructor.
Definition at line 83 of file ui/plugin.cpp.
Member Function Documentation
void ScriptingPlugin::addObject | ( | QObject * | object, |
const QString & | name, | ||
ChildrenInterface::Options | options | ||
) |
Add a QObject to the list of children.
The object will be published to the scripting code.
- Parameters
-
object The QObject instance that should be added to the list of children. name The name the QObject should be known under. If not defined, the QObject's objectName is used.
Definition at line 109 of file ui/plugin.cpp.
- Deprecated:
- use another addObject overload
Definition at line 103 of file ui/plugin.cpp.
|
virtual |
Re-implement in order to load additional kross scripting rc files.
Definition at line 97 of file ui/plugin.cpp.
|
protectedvirtualslot |
This slot will open/create a scriptactions.rc file at $KDEHOME/share/apps/application/scripts/ which will overide other kross rc files.
This allows a user to extend existing menus with new actions.
Definition at line 248 of file ui/plugin.cpp.
|
protectedvirtualslot |
Deletes the user rc file, which has the effect of falling back to the default script actions (if any).
Definition at line 261 of file ui/plugin.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:44 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.