javascript dataengines now actually work
svn path=/trunk/KDE/kdebase/runtime/; revision=1141016
This commit is contained in:
parent
a6899cc114
commit
b15e66d188
@ -43,9 +43,9 @@ bool JavaScriptDataEngine::init()
|
||||
|
||||
bindI18N(m_qscriptEngine);
|
||||
|
||||
QScriptValue iface = m_qscriptEngine->newQObject(this);
|
||||
iface.setScope(global);
|
||||
global.setProperty("engine", iface);
|
||||
m_iface = m_qscriptEngine->newQObject(this);
|
||||
m_iface.setScope(global);
|
||||
global.setProperty("engine", m_iface);
|
||||
|
||||
global.setProperty("setData", m_qscriptEngine->newFunction(JavaScriptDataEngine::jsSetData));
|
||||
global.setProperty("removeAllData", m_qscriptEngine->newFunction(JavaScriptDataEngine::jsRemoveAllData));
|
||||
@ -55,11 +55,11 @@ bool JavaScriptDataEngine::init()
|
||||
registerDataEngineMetaTypes(m_qscriptEngine);
|
||||
|
||||
Authorization auth;
|
||||
if (!m_env->importExtensions(description(), iface, auth)) {
|
||||
if (!m_env->importExtensions(description(), m_iface, auth)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return m_env->include(mainScript());
|
||||
}
|
||||
|
||||
void JavaScriptDataEngine::jsSetMaxSourceCount(int count)
|
||||
@ -200,11 +200,12 @@ QScriptValue JavaScriptDataEngine::jsRemoveAllSources(QScriptContext *context, Q
|
||||
|
||||
QScriptValue JavaScriptDataEngine::callFunction(const QString &functionName, const QScriptValueList &args) const
|
||||
{
|
||||
QScriptValue fun = iface.property(functionName);
|
||||
//kDebug() << "calling" << functionName;
|
||||
QScriptValue fun = m_iface.property(functionName);
|
||||
if (fun.isFunction()) {
|
||||
QScriptContext *ctx = m_qscriptEngine->pushContext();
|
||||
ctx->setActivationObject(iface);
|
||||
QScriptValue rv = fun.call(iface, args);
|
||||
ctx->setActivationObject(m_iface);
|
||||
QScriptValue rv = fun.call(m_iface, args);
|
||||
m_qscriptEngine->popContext();
|
||||
|
||||
if (m_qscriptEngine->hasUncaughtException()) {
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
|
||||
QScriptEngine *m_qscriptEngine;
|
||||
ScriptEnv *m_env;
|
||||
QScriptValue iface;
|
||||
QScriptValue m_iface;
|
||||
int m_pollingInterval;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user