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

Plasma

  • plasma
  • scripting
runnerscript.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2007 by Aaron Seigo <aseigo@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #include "plasma/scripting/runnerscript.h"
21 
22 #include "plasma/abstractrunner.h"
23 #include "plasma/dataenginemanager.h"
24 #include "plasma/package.h"
25 #include "plasma/private/abstractrunner_p.h"
26 
27 namespace Plasma
28 {
29 
30 class RunnerScriptPrivate
31 {
32 public:
33  AbstractRunner *runner;
34 };
35 
36 RunnerScript::RunnerScript(QObject *parent)
37  : ScriptEngine(parent),
38  d(new RunnerScriptPrivate)
39 {
40 }
41 
42 RunnerScript::~RunnerScript()
43 {
44  delete d;
45 }
46 
47 void RunnerScript::setRunner(AbstractRunner *runner)
48 {
49  d->runner = runner;
50  connect(runner, SIGNAL(prepare()), this, SIGNAL(prepare()));
51  connect(runner, SIGNAL(teardown()), this, SIGNAL(teardown()));
52 }
53 
54 AbstractRunner *RunnerScript::runner() const
55 {
56  return d->runner;
57 }
58 
59 void RunnerScript::match(Plasma::RunnerContext &search)
60 {
61  Q_UNUSED(search);
62 }
63 
64 void RunnerScript::run(const Plasma::RunnerContext &search, const Plasma::QueryMatch &action)
65 {
66  Q_UNUSED(search);
67  Q_UNUSED(action);
68 }
69 
70 DataEngine *RunnerScript::dataEngine(const QString &name)
71 {
72  if (d->runner) {
73  return d->runner->dataEngine(name);
74  }
75 
76  return DataEngineManager::self()->engine(QString());
77 }
78 
79 KConfigGroup RunnerScript::config() const
80 {
81  if (d->runner) {
82  return d->runner->config();
83  }
84  return KConfigGroup();
85 }
86 
87 void RunnerScript::setIgnoredTypes(RunnerContext::Types types)
88 {
89  if (d->runner) {
90  d->runner->setIgnoredTypes(types);
91  }
92 }
93 
94 void RunnerScript::setHasRunOptions(bool hasRunOptions)
95 {
96  if (d->runner) {
97  d->runner->setHasRunOptions(hasRunOptions);
98  }
99 }
100 
101 void RunnerScript::setSpeed(AbstractRunner::Speed newSpeed)
102 {
103  if (d->runner) {
104  d->runner->setSpeed(newSpeed);
105  }
106 }
107 
108 void RunnerScript::setPriority(AbstractRunner::Priority newPriority)
109 {
110  if (d->runner) {
111  d->runner->setPriority(newPriority);
112  }
113 }
114 
115 KService::List RunnerScript::serviceQuery(const QString &serviceType,
116  const QString &constraint) const
117 {
118  if (d->runner) {
119  return d->runner->serviceQuery(serviceType, constraint);
120  }
121  return KService::List();
122 }
123 
124 QAction* RunnerScript::addAction(const QString &id, const QIcon &icon, const QString &text)
125 {
126  if (d->runner) {
127  return d->runner->addAction(id, icon, text);
128  }
129  return 0;
130 }
131 
132 void RunnerScript::addAction(const QString &id, QAction *action)
133 {
134  if (d->runner) {
135  d->runner->addAction(id, action);
136  }
137 }
138 
139 void RunnerScript::removeAction(const QString &id)
140 {
141  if (d->runner) {
142  d->runner->removeAction(id);
143  }
144 }
145 
146 QAction* RunnerScript::action(const QString &id) const
147 {
148  if (d->runner) {
149  return d->runner->action(id);
150  }
151  return 0;
152 }
153 
154 QHash<QString, QAction*> RunnerScript::actions() const
155 {
156  if (d->runner) {
157  return d->runner->actions();
158  }
159  return QHash<QString, QAction*>();
160 }
161 
162 void RunnerScript::clearActions()
163 {
164  if (d->runner) {
165  d->runner->clearActions();
166  }
167 }
168 
169 void RunnerScript::addSyntax(const RunnerSyntax &syntax)
170 {
171  if (d->runner) {
172  d->runner->addSyntax(syntax);
173  }
174 }
175 
176 void RunnerScript::setSyntaxes(const QList<RunnerSyntax> &syns)
177 {
178  if (d->runner) {
179  d->runner->setSyntaxes(syns);
180  }
181 }
182 
183 const Package *RunnerScript::package() const
184 {
185  return d->runner ? d->runner->package() : 0;
186 }
187 
188 KPluginInfo RunnerScript::description() const
189 {
190  return d->runner ? d->runner->d->runnerDescription : KPluginInfo();
191 }
192 
193 QString RunnerScript::mainScript() const
194 {
195  if (!package()) {
196  return QString();
197  } else {
198  return package()->filePath("mainscript");
199  }
200 }
201 
202 } // Plasma namespace
203 
204 #include "runnerscript.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat May 18 2013 11:37:53 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

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

kdelibs-4.10.3 API Reference

Skip menu "kdelibs-4.10.3 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