• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

Kross

Kross::ScriptingPlugin

Kross::ScriptingPlugin Class Reference

The ScriptingPlugin class loads additional actions stored in rc files with the KrossScripting format:. More...

#include <plugin.h>

Inheritance diagram for Kross::ScriptingPlugin:
Plugin

List of all members.

Public Member Functions

void addObject (QObject *object, const QString &name=QString())
void addObject (QObject *object, const QString &name, ChildrenInterface::Options options)
 ScriptingPlugin (const QString &collectionName, const QString &userActionsFile, const QString &referenceActionsDir=QString(), QObject *parent=0)
 ScriptingPlugin (QObject *parent=0)
virtual void setDOMDocument (const QDomDocument &document, bool merge=false)
virtual ~ScriptingPlugin ()

Protected Slots

virtual void slotEditScriptActions ()
virtual void slotResetScriptActions ()

Detailed Description

The ScriptingPlugin class loads additional actions stored in rc files with the KrossScripting format:.

 <KrossScripting>
     <collection name="file" text="File">
         <script name="dummy_script" text="Dummy Script" comment="Dummy Script example"
                 file="dummy_script.py" interpreter="python" />
     </collection>
 </KrossScripting>

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

ScriptingPlugin::ScriptingPlugin ( QObject *  parent = 0  )  [explicit]

Constructor.

Parameters:
parent The parent QObject this QObject is child of.

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.

ScriptingPlugin::~ScriptingPlugin (  )  [virtual]

Destructor.

Definition at line 83 of file ui/plugin.cpp.


Member Function Documentation

void ScriptingPlugin::addObject ( QObject *  object,
const QString &  name = QString() 
)
Deprecated:
use another addObject overload

Definition at line 103 of file ui/plugin.cpp.

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.

void ScriptingPlugin::setDOMDocument ( const QDomDocument &  document,
bool  merge = false 
) [virtual]

Re-implement in order to load additional kross scripting rc files.

Definition at line 97 of file ui/plugin.cpp.

void ScriptingPlugin::slotEditScriptActions (  )  [protected, virtual, slot]

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.

void ScriptingPlugin::slotResetScriptActions (  )  [protected, virtual, slot]

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:
  • ui/plugin.h
  • ui/plugin.cpp

Kross

Skip menu "Kross"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal