set a local package
svn path=/trunk/KDE/kdebase/runtime/; revision=1171489
This commit is contained in:
parent
3878087674
commit
d07baae46f
@ -45,7 +45,6 @@
|
|||||||
#include "javascriptaddonpackagestructure.h"
|
#include "javascriptaddonpackagestructure.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(ScriptEnv*)
|
Q_DECLARE_METATYPE(ScriptEnv*)
|
||||||
Q_DECLARE_METATYPE(Plasma::Package)
|
|
||||||
|
|
||||||
ScriptEnv::ScriptEnv(QObject *parent, QScriptEngine *engine)
|
ScriptEnv::ScriptEnv(QObject *parent, QScriptEngine *engine)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
@ -450,16 +449,17 @@ QScriptValue ScriptEnv::loadAddon(QScriptContext *context, QScriptEngine *engine
|
|||||||
QScriptContext *innerContext = engine->pushContext();
|
QScriptContext *innerContext = engine->pushContext();
|
||||||
innerContext->activationObject().setProperty("registerAddon", engine->newFunction(ScriptEnv::registerAddon));
|
innerContext->activationObject().setProperty("registerAddon", engine->newFunction(ScriptEnv::registerAddon));
|
||||||
QScriptValue v = engine->newVariant(QVariant::fromValue(package));
|
QScriptValue v = engine->newVariant(QVariant::fromValue(package));
|
||||||
innerContext->activationObject().setProperty("__plasma_addon_package", v,
|
innerContext->activationObject().setProperty("__plasma_package", v,
|
||||||
QScriptValue::ReadOnly |
|
QScriptValue::ReadOnly |
|
||||||
QScriptValue::Undeletable |
|
QScriptValue::Undeletable |
|
||||||
QScriptValue::SkipInEnumeration);
|
QScriptValue::SkipInEnumeration);
|
||||||
|
kDebug() << "context is" << innerContext;
|
||||||
engine->evaluate(code, file.fileName());
|
engine->evaluate(code, file.fileName());
|
||||||
engine->popContext();
|
engine->popContext();
|
||||||
|
|
||||||
ScriptEnv *env = ScriptEnv::findScriptEnv(engine);
|
ScriptEnv *env = ScriptEnv::findScriptEnv(engine);
|
||||||
if (env) {
|
if (env && env->checkForErrors(false)) {
|
||||||
return env->checkForErrors(false);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -485,9 +485,10 @@ QScriptValue ScriptEnv::registerAddon(QScriptContext *context, QScriptEngine *en
|
|||||||
func.setProperty("test", "bar");
|
func.setProperty("test", "bar");
|
||||||
*/
|
*/
|
||||||
QScriptValue obj = func.construct();
|
QScriptValue obj = func.construct();
|
||||||
obj.setProperty("__plasma_addon_package",
|
obj.setProperty("__plasma_package",
|
||||||
context->activationObject().property("__plasma_addon_package"),
|
context->parentContext()->activationObject().property("__plasma_package"),
|
||||||
QScriptValue::ReadOnly|QScriptValue::Undeletable|
|
QScriptValue::ReadOnly|
|
||||||
|
QScriptValue::Undeletable |
|
||||||
QScriptValue::SkipInEnumeration);
|
QScriptValue::SkipInEnumeration);
|
||||||
/*
|
/*
|
||||||
obj.setProperty("test", "bar");
|
obj.setProperty("test", "bar");
|
||||||
|
Loading…
Reference in New Issue
Block a user