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

View File

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