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

Kross

  • Kross
  • ScriptingPlugin
Public Member Functions | Protected Slots | List of all members
Kross::ScriptingPlugin Class Reference

#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:

<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
parentThe 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
userActionsFilescripts.rc filepath – file may be modified by user
referenceActionsDirdir – 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,
ChildrenInterface::Options  options 
)

Add a QObject to the list of children.

The object will be published to the scripting code.

Parameters
objectThe QObject instance that should be added to the list of children.
nameThe 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::addObject ( QObject *  object,
const QString &  name = QString() 
)
Deprecated:
use another addObject overload

Definition at line 103 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 ( )
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.

void ScriptingPlugin::slotResetScriptActions ( )
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:
  • ui/plugin.h
  • ui/plugin.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:54 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kross

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal