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

Kross

  • kross
  • core
action.h
Go to the documentation of this file.
1/***************************************************************************
2 * action.h
3 * This file is part of the KDE project
4 * copyright (C)2004-2007 by Sebastian Sauer (mail@dipe.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this program; see the file COPYING. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 ***************************************************************************/
19
20#ifndef KROSS_ACTION_H
21#define KROSS_ACTION_H
22
23#include <QtCore/QVariant>
24#include <QtCore/QObject>
25#include <QtCore/QDir>
26#include <QtCore/QUrl>
27#include <QtGui/QAction>
28#include <QtXml/QDomAttr>
29#include <QtScript/QScriptable>
30
31#include "errorinterface.h"
32#include "childreninterface.h"
33
34namespace Kross {
35
36 class Script;
37
94 class KROSSCORE_EXPORT Action
95 : public QAction
96 , public QScriptable
97 , public ChildrenInterface
98 , public ErrorInterface
99 {
100 Q_OBJECT
101
102 public:
103
113 Action(QObject* parent, const QString& name, const QDir& packagepath = QDir()); //BIC may be removed in favour of the next c'tor
114
126 Action(QObject* parent, const QUrl& url);
127
131 virtual ~Action();
132
139 void fromDomElement(const QDomElement& element);
140
149 void fromDomElement(const QDomElement& element, const QStringList& searchPath/* = QStringList()*/);
150
156 QDomElement toDomElement() const;
157
165 QDomElement toDomElement(const QStringList& searchPath/* = QStringList()*/) const;
166
176 bool initialize();
177
184 void finalize();
185
190 bool isFinalized() const;
191
203 Script* script() const;
204
205 public Q_SLOTS:
206
210 QString name() const;
211
216 int version() const;
217
221 QString description() const;
222
226 void setDescription(const QString& description);
227
231 QString iconName() const;
232
236 void setIconName(const QString& iconname);
237
241 bool isEnabled() const;
242
246 void setEnabled(bool enabled);
247
251 QString file() const;
252
256 bool setFile(const QString& scriptfile);
257
261 QByteArray code() const;
262
266 void setCode(const QByteArray& code);
267
272 QString interpreter() const;
273
277 void setInterpreter(const QString& interpretername);
278
283 QString currentPath() const;
284
289 void addQObject(QObject* obj, const QString &name = QString());
290
294 QObject* qobject(const QString &name) const;
295
299 QStringList qobjectNames() const;
300
306 QVariantMap options() const;
307
313 QVariant option(const QString& name, const QVariant& defaultvalue = QVariant());
314
318 bool setOption(const QString& name, const QVariant& value);
319
323 QStringList functionNames();
324
331 QVariant callFunction(const QString& name, const QVariantList& args = QVariantList());
332
349 QVariant evaluate(const QByteArray& code);
350
351 Q_SIGNALS:
352
359 void updated();
360
362 void dataChanged(Action*);
363
367 void started(Kross::Action*);
368
372 void finished(Kross::Action*);
373
377 void finalized(Kross::Action*);
378
379 private Q_SLOTS:
380
386 void slotTriggered();
387
388 private:
390 class Private;
392 Private* const d;
393 };
394
395}
396
397Q_DECLARE_METATYPE(Kross::Action*)
398
399#endif
400
childreninterface.h
Kross::Action
The Action class is an abstract container to deal with scripts like a single standalone script file.
Definition action.h:99
Kross::Action::setOption
bool setOption(const QString &name, const QVariant &value)
Set the Interpreter::Option value.
Definition action.cpp:409
Kross::Action::setDescription
void setDescription(const QString &description)
Set the optional description for this Action.
Definition action.cpp:286
Kross::Action::options
QVariantMap options() const
Definition action.cpp:381
Kross::Action::name
QString name() const
Kross::Action::description
QString description() const
Definition action.cpp:281
Kross::Action::fromDomElement
void fromDomElement(const QDomElement &element)
Method to read settings from the QDomElement element that contains details about e....
Definition action.cpp:153
Kross::Action::version
int version() const
Definition action.cpp:276
Kross::Action::started
void started(Kross::Action *)
This signal is emitted before the script got executed.
Kross::Action::currentPath
QString currentPath() const
Definition action.cpp:376
Kross::Action::callFunction
QVariant callFunction(const QString &name, const QVariantList &args=QVariantList())
Call a function in the script.
Definition action.cpp:430
Kross::Action::isFinalized
bool isFinalized() const
Definition action.cpp:504
Kross::Action::setInterpreter
void setInterpreter(const QString &interpretername)
Set the name of the interpreter (javascript, python or ruby).
Definition action.cpp:338
Kross::Action::setCode
void setCode(const QByteArray &code)
Set the scriptcode code this Action should execute.
Definition action.cpp:323
Kross::Action::qobjectNames
QStringList qobjectNames() const
Definition action.cpp:396
Kross::Action::finished
void finished(Kross::Action *)
This signal is emitted after the script got executed.
Kross::Action::addQObject
void addQObject(QObject *obj, const QString &name=QString())
Add a QObject instance to the action.
Definition action.cpp:386
Kross::Action::initialize
bool initialize()
Initialize the Script instance.
Definition action.cpp:448
Kross::Action::setEnabled
void setEnabled(bool enabled)
Set the enable state of this Action to enabled .
Definition action.cpp:311
Kross::Action::evaluate
QVariant evaluate(const QByteArray &code)
Evaluate some scripting code.
Definition action.cpp:439
Kross::Action::Action
Action(QObject *parent, const QString &name, const QDir &packagepath=QDir())
Constructor.
Definition action.cpp:115
Kross::Action::interpreter
QString interpreter() const
Definition action.cpp:333
Kross::Action::isEnabled
bool isEnabled() const
Return true if this Action is enabled else false is returned.
Definition action.cpp:306
Kross::Action::finalized
void finalized(Kross::Action *)
This signal is emitted once a script finalized.
Kross::Action::dataChanged
void dataChanged(Action *)
This signal is emitted when the data of the Action is changed.
Kross::Action::toDomElement
QDomElement toDomElement() const
Definition action.cpp:212
Kross::Action::iconName
QString iconName() const
Return the name of the icon.
Definition action.cpp:293
Kross::Action::script
Script * script() const
Definition action.cpp:266
Kross::Action::setFile
bool setFile(const QString &scriptfile)
Set the script file that should be executed.
Definition action.cpp:356
Kross::Action::qobject
QObject * qobject(const QString &name) const
Definition action.cpp:391
Kross::Action::functionNames
QStringList functionNames()
Definition action.cpp:421
Kross::Action::code
QByteArray code() const
Definition action.cpp:318
Kross::Action::option
QVariant option(const QString &name, const QVariant &defaultvalue=QVariant())
Definition action.cpp:401
Kross::Action::file
QString file() const
Definition action.cpp:351
Kross::Action::setIconName
void setIconName(const QString &iconname)
Set the name of the icon to iconname .
Definition action.cpp:298
Kross::Action::finalize
void finalize()
Finalize the Script instance and frees any cached or still running executions.
Definition action.cpp:496
Kross::Action::updated
void updated()
This signal is emitted if the content of the Action was changed.
Kross::ChildrenInterface
Interface for managing Object collections.
Definition childreninterface.h:39
Kross::ErrorInterface::ErrorInterface
ErrorInterface()
Constructor.
Definition errorinterface.h:43
Kross::Script
Base class for interpreter dependent functionality each script provides.
Definition core/script.h:44
QAction
QObject
QScriptable
QUrl
errorinterface.h
Kross
Definition action.cpp:36
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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