add more spacing
[personal-kdebase.git] / workspace / plasma / scriptengines / javascript / javascriptrunner.h
blob7370ba6caf87a498f85a339f4cbe3bff2a7d7d22
1 // -*- c++ -*-
3 /*
4 * Copyright 2008 Richard J. Moore <rich@kde.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Library General Public License version 2 as
8 * published by the Free Software Foundation
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
13 * GNU General Public License for more details
15 * You should have received a copy of the GNU Library General Public
16 * License along with this program; if not, write to the
17 * Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef RUNNERSCRIPTQSCRIPT_H
22 #define RUNNERSCRIPTQSCRIPT_H
24 #include <QScriptValue>
26 #include <Plasma/RunnerScript>
28 class QScriptEngine;
30 class JavaScriptRunner : public Plasma::RunnerScript
32 Q_OBJECT
34 public:
35 JavaScriptRunner(QObject *parent, const QVariantList &args);
36 ~JavaScriptRunner();
38 bool init();
40 /** Reimplemented to add Q_INVOKABLE. */
41 Q_INVOKABLE Plasma::AbstractRunner* runner() const;
43 /** Reimplemented to forward to script. */
44 void match(Plasma::RunnerContext *search);
46 /** Reimplemented to forward to script. */
47 void exec(const Plasma::RunnerContext *search, const Plasma::QueryMatch *action);
49 protected:
50 void setupObjects();
51 void importExtensions();
52 void reportError();
54 private:
55 QScriptEngine *m_engine;
56 QScriptValue m_self;
59 K_EXPORT_PLASMA_RUNNERSCRIPTENGINE(qscriptrunner, JavaScriptRunner)
61 #endif // RUNNERSCRIPTQSCRIPT_H