summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdemos/declarative/samegame/content/samegame.js1
-rw-r--r--demos/declarative/twitter/content/HomeTitleBar.qml1
-rw-r--r--examples/declarative/listview/dummydata/MyPetsModel.qml2
-rw-r--r--examples/declarative/tutorials/helloworld/tutorial3.qml2
-rwxr-xr-xexamples/declarative/tutorials/samegame/samegame4/content/samegame.js1
-rw-r--r--src/declarative/qml/qmlengine.cpp22
-rw-r--r--src/declarative/qml/qmlengine_p.h2
-rw-r--r--src/declarative/util/qmllistmodel.cpp2
-rw-r--r--tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp14
9 files changed, 44 insertions, 3 deletions
diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js
index 3598c26..8651c84 100755
--- a/demos/declarative/samegame/content/samegame.js
+++ b/demos/declarative/samegame/content/samegame.js
@@ -235,6 +235,7 @@ function sendHighScore(name) {
var postData = "name="+name+"&score="+gameCanvas.score
+"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000);
postman.open("POST", scoresURL, true);
+ postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
postman.onreadystatechange = function() {
if (postman.readyState == postman.DONE) {
dialog.show("Your score has been uploaded.");
diff --git a/demos/declarative/twitter/content/HomeTitleBar.qml b/demos/declarative/twitter/content/HomeTitleBar.qml
index e5bdb85..c48befd 100644
--- a/demos/declarative/twitter/content/HomeTitleBar.qml
+++ b/demos/declarative/twitter/content/HomeTitleBar.qml
@@ -24,6 +24,7 @@ Item {
titleBar.update();
}
}
+ postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
postman.send(postData);
editor.text = ""
diff --git a/examples/declarative/listview/dummydata/MyPetsModel.qml b/examples/declarative/listview/dummydata/MyPetsModel.qml
index 9a00dca..074fc13 100644
--- a/examples/declarative/listview/dummydata/MyPetsModel.qml
+++ b/examples/declarative/listview/dummydata/MyPetsModel.qml
@@ -29,7 +29,7 @@ ListModel {
size: "Medium"
}
ListElement {
- name: "Whiskers"
+ name: "Schrödinger"
type: "Cat"
age: 2
size: "Medium"
diff --git a/examples/declarative/tutorials/helloworld/tutorial3.qml b/examples/declarative/tutorials/helloworld/tutorial3.qml
index 52c3fe8..0f27f86 100644
--- a/examples/declarative/tutorials/helloworld/tutorial3.qml
+++ b/examples/declarative/tutorials/helloworld/tutorial3.qml
@@ -29,7 +29,7 @@ Rectangle {
from: ""; to: "down"; reversible: true
ParallelAnimation {
NumberAnimation { matchProperties: "y,rotation"; duration: 500; easing: "easeInOutQuad" }
- ColorAnimation { property: "color"; duration: 500 }
+ ColorAnimation { duration: 500 }
}
}
//![3]
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
index b833385..2a0d718 100755
--- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
@@ -238,6 +238,7 @@ function sendHighScore(name) {
var postData = "name="+name+"&score="+gameCanvas.score
+"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000);
postman.open("POST", scoresURL, true);
+ postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
postman.onreadystatechange = function() {
if (postman.readyState == postman.DONE) {
dialog.show("Your score has been uploaded.");
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 0a00092..aa66c17 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -144,6 +144,8 @@ QmlEnginePrivate::QmlEnginePrivate(QmlEngine *e)
qtObject.setProperty(QLatin1String("playSound"), scriptEngine.newFunction(QmlEnginePrivate::playSound, 1));
qtObject.setProperty(QLatin1String("openUrlExternally"),scriptEngine.newFunction(desktopOpenUrl, 1));
qtObject.setProperty(QLatin1String("md5"),scriptEngine.newFunction(md5, 1));
+ qtObject.setProperty(QLatin1String("btoa"),scriptEngine.newFunction(btoa, 1));
+ qtObject.setProperty(QLatin1String("atob"),scriptEngine.newFunction(atob, 1));
//firebug/webkit compat
QScriptValue consoleObject = scriptEngine.newObject();
@@ -818,6 +820,26 @@ QScriptValue QmlEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *)
return QScriptValue(QLatin1String(result.toHex()));
}
+QScriptValue QmlEnginePrivate::btoa(QScriptContext *ctxt, QScriptEngine *)
+{
+ QByteArray data;
+
+ if (ctxt->argumentCount() >= 1)
+ data = ctxt->argument(0).toString().toUtf8();
+
+ return QScriptValue(QLatin1String(data.toBase64()));
+}
+
+QScriptValue QmlEnginePrivate::atob(QScriptContext *ctxt, QScriptEngine *)
+{
+ QByteArray data;
+
+ if (ctxt->argumentCount() >= 1)
+ data = ctxt->argument(0).toString().toUtf8();
+
+ return QScriptValue(QLatin1String(QByteArray::fromBase64(data)));
+}
+
QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e)
{
if(ctxt->argumentCount() < 1)
diff --git a/src/declarative/qml/qmlengine_p.h b/src/declarative/qml/qmlengine_p.h
index c11a399..cabd0ad 100644
--- a/src/declarative/qml/qmlengine_p.h
+++ b/src/declarative/qml/qmlengine_p.h
@@ -269,6 +269,8 @@ public:
static QScriptValue playSound(QScriptContext*, QScriptEngine*);
static QScriptValue desktopOpenUrl(QScriptContext*, QScriptEngine*);
static QScriptValue md5(QScriptContext*, QScriptEngine*);
+ static QScriptValue btoa(QScriptContext*, QScriptEngine*);
+ static QScriptValue atob(QScriptContext*, QScriptEngine*);
static QScriptValue consoleLog(QScriptContext*, QScriptEngine*);
static QScriptEngine *getScriptEngine(QmlEngine *e) { return &e->d_func()->scriptEngine; }
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 5491fd7..8259dcd 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -851,7 +851,7 @@ void QmlListModelParser::setCustomData(QObject *obj, const QByteArray &d)
case ListInstruction::Value:
{
ModelNode *n = nodes.top();
- n->values.append(QByteArray(data + instr.dataIdx));
+ n->values.append(QString::fromUtf8(QByteArray(data + instr.dataIdx)));
}
break;
diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp
index f2ffb7b..c7de5d9 100644
--- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp
+++ b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp
@@ -51,12 +51,26 @@ public:
tst_QmlListModel() {}
private slots:
+ void static_i18n();
void dynamic_data();
void dynamic();
void error_data();
void error();
};
+void tst_QmlListModel::static_i18n()
+{
+ QString expect = QString::fromUtf8("na\303\257ve");
+ QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }";
+ QmlEngine engine;
+ QmlComponent component(&engine, componentStr.toUtf8(), QUrl("file://"));
+ QmlListModel *obj = qobject_cast<QmlListModel*>(component.create());
+ QVERIFY(obj != 0);
+ QString prop = obj->get(0).property(QLatin1String("prop1")).toString();
+ QCOMPARE(prop,expect);
+ delete obj;
+}
+
void tst_QmlListModel::dynamic_data()
{
QTest::addColumn<QString>("script");