lib

scriptguiclient.h
1/***************************************************************************
2 * scriptguiclient.h
3 * This file is part of the KDE project
4 * copyright (C) 2005 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_API_SCRIPTGUICLIENT_H
21#define KROSS_API_SCRIPTGUICLIENT_H
22
23#include "scriptcontainer.h"
24#include "scriptaction.h"
25
26#include <tqobject.h>
27#include <tqdom.h>
28#include <kurl.h>
29#include <kxmlguiclient.h>
30
31class TQWdiget;
32
33namespace Kross { namespace Api {
34
35 // Forward declarations.
36 class ScriptAction;
37 class ScriptGUIClientPrivate;
38
43 class TDE_EXPORT ScriptGUIClient
44 : public TQObject
45 , public KXMLGUIClient
46 {
47 TQ_OBJECT
48
49 //TQ_PROPERTY(TQString configfile READ getConfigFile WRITE setConfigFile)
50
51 public:
52
54 typedef TQPtrList<TDEAction> List;
55
66 explicit ScriptGUIClient(KXMLGUIClient* guiclient, TQWidget* parent = 0);
67
71 virtual ~ScriptGUIClient();
72
77 bool hasActionCollection(const TQString& name);
78
83 ScriptActionCollection* getActionCollection(const TQString& name);
84
92 TQMap<TQString, ScriptActionCollection*> getActionCollections();
93
98 void addActionCollection(const TQString& name, ScriptActionCollection* collection);
99
103 bool removeActionCollection(const TQString& name);
104
109
115 bool installScriptPackage(const TQString& scriptpackagefile);
116
122 bool uninstallScriptPackage(const TQString& scriptpackagepath);
123
129 bool loadScriptConfigFile(const TQString& scriptconfigfile);
130
136 bool loadScriptConfigDocument(const TQString& scriptconfigfile, const TQDomDocument &document);
137
139 virtual void setXMLFile(const TQString& file, bool merge = false, bool setXMLDoc = true);
141 virtual void setDOMDocument(const TQDomDocument &document, bool merge = false);
142
143 public slots:
144
149 KURL openScriptFile(const TQString& caption = TQString());
150
157 bool loadScriptFile();
158
165 bool executeScriptFile();
166
172 bool executeScriptFile(const TQString& file);
173
180
185 void showScriptManager();
186
187 private slots:
188
193 void executionFailed(const TQString& errormessage, const TQString& tracedetails);
194
201 void successfullyExecuted();
202
203 signals:
210 private:
212 ScriptGUIClientPrivate* d;
213 };
214
215}}
216
217#endif
218
TDEAction * action(const char *name) const
A collection to store ScriptAction shared pointers.
A ScriptAction extends a TDEAction by providing a wrapper around a ScriptContainer to execute scripti...
TDESharedPtr< ScriptAction > Ptr
The name of the interpreter used to execute the scripting code.
void executionFinished(const Kross::Api::ScriptAction *)
This signal is emited when the execution of a script is finished.
virtual void setDOMDocument(const TQDomDocument &document, bool merge=false)
KXMLGUIClient overloaded method to set the XML DOM-document.
bool removeActionCollection(const TQString &name)
Remove the ScriptActionCollection defined with name name.
bool executeScriptFile()
A KFileDialog will be displayed to let the user choose the scriptfile that should be executed.
bool loadScriptConfigFile(const TQString &scriptconfigfile)
Load the scriptpackage's configurationfile scriptconfigfile and add the defined ScriptAction instance...
bool uninstallScriptPackage(const TQString &scriptpackagepath)
Uninstall the scriptpackage located in the path scriptpackagepath .
KURL openScriptFile(const TQString &caption=TQString())
A KFileDialog will be displayed to let the user choose a scriptfile.
ScriptActionCollection * getActionCollection(const TQString &name)
void reloadInstalledScripts()
Reload the list of installed scripts.
bool loadScriptConfigDocument(const TQString &scriptconfigfile, const TQDomDocument &document)
Load the document DOM-document from the scriptpackage's XML-configfile scriptconfigfile and add the d...
bool hasActionCollection(const TQString &name)
void collectionChanged(ScriptActionCollection *)
Emitted if a ScriptActionCollection instances changed.
void showScriptManager()
The ScriptManagerGUI dialog will be displayed to let the user manage the scriptfiles.
TQMap< TQString, ScriptActionCollection * > getActionCollections()
bool installScriptPackage(const TQString &scriptpackagefile)
Install the packagefile scriptpackagefile .
void addActionCollection(const TQString &name, ScriptActionCollection *collection)
Add a new ScriptActionCollection with the name name to our map of actioncollections.
bool loadScriptFile()
A KFileDialog will be displayed to let the user choose a scriptfile that should be loaded.
ScriptGUIClient(KXMLGUIClient *guiclient, TQWidget *parent=0)
Constructor.
TQPtrList< TDEAction > List
List of TDEAction instances.
bool executeScriptAction(ScriptAction::Ptr action)
This method executes the ScriptAction action .
void executionStarted(const Kross::Api::ScriptAction *)
This signal is emited when the execution of a script is started.
virtual void setXMLFile(const TQString &file, bool merge=false, bool setXMLDoc=true)
KXMLGUIClient overloaded method to set the XML file.
The common Kross API used as common codebase.
Definition callable.h:31
The Kross scripting bridge to embed scripting functionality into an application.
Definition callable.h:31