/usr/include/kross/ui/plugin.h is in kdelibs5-dev 4:4.14.2-5+deb8u2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | /* This file is part of the KDE project
Copyright (C) 2008 Paulo Moura Guedes <moura@kdewebdev.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KROSS_PLUGIN_H
#define KROSS_PLUGIN_H
#include <kparts/plugin.h>
#include <kross/core/krossconfig.h>
#include <kross/core/childreninterface.h>
namespace Kross {
class ActionCollection;
}
class QWidget;
namespace Kross
{
/**
* The ScriptingPlugin class loads additional actions stored in rc files with the
* KrossScripting format:
*
* \code
* <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>
* \endcode
*
* 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.
*/
class KROSSUI_EXPORT ScriptingPlugin : public KParts::Plugin
{
Q_OBJECT
public:
/**
* Constructor.
*
* \param parent The parent QObject this QObject is child of.
*/
explicit ScriptingPlugin(QObject* parent = 0);
/**
* Allows having actions defined in a custom location, eg for project-specific actions
*
* \param userActionsFile scripts.rc filepath -- file may be modified by user
* \param referenceActionsDir dir -- %APPDATA%/scripts/%referenceActionsDir% contains standard actions for this plugin instance; has a lower priority than \a userActionsFile.
*/
ScriptingPlugin(const QString& collectionName, const QString& userActionsFile, const QString& referenceActionsDir=QString(), QObject* parent=0);
/**
* Destructor.
*/
virtual ~ScriptingPlugin();
/**
* Re-implement in order to load additional kross scripting rc files.
*/
virtual void setDOMDocument (const QDomDocument &document, bool merge = false);
/**
* Add a QObject to the list of children. The object will be published to the scripting code.
* \param object The QObject instance that should be added to the list of children.
* \param name The name the QObject should be known under. If not defined, the
* QObject's objectName is used.
*/
void addObject(QObject* object, const QString& name/* = QString()*/, ChildrenInterface::Options options/* = ChildrenInterface::NoOption*/);
///\deprecated use another addObject overload
void addObject(QObject* object, const QString& name = QString()); //BIC
protected Q_SLOTS:
/**
* 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.
*/
virtual void slotEditScriptActions();
/**
* Deletes the user rc file, which has the effect of falling back to the default script actions (if any).
*/
virtual void slotResetScriptActions();
private:
QDomDocument buildDomDocument(const QDomDocument& document);
void buildDomDocument(QDomDocument& document, Kross::ActionCollection* collection);
void save();
private:
class ScriptingPluginPrivate;
ScriptingPluginPrivate* const d;
};
}
#endif
|