From 01852fb8e233ba797e9e35fd79840e58209843f3 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Mon, 1 Feb 2010 17:53:29 +0000 Subject: [PATCH] debug is actually supposed to be in the global context, along with print; this is how it is in trunk svn path=/branches/KDE/4.4/kdebase/runtime/; revision=1083638 --- .../javascript/simplebindings/appletinterface.cpp | 5 ----- .../javascript/simplebindings/appletinterface.h | 1 - scriptengines/javascript/simplejavascriptapplet.cpp | 12 ++++++++++++ scriptengines/javascript/simplejavascriptapplet.h | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scriptengines/javascript/simplebindings/appletinterface.cpp b/scriptengines/javascript/simplebindings/appletinterface.cpp index 3fcbd1e51..01a8e4c1e 100644 --- a/scriptengines/javascript/simplebindings/appletinterface.cpp +++ b/scriptengines/javascript/simplebindings/appletinterface.cpp @@ -343,11 +343,6 @@ bool AppletInterface::hasExtension(const QString &extension) const return m_appletScriptEngine->loadedExtensions().contains(extension.toLower()); } -void AppletInterface::debug(const QString &msg) -{ - kDebug() << msg; -} - QObject *AppletInterface::findChild(const QString &name) const { if (name.isEmpty()) { diff --git a/scriptengines/javascript/simplebindings/appletinterface.h b/scriptengines/javascript/simplebindings/appletinterface.h index 4c09e2014..3dfd8d4b2 100644 --- a/scriptengines/javascript/simplebindings/appletinterface.h +++ b/scriptengines/javascript/simplebindings/appletinterface.h @@ -241,7 +241,6 @@ enum AnimationDirection { Q_INVOKABLE bool include(const QString &script); Q_INVOKABLE bool hasExtension(const QString &extension) const; - Q_INVOKABLE void debug(const QString &msg); Q_INVOKABLE QObject *findChild(const QString &name) const; Q_INVOKABLE Plasma::Extender *extender() const; diff --git a/scriptengines/javascript/simplejavascriptapplet.cpp b/scriptengines/javascript/simplejavascriptapplet.cpp index 483d95dbe..fec06e231 100644 --- a/scriptengines/javascript/simplejavascriptapplet.cpp +++ b/scriptengines/javascript/simplejavascriptapplet.cpp @@ -569,6 +569,8 @@ void SimpleJavaScriptApplet::setupObjects() fun = m_engine->newFunction(SimpleJavaScriptApplet::print); global.setProperty("print", fun); + fun = m_engine->newFunction(SimpleJavaScriptApplet::debug); + global.setProperty("print", debug); // Work around bug in 4.3.0 qMetaTypeId(); @@ -905,6 +907,16 @@ QScriptValue SimpleJavaScriptApplet::print(QScriptContext *context, QScriptEngin return engine->undefinedValue(); } +QScriptValue SimpleJavaScriptApplet::debug(QScriptContext *context, QScriptEngine *engine) +{ + if (context->argumentCount() < 1) { + return engine->undefinedValue(); + } + + kDebug() << context->argument(0).toString(); + return engine->undefinedValue(); +} + void SimpleJavaScriptApplet::collectGarbage() { m_engine->collectGarbage(); diff --git a/scriptengines/javascript/simplejavascriptapplet.h b/scriptengines/javascript/simplejavascriptapplet.h index 06a7a9477..2871dd448 100644 --- a/scriptengines/javascript/simplejavascriptapplet.h +++ b/scriptengines/javascript/simplejavascriptapplet.h @@ -97,6 +97,7 @@ private: static QScriptValue createWidget(QScriptContext *context, QScriptEngine *engine); static QScriptValue notSupported(QScriptContext *context, QScriptEngine *engine); static QScriptValue print(QScriptContext *context, QScriptEngine *engine); + static QScriptValue debug(QScriptContext *context, QScriptEngine *engine); static QScriptValue widgetAdjustSize(QScriptContext *context, QScriptEngine *engine); // run extension