scriptmanager.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001 Ian Reinhart Geiser  (geiseri@kde.org)
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, USA.
00018 */
00019 #ifndef __scriptmanager_h__
00020 #define __scriptmanager_h__
00021 
00022 #include <qvariant.h>
00023 #include <scriptclientinterface.h>
00024 #include <scriptinterface.h>
00025 #include <qdict.h>
00026 #include <qobject.h>
00027 
00028 #include <kdelibs_export.h>
00029 
00030 class ScriptInfo;
00031 //namespace KScriptInterface
00032 //{
00033 
00039     class KDE_EXPORT KScriptManager : public QObject, public KScriptClientInterface
00040     {
00041     Q_OBJECT
00042     friend class KScriptInterface;
00043     public:
00047         KScriptManager(QObject *parent, const char *name);
00051         virtual ~KScriptManager();
00057         bool addScript( const QString &scriptDesktopFile);
00062         bool removeScript( const QString &scriptName );
00067         QStringList scripts();
00071         void clear();
00076         void error( const QString &msg ) {emit scriptError(msg);}
00081         void warning( const QString &msg ) {emit scriptWarning(msg);}
00086         void output( const QString &msg ) {emit scriptOutput(msg);}
00093         void progress( int percent ) {emit scriptProgress(percent);}
00099         void done( KScriptClientInterface::Result result, const QVariant &returned )  {emit scriptDone(result, returned);}
00100 
00101     public slots:
00105         void runScript( const QString &scriptName, QObject *context = 0, const QVariant &arg = 0 );
00106     signals:
00111         void scriptError( const QString &msg );
00116         void scriptWarning( const QString &msg );
00121         void scriptOutput( const QString &msg );
00126         void scriptProgress( int percent);
00131         void scriptDone( KScriptClientInterface::Result result, const QVariant &returned);
00132     protected:
00133         QDict<ScriptInfo> m_scripts;
00134         QDict<KScriptInterface> m_scriptCache;
00135         //QStringList m_scriptNames;
00136         QString m_currentScript;
00137     };
00138 //};
00139 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys