support setting full arrays of data
svn path=/trunk/KDE/kdebase/runtime/; revision=1128673
This commit is contained in:
parent
a52bd2b9fb
commit
cd753894be
@ -107,14 +107,24 @@ QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEng
|
|||||||
}
|
}
|
||||||
|
|
||||||
const QString source = context->argument(0).toString();
|
const QString source = context->argument(0).toString();
|
||||||
QString value = context->argument(1).toString();
|
if (context->argument(1).isArray()) {
|
||||||
|
QScriptValueIterator it(context->argument(1));
|
||||||
|
DataEngine::Data data;
|
||||||
|
while (it.hasNext()) {
|
||||||
|
it.next();
|
||||||
|
data.insert(it.name(), it.value().toVariant());
|
||||||
|
}
|
||||||
|
|
||||||
if (context->argumentCount() > 2) {
|
iFace->setData(source, data);
|
||||||
const QString key = value;
|
|
||||||
value = context->argument(2).toString();
|
|
||||||
iFace->setData(source, key, value);
|
|
||||||
} else {
|
} else {
|
||||||
iFace->setData(source, value);
|
QString value = context->argument(1).toString();
|
||||||
|
if (context->argumentCount() > 2) {
|
||||||
|
const QString key = value;
|
||||||
|
value = context->argument(2).toString();
|
||||||
|
iFace->setData(source, key, value);
|
||||||
|
} else {
|
||||||
|
iFace->setData(source, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return engine->newVariant(true);
|
return engine->newVariant(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user