allow for things like:

var template = loadTemplate("org.kde.plasma-desktop.findWidgets")
template.findWidgets("tasks")


svn path=/trunk/KDE/kdebase/workspace/; revision=1170449
This commit is contained in:
Aaron J. Seigo 2010-08-31 23:29:59 +00:00 committed by Marco Martin
parent 831607f13f
commit 1a95091dc0

View File

@ -314,8 +314,15 @@ QScriptValue ScriptEngine::loadTemplate(QScriptContext *context, QScriptEngine *
ScriptEngine *env = envFor(engine);
env->globalObject().setProperty("templateName", env->newVariant(info.name()), QScriptValue::ReadOnly | QScriptValue::Undeletable);
env->globalObject().setProperty("templateComment", env->newVariant(info.comment()), QScriptValue::ReadOnly | QScriptValue::Undeletable);
QScriptValue rv = env->newObject();
QScriptContext *ctx = env->pushContext();
ctx->setThisObject(rv);
env->evaluateScript(script, path);
return true;
env->popContext();
return rv;
}
void ScriptEngine::setupEngine()