lib

scriptguiclient.h

00001 /***************************************************************************
00002  * scriptguiclient.h
00003  * This file is part of the KDE project
00004  * copyright (C) 2005 by Sebastian Sauer (mail@dipe.org)
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this program; see the file COPYING.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  ***************************************************************************/
00019 
00020 #ifndef KROSS_API_SCRIPTGUICLIENT_H
00021 #define KROSS_API_SCRIPTGUICLIENT_H
00022 
00023 #include "scriptcontainer.h"
00024 #include "scriptaction.h"
00025 
00026 #include <qobject.h>
00027 #include <qdom.h>
00028 #include <kurl.h>
00029 #include <kxmlguiclient.h>
00030 
00031 class QWdiget;
00032 
00033 namespace Kross { namespace Api {
00034 
00035     // Forward declarations.
00036     class ScriptAction;
00037     class ScriptGUIClientPrivate;
00038 
00043     class KDE_EXPORT ScriptGUIClient
00044         : public QObject
00045         , public KXMLGUIClient
00046     {
00047             Q_OBJECT
00048             //Q_PROPERTY(QString configfile READ getConfigFile WRITE setConfigFile)
00049 
00050         public:
00051 
00053             typedef QPtrList<KAction> List;
00054 
00065             explicit ScriptGUIClient(KXMLGUIClient* guiclient, QWidget* parent = 0);
00066 
00070             virtual ~ScriptGUIClient();
00071 
00076             bool hasActionCollection(const QString& name);
00077 
00082             ScriptActionCollection* getActionCollection(const QString& name);
00083 
00091             QMap<QString, ScriptActionCollection*> getActionCollections();
00092 
00097             void addActionCollection(const QString& name, ScriptActionCollection* collection);
00098 
00102             bool removeActionCollection(const QString& name);
00103 
00107             void reloadInstalledScripts();
00108 
00114             bool installScriptPackage(const QString& scriptpackagefile);
00115 
00121             bool uninstallScriptPackage(const QString& scriptpackagepath);
00122 
00128             bool loadScriptConfigFile(const QString& scriptconfigfile);
00129 
00135             bool loadScriptConfigDocument(const QString& scriptconfigfile, const QDomDocument &document);
00136 
00138             virtual void setXMLFile(const QString& file, bool merge = false, bool setXMLDoc = true);
00140             virtual void setDOMDocument(const QDomDocument &document, bool merge = false);
00141 
00142         public slots:
00143 
00148             KURL openScriptFile(const QString& caption = QString::null);
00149 
00156             bool loadScriptFile();
00157 
00164             bool executeScriptFile();
00165 
00171             bool executeScriptFile(const QString& file);
00172 
00178             bool executeScriptAction(ScriptAction::Ptr action);
00179 
00184             void showScriptManager();
00185 
00186         private slots:
00187 
00192             void executionFailed(const QString& errormessage, const QString& tracedetails);
00193 
00200             void successfullyExecuted();
00201 
00202         signals:
00204             void collectionChanged(ScriptActionCollection*);
00206             void executionStarted(const Kross::Api::ScriptAction* );
00208             void executionFinished(const Kross::Api::ScriptAction* );
00209         private:
00211             ScriptGUIClientPrivate* d;
00212     };
00213 
00214 }}
00215 
00216 #endif
00217 
KDE Home | KDE Accessibility Home | Description of Access Keys