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

Plasma

runnerscript.cpp

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2007 by Aaron Seigo <aseigo@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License as
00006  *   published by the Free Software Foundation; either version 2, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program 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
00012  *   GNU General Public License for more details
00013  *
00014  *   You should have received a copy of the GNU Library General Public
00015  *   License along with this program; if not, write to the
00016  *   Free Software Foundation, Inc.,
00017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 
00020 #include "plasma/scripting/runnerscript.h"
00021 
00022 #include "plasma/abstractrunner.h"
00023 #include "plasma/dataenginemanager.h"
00024 #include "plasma/package.h"
00025 #include "plasma/private/abstractrunner_p.h"
00026 
00027 namespace Plasma
00028 {
00029 
00030 class RunnerScriptPrivate
00031 {
00032 public:
00033     AbstractRunner *runner;
00034 };
00035 
00036 RunnerScript::RunnerScript(QObject *parent)
00037     : ScriptEngine(parent),
00038       d(new RunnerScriptPrivate)
00039 {
00040 }
00041 
00042 RunnerScript::~RunnerScript()
00043 {
00044     delete d;
00045 }
00046 
00047 void RunnerScript::setRunner(AbstractRunner *runner)
00048 {
00049     d->runner = runner;
00050     connect(runner, SIGNAL(prepare()), this, SIGNAL(prepare()));
00051     connect(runner, SIGNAL(teardown()), this, SIGNAL(teardown()));
00052 }
00053 
00054 AbstractRunner *RunnerScript::runner() const
00055 {
00056     return d->runner;
00057 }
00058 
00059 void RunnerScript::match(Plasma::RunnerContext &search)
00060 {
00061     Q_UNUSED(search);
00062 }
00063 
00064 void RunnerScript::run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action)
00065 {
00066     Q_UNUSED(search);
00067     Q_UNUSED(action);
00068 }
00069 
00070 DataEngine *RunnerScript::dataEngine(const QString &name)
00071 {
00072     if (d->runner) {
00073         return d->runner->dataEngine(name);
00074     }
00075 
00076     return DataEngineManager::self()->engine(QString());
00077 }
00078 
00079 KConfigGroup RunnerScript::config() const
00080 {
00081     if (d->runner) {
00082         return d->runner->config();
00083     }
00084     return KConfigGroup();
00085 }
00086 
00087 void RunnerScript::setIgnoredTypes(RunnerContext::Types types)
00088 {
00089     if (d->runner) {
00090         d->runner->setIgnoredTypes(types);
00091     }
00092 }
00093 
00094 void RunnerScript::setHasRunOptions(bool hasRunOptions)
00095 {
00096     if (d->runner) {
00097         d->runner->setHasRunOptions(hasRunOptions);
00098     }
00099 }
00100 
00101 void RunnerScript::setSpeed(AbstractRunner::Speed newSpeed)
00102 {
00103     if (d->runner) {
00104         d->runner->setSpeed(newSpeed);
00105     }
00106 }
00107 
00108 void RunnerScript::setPriority(AbstractRunner::Priority newPriority)
00109 {
00110     if (d->runner) {
00111         d->runner->setPriority(newPriority);
00112     }
00113 }
00114 
00115 KService::List RunnerScript::serviceQuery(const QString &serviceType,
00116                                           const QString &constraint) const
00117 {
00118     if (d->runner) {
00119         return d->runner->serviceQuery(serviceType, constraint);
00120     }
00121     return KService::List();
00122 }
00123 
00124 QAction* RunnerScript::addAction(const QString &id, const QIcon &icon, const QString &text)
00125 {
00126     if (d->runner) {
00127         return d->runner->addAction(id, icon, text);
00128     }
00129     return 0;
00130 }
00131 
00132 void RunnerScript::addAction(const QString &id, QAction *action)
00133 {
00134     if (d->runner) {
00135         d->runner->addAction(id, action);
00136     }
00137 }
00138 
00139 void RunnerScript::removeAction(const QString &id)
00140 {
00141     if (d->runner) {
00142         d->runner->removeAction(id);
00143     }
00144 }
00145 
00146 QAction* RunnerScript::action(const QString &id) const
00147 {
00148     if (d->runner) {
00149         return d->runner->action(id);
00150     }
00151     return 0;
00152 }
00153 
00154 QHash<QString, QAction*> RunnerScript::actions() const
00155 {
00156     if (d->runner) {
00157         return d->runner->actions();
00158     }
00159     return QHash<QString, QAction*>();
00160 }
00161 
00162 void RunnerScript::clearActions()
00163 {
00164     if (d->runner) {
00165         d->runner->clearActions();
00166     }
00167 }
00168 
00169 void RunnerScript::addSyntax(const RunnerSyntax &syntax)
00170 {
00171     if (d->runner) {
00172         d->runner->addSyntax(syntax);
00173     }
00174 }
00175 
00176 void RunnerScript::setSyntaxes(const QList<RunnerSyntax> &syns)
00177 {
00178     if (d->runner) {
00179         d->runner->setSyntaxes(syns);
00180     }
00181 }
00182 
00183 const Package *RunnerScript::package() const
00184 {
00185     return d->runner ? d->runner->package() : 0;
00186 }
00187 
00188 KPluginInfo RunnerScript::description() const
00189 {
00190     return d->runner ? d->runner->d->runnerDescription : KPluginInfo();
00191 }
00192 
00193 QString RunnerScript::mainScript() const
00194 {
00195     if (!package()) {
00196         return QString();
00197     } else {
00198         return package()->filePath("mainscript");
00199     }
00200 }
00201 
00202 } // Plasma namespace
00203 
00204 #include "runnerscript.moc"

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • 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
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal