implementation of Service

svn path=/trunk/KDE/kdebase/runtime/; revision=1077832
This commit is contained in:
Aaron J. Seigo 2010-01-20 23:29:53 +00:00
parent 1549eb3528
commit 10238e16af
2 changed files with 11 additions and 11 deletions

View File

@ -52,11 +52,10 @@ bool JavaScriptDataEngine::init()
qRegisterMetaType<DataEngine::Data>("Plasma::DataEngine::Data");
qRegisterMetaType<DataEngine::Data>("DataEngine::Data");
qScriptRegisterMapMetaType<Plasma::DataEngine::Data>(m_qscriptEngine);
/**
TODO: Service bindings
m_qscriptEngine->setDefaultPrototype(qMetaTypeId<Service*>(), m_qscriptEngine->newQObject(new DummyService()));
m_qscriptEngine->setDefaultPrototype(qMetaTypeId<ServiceJob*>(), m_qscriptEngine->newQObject(new ServiceJob(QString(), QString(), QMap<QString, QVariant>())));
*/
m_qscriptEngine->setDefaultPrototype(qMetaTypeId<Service*>(), m_qscriptEngine->newQObject(new DummyService(), QScriptEngine::ScriptOwnership));
m_qscriptEngine->setDefaultPrototype(qMetaTypeId<ServiceJob*>(),
m_qscriptEngine->newQObject(new ServiceJob(QString(), QString(), QMap<QString, QVariant>()),
QScriptEngine::ScriptOwnership ));
Authorization auth;
if (!m_qscriptEngine->importExtensions(description(), iface, auth)) {
@ -254,17 +253,18 @@ bool JavaScriptDataEngine::updateSourceEvent(const QString &source)
return false;
}
/*
Plasma::Service *JavaScriptDataEngine::serviceForSource(const QString &source)
{
QScriptValue rv = callFunction("updateSourceEvent");
if (rv.isValid() && rv.isVariant()) {
return rv.toVariant().value<Plasma::Service*>();
QScriptValueList args;
args << source;
QScriptValue rv = callFunction("updateSourceEvent", args);
if (rv.isValid() && rv.isQObject()) {
return qobject_cast<Plasma::Service *>(rv.toQObject());
}
return 0;
}
*/
K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE(javascriptdataengine, JavaScriptDataEngine)
#include <javascriptdataengine.moc>

View File

@ -41,7 +41,7 @@ public:
QStringList sources() const;
bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source);
//TODO: Plasma::Service *serviceForSource(const QString &source);
Plasma::Service *serviceForSource(const QString &source);
int maxSourceCount() const;
void jsSetMaxSourceCount(int count);