From e054fbb8aaf374acaf9a1737409caf50a1ab4f80 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 20 Oct 2010 19:40:30 +0000 Subject: [PATCH] don't register print() in the declarative bindings: t' already there svn path=/trunk/KDE/kdebase/runtime/; revision=1187930 --- scriptengines/javascript/CMakeLists.txt | 4 ++-- .../common/declarativescriptenv.cpp | 23 +++++++++++++++++++ .../{scriptenvui.cpp => jsscriptenv.cpp} | 0 scriptengines/javascript/common/scriptenv.cpp | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 scriptengines/javascript/common/declarativescriptenv.cpp rename scriptengines/javascript/common/{scriptenvui.cpp => jsscriptenv.cpp} (100%) diff --git a/scriptengines/javascript/CMakeLists.txt b/scriptengines/javascript/CMakeLists.txt index 09a6ebe95..976fb6cea 100644 --- a/scriptengines/javascript/CMakeLists.txt +++ b/scriptengines/javascript/CMakeLists.txt @@ -2,7 +2,7 @@ set(simple_javascript_engine_SRCS common/javascriptaddonpackagestructure.cpp - common/scriptenvui.cpp + common/jsscriptenv.cpp plasmoid/abstractjsappletscript.cpp plasmoid/appletauthorization.cpp plasmoid/jsappletinterface.cpp @@ -113,7 +113,7 @@ install(FILES data/plasma-javascriptaddon.desktop DESTINATION ${SERVICETYPES_INS #DECLARATIVE APPLET set(declarative_appletscript_SRCS common/javascriptaddonpackagestructure.cpp - common/scriptenvui.cpp + common/declarativescriptenv.cpp plasmoid/abstractjsappletscript.cpp plasmoid/appletauthorization.cpp plasmoid/appletinterface.cpp diff --git a/scriptengines/javascript/common/declarativescriptenv.cpp b/scriptengines/javascript/common/declarativescriptenv.cpp new file mode 100644 index 000000000..ac08bd29c --- /dev/null +++ b/scriptengines/javascript/common/declarativescriptenv.cpp @@ -0,0 +1,23 @@ +/* + * 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 +#define DECLARATIVE +#include "scriptenv.cpp" +#include "scriptenv.moc" + diff --git a/scriptengines/javascript/common/scriptenvui.cpp b/scriptengines/javascript/common/jsscriptenv.cpp similarity index 100% rename from scriptengines/javascript/common/scriptenvui.cpp rename to scriptengines/javascript/common/jsscriptenv.cpp diff --git a/scriptengines/javascript/common/scriptenv.cpp b/scriptengines/javascript/common/scriptenv.cpp index 518cf2536..09d360809 100644 --- a/scriptengines/javascript/common/scriptenv.cpp +++ b/scriptengines/javascript/common/scriptenv.cpp @@ -70,7 +70,9 @@ void ScriptEnv::setupGlobalObject() QScriptValue::ReadOnly|QScriptValue::Undeletable|QScriptValue::SkipInEnumeration); // Add utility functions +#ifndef DECLARATIVE global.setProperty("print", m_engine->newFunction(ScriptEnv::print)); +#endif global.setProperty("debug", m_engine->newFunction(ScriptEnv::debug)); }