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
This commit is contained in:
Aaron J. Seigo 2010-02-01 17:53:29 +00:00
parent 7f24495652
commit 01852fb8e2
4 changed files with 13 additions and 6 deletions

View File

@ -343,11 +343,6 @@ bool AppletInterface::hasExtension(const QString &extension) const
return m_appletScriptEngine->loadedExtensions().contains(extension.toLower()); return m_appletScriptEngine->loadedExtensions().contains(extension.toLower());
} }
void AppletInterface::debug(const QString &msg)
{
kDebug() << msg;
}
QObject *AppletInterface::findChild(const QString &name) const QObject *AppletInterface::findChild(const QString &name) const
{ {
if (name.isEmpty()) { if (name.isEmpty()) {

View File

@ -241,7 +241,6 @@ enum AnimationDirection {
Q_INVOKABLE bool include(const QString &script); Q_INVOKABLE bool include(const QString &script);
Q_INVOKABLE bool hasExtension(const QString &extension) const; 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 QObject *findChild(const QString &name) const;
Q_INVOKABLE Plasma::Extender *extender() const; Q_INVOKABLE Plasma::Extender *extender() const;

View File

@ -569,6 +569,8 @@ void SimpleJavaScriptApplet::setupObjects()
fun = m_engine->newFunction(SimpleJavaScriptApplet::print); fun = m_engine->newFunction(SimpleJavaScriptApplet::print);
global.setProperty("print", fun); global.setProperty("print", fun);
fun = m_engine->newFunction(SimpleJavaScriptApplet::debug);
global.setProperty("print", debug);
// Work around bug in 4.3.0 // Work around bug in 4.3.0
qMetaTypeId<QVariant>(); qMetaTypeId<QVariant>();
@ -905,6 +907,16 @@ QScriptValue SimpleJavaScriptApplet::print(QScriptContext *context, QScriptEngin
return engine->undefinedValue(); 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() void SimpleJavaScriptApplet::collectGarbage()
{ {
m_engine->collectGarbage(); m_engine->collectGarbage();

View File

@ -97,6 +97,7 @@ private:
static QScriptValue createWidget(QScriptContext *context, QScriptEngine *engine); static QScriptValue createWidget(QScriptContext *context, QScriptEngine *engine);
static QScriptValue notSupported(QScriptContext *context, QScriptEngine *engine); static QScriptValue notSupported(QScriptContext *context, QScriptEngine *engine);
static QScriptValue print(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); static QScriptValue widgetAdjustSize(QScriptContext *context, QScriptEngine *engine);
// run extension // run extension