Merge branch 'master' into plasma/declarative
This commit is contained in:
commit
3e913b7096
@ -210,7 +210,7 @@ QObject *DataModel::dataSource() const
|
||||
return m_dataSource;
|
||||
}
|
||||
|
||||
void DataModel::setKeyRoleFilter(const QString key)
|
||||
void DataModel::setKeyRoleFilter(const QString& key)
|
||||
{
|
||||
if (m_keyRoleFilter == key) {
|
||||
return;
|
||||
|
@ -96,7 +96,7 @@ public:
|
||||
void setDataSource(QObject *source);
|
||||
QObject *dataSource() const;
|
||||
|
||||
void setKeyRoleFilter(const QString key);
|
||||
void setKeyRoleFilter(const QString& key);
|
||||
QString keyRoleFilter() const;
|
||||
|
||||
int roleNameToId(const QString &name);
|
||||
|
@ -18,7 +18,7 @@ Name[ga]=Sábháil polasaithe um giuirléidí cianda
|
||||
Name[he]=שמירת מדיניות של ווידג׳טים מרוחקים
|
||||
Name[hr]=Spremi pravila za udaljene widgete
|
||||
Name[hu]=Távoli widgetek irányelveinek mentése
|
||||
Name[ia]=Il Salva le politicas de le widgets remote
|
||||
Name[ia]=Il salva le politicas del widgets remote
|
||||
Name[id]=Simpan kebijakan widget jarak jauh
|
||||
Name[it]=Salva le linee guida degli oggetti remoti
|
||||
Name[ja]=リモートウィジェットポリシーを保存
|
||||
@ -71,7 +71,7 @@ Description[ga]=Ná lig don chóras polasaithe um giuirléidí cianda plasma a s
|
||||
Description[he]=מונע מהמערכת מלשמור מדיניות של ווידג׳טים מרוחקים
|
||||
Description[hr]=Brani sustavu spremanje pravila za udaljene widgete Plasme
|
||||
Description[hu]=Megakadályozza a rendszert a távoli widgetek irányelveinek mentésében
|
||||
Description[ia]=Il preveni le systema ab salvar le politicas de le remote widgets de plasma
|
||||
Description[ia]=Il preveni le systema ab salvar le politicas del widgets (elementos graphic) remote de plasma
|
||||
Description[id]=Mencegah sistem dari menyimpan kebijakan widget jarak jauh plasma
|
||||
Description[it]=Impedisce al sistema di salvare le linee guida degli oggetti remoti di Plasma
|
||||
Description[ja]=システムがリモート Plasma ウィジェットポリシー保存するのを防ぎます
|
||||
|
@ -64,7 +64,7 @@ Comment[fr]=Module complémentaire pour les modules externes en Javascript de Pl
|
||||
Comment[he]=תוספים לתוספי JavaScript של Plasma
|
||||
Comment[hr]=Dodaci za priključke za Javascript Plasma
|
||||
Comment[hu]=Bővítmények JavaScript Plazma-modulokhoz
|
||||
Comment[ia]=Addons pro plugins de Plasma de javascript
|
||||
Comment[ia]=Addons (elementos adjuncte) pro plugins de Plasma de javascript
|
||||
Comment[it]=Aggiunte per le estensioni JavaScript di Plasma
|
||||
Comment[ja]=JavaScript Plasma プラグイン用のアドオン
|
||||
Comment[kk]=Javascript Plasma плагиніне қосымшасы
|
||||
@ -89,6 +89,7 @@ Comment[sr@ijekavianlatin]=Dodaci za JavaScript plasma priključke
|
||||
Comment[sr@latin]=Dodaci za JavaScript plasma priključke
|
||||
Comment[sv]=Tillägg för Javascript Plasma-insticksprogram
|
||||
Comment[th]=ส่วนขยายสำหรับส่วนเสริมพลาสมาที่เป็นจาวาสคริปต์
|
||||
Comment[tr]=Javascript Plasma eklentileri için ek araçlar
|
||||
Comment[uk]=Додатки для використання Javascript у Плазмі
|
||||
Comment[wa]=Pacaedjes di rawete po les tchôkes-divins Plasma Javascript
|
||||
Comment[x-test]=xxAddons for Javascript Plasma pluginsxx
|
||||
|
@ -35,6 +35,7 @@ Name[sr@ijekavian]=Декларативни виџет
|
||||
Name[sr@ijekavianlatin]=Deklarativni vidžet
|
||||
Name[sr@latin]=Deklarativni vidžet
|
||||
Name[sv]=Deklarativ grafisk komponent
|
||||
Name[tr]=Bildirim parçacığı
|
||||
Name[uk]=Декларативний віджет
|
||||
Name[wa]=Ahesse di gåyotaedje
|
||||
Name[x-test]=xxDeclarative widgetxx
|
||||
|
@ -411,6 +411,7 @@ QScriptValue DeclarativeAppletScript::dataEngine(QScriptContext *context, QScrip
|
||||
Plasma::DataEngine *dataEngine = interface->dataEngine(dataEngineName);
|
||||
QScriptValue v = engine->newQObject(dataEngine, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
|
||||
v.setProperty("connectSource", engine->newFunction(DataEngineReceiver::connectSource));
|
||||
v.setProperty("connectAllSources", engine->newFunction(DataEngineReceiver::connectAllSources));
|
||||
v.setProperty("disconnectSource", engine->newFunction(DataEngineReceiver::disconnectSource));
|
||||
return v;
|
||||
}
|
||||
|
@ -591,6 +591,7 @@ QScriptValue SimpleJavaScriptApplet::dataEngine(QScriptContext *context, QScript
|
||||
DataEngine *dataEngine = interface->dataEngine(dataEngineName);
|
||||
QScriptValue v = engine->newQObject(dataEngine, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
|
||||
v.setProperty("connectSource", engine->newFunction(DataEngineReceiver::connectSource));
|
||||
v.setProperty("connectAllSources", engine->newFunction(DataEngineReceiver::connectAllSources));
|
||||
v.setProperty("disconnectSource", engine->newFunction(DataEngineReceiver::disconnectSource));
|
||||
return v;
|
||||
}
|
||||
|
@ -86,24 +86,10 @@ DataEngineReceiver *DataEngineReceiver::getReceiver(Plasma::DataEngine *dataEngi
|
||||
return 0;
|
||||
}
|
||||
|
||||
QScriptValue DataEngineReceiver::connectSource(QScriptContext *context, QScriptEngine *engine)
|
||||
QObject *DataEngineReceiver::extractTargetQObject(QScriptEngine *engine, const QString &source, const QScriptValue &v, Plasma::DataEngine *dataEngine)
|
||||
{
|
||||
if (context->argumentCount() < 2) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
DataEngine *dataEngine = qobject_cast<DataEngine *>(context->thisObject().toQObject());
|
||||
if (!dataEngine) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
const QString source = context->argument(0).toString();
|
||||
if (source.isEmpty()) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
QObject *obj = 0;
|
||||
QScriptValue v = context->argument(1);
|
||||
|
||||
// if it's a function we get, then use that directly
|
||||
// next see if it is a qobject with a good slot; if it is then use that directly
|
||||
// otherwise, try to use the object with a dataUpdated method call
|
||||
@ -127,6 +113,56 @@ QScriptValue DataEngineReceiver::connectSource(QScriptContext *context, QScriptE
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
QScriptValue DataEngineReceiver::connectAllSources(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
if (context->argumentCount() < 1) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
DataEngine *dataEngine = qobject_cast<DataEngine *>(context->thisObject().toQObject());
|
||||
if (!dataEngine) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
int pollingInterval = 0;
|
||||
Plasma::IntervalAlignment intervalAlignment = Plasma::NoAlignment;
|
||||
if (context->argumentCount() > 1) {
|
||||
pollingInterval = context->argument(2).toInt32();
|
||||
|
||||
if (context->argumentCount() > 2) {
|
||||
intervalAlignment = static_cast<Plasma::IntervalAlignment>(context->argument(4).toInt32());
|
||||
}
|
||||
}
|
||||
|
||||
QObject *obj = extractTargetQObject(engine, QString(), context->argument(0), dataEngine);
|
||||
if (!obj) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
dataEngine->connectAllSources(obj, pollingInterval, intervalAlignment);
|
||||
return true;
|
||||
}
|
||||
|
||||
QScriptValue DataEngineReceiver::connectSource(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
if (context->argumentCount() < 2) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
DataEngine *dataEngine = qobject_cast<DataEngine *>(context->thisObject().toQObject());
|
||||
if (!dataEngine) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
const QString source = context->argument(0).toString();
|
||||
if (source.isEmpty()) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
||||
QObject *obj = extractTargetQObject(engine, source, context->argument(1), dataEngine);
|
||||
if (!obj) {
|
||||
return engine->undefinedValue();
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
bool isValid() const;
|
||||
|
||||
static QScriptValue connectSource(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue connectAllSources(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue disconnectSource(QScriptContext *context, QScriptEngine *engine);
|
||||
static QSet<DataEngineReceiver*> s_receivers;
|
||||
|
||||
@ -46,6 +47,7 @@ public Q_SLOTS:
|
||||
|
||||
private:
|
||||
static DataEngineReceiver *getReceiver(Plasma::DataEngine *dataEngine, const QString &source, const QScriptValue &v);
|
||||
static QObject *extractTargetQObject(QScriptEngine *engine, const QString &source, const QScriptValue &v, Plasma::DataEngine *dataEngine);
|
||||
|
||||
const Plasma::DataEngine *m_engine;
|
||||
const QString m_source;
|
||||
|
Loading…
x
Reference in New Issue
Block a user