From 88496997f9594b586ad25ca2a0704a4791512340 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Thu, 7 Jan 2010 02:26:44 +0000 Subject: [PATCH] moderately lame way to get conditional compilation of GUI features svn path=/trunk/KDE/kdebase/runtime/; revision=1070943 --- scriptengines/javascript/CMakeLists.txt | 5 +++-- scriptengines/javascript/scriptenv.cpp | 6 ++++-- scriptengines/javascript/scriptenvui.cpp | 21 +++++++++++++++++++ .../javascript/simplejavascriptapplet.cpp | 1 - 4 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 scriptengines/javascript/scriptenvui.cpp diff --git a/scriptengines/javascript/CMakeLists.txt b/scriptengines/javascript/CMakeLists.txt index 249c24cf9..1ac223faf 100644 --- a/scriptengines/javascript/CMakeLists.txt +++ b/scriptengines/javascript/CMakeLists.txt @@ -2,7 +2,7 @@ set(simple_javascript_engine_SRCS appletauthorization.cpp - scriptenv.cpp + scriptenvui.cpp simplejavascriptapplet.cpp simplebindings/animationgroup.cpp simplebindings/appletinterface.cpp @@ -31,7 +31,6 @@ set(simple_javascript_engine_SRCS include_directories(${PHONON_INCLUDES}) - kde4_add_plugin(plasma_appletscript_simple_javascript ${simple_javascript_engine_SRCS}) target_link_libraries(plasma_appletscript_simple_javascript @@ -70,6 +69,7 @@ install(FILES plasma-scriptengine-runner-javascript.desktop DESTINATION ${SERVIC set(javascript_dataengine_engine_SRCS javascriptdataengine.cpp + scriptenv.cpp simplebindings/dataengine.cpp simplebindings/variant.cpp ) @@ -77,6 +77,7 @@ kde4_add_plugin(plasma_dataenginescript_javascript ${javascript_dataengine_engin target_link_libraries(plasma_dataenginescript_javascript ${KDE4_KDECORE_LIBS} + ${KDE4_KIO_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTSCRIPT_LIBRARY}) diff --git a/scriptengines/javascript/scriptenv.cpp b/scriptengines/javascript/scriptenv.cpp index f971e5fe6..770cb3d5c 100644 --- a/scriptengines/javascript/scriptenv.cpp +++ b/scriptengines/javascript/scriptenv.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -34,8 +33,9 @@ #include #include -#include "simplejavascriptapplet.h" +#ifdef USEGUI #include "simplebindings/filedialogproxy.h" +#endif ScriptEnv::ScriptEnv(QObject *parent) : QScriptEngine(parent), @@ -187,8 +187,10 @@ bool ScriptEnv::importBuiltinExtension(const QString &extension, QScriptValue &o { kDebug() << extension; if ("filedialog" == extension) { +#ifdef USEGUI FileDialogProxy::registerWithRuntime(this); return true; +#endif } else if ("launchapp" == extension) { obj.setProperty("runApplication", newFunction(ScriptEnv::runApplication)); obj.setProperty("runCommand", newFunction(ScriptEnv::runCommand)); diff --git a/scriptengines/javascript/scriptenvui.cpp b/scriptengines/javascript/scriptenvui.cpp new file mode 100644 index 000000000..7463b18c1 --- /dev/null +++ b/scriptengines/javascript/scriptenvui.cpp @@ -0,0 +1,21 @@ +/* + * Copyright 2010 Aaron J. Seigo + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License version 2 as + * published by the Free Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#define USEGUI +#include "scriptenv.cpp" + diff --git a/scriptengines/javascript/simplejavascriptapplet.cpp b/scriptengines/javascript/simplejavascriptapplet.cpp index 908125b25..a5ab5bea2 100644 --- a/scriptengines/javascript/simplejavascriptapplet.cpp +++ b/scriptengines/javascript/simplejavascriptapplet.cpp @@ -58,7 +58,6 @@ using namespace Plasma; - Q_DECLARE_METATYPE(QPainter*) Q_DECLARE_METATYPE(QStyleOptionGraphicsItem*)