From cc044de1f9c1443a482c3709cb1a7011df5729ee Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 7 Sep 2009 14:36:39 +1000 Subject: Save and restore non-session cookies. --- tools/qmlviewer/qmlviewer.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 3ae9a97..1c0f496 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -23,6 +23,8 @@ #include #include "deviceskin.h" +#include +#include #include #include #include @@ -208,6 +210,34 @@ public: } }; +class PersistentCookieJar : public QNetworkCookieJar { +public: + PersistentCookieJar(QObject *parent) : QNetworkCookieJar(parent) { load(); } + ~PersistentCookieJar() { save(); } + +private: + void save() + { + QList list = allCookies(); + QByteArray data; + foreach (QNetworkCookie cookie, list) { + if (!cookie.isSessionCookie()) { + data.append(cookie.toRawForm()); + data.append("\n"); + } + } + QSettings settings("Nokia", "QtQmlViewer"); + settings.setValue("Cookies",data); + } + + void load() + { + QSettings settings("Nokia", "QtQmlViewer"); + QByteArray data = settings.value("Cookies").toByteArray(); + setAllCookies(QNetworkCookie::parseCookies(data)); + } +}; + QString QmlViewer::getVideoFileName() { QString title = convertAvailable || ffmpegAvailable ? tr("Save Video File") : tr("Save PNG Frames"); @@ -271,6 +301,7 @@ QmlViewer::QmlViewer(QWidget *parent, Qt::WindowFlags flags) layout->addWidget(canvas); setupProxy(); + canvas->engine()->networkAccessManager()->setCookieJar(new PersistentCookieJar(this)); connect(&autoStartTimer, SIGNAL(triggered()), this, SLOT(autoStartRecording())); connect(&autoStopTimer, SIGNAL(triggered()), this, SLOT(autoStopRecording())); -- cgit v0.12 From 39629bcfbf1b732f717b4c9715f9edd49e45f0ea Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 7 Sep 2009 14:38:21 +1000 Subject: spel --- doc/src/declarative/extending.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index 3235435..2d0dc34 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -369,7 +369,7 @@ The QML snippet shown above associates the evaluation of a ECMAScript expression with the emission of a Qt signal. All Qt signals on a registered class become available as special "signal -propeties" within QML to which the user can assign a single ECMAScript +properties" within QML to which the user can assign a single ECMAScript expression. The signal property's name is a transformed version of the Qt signal name: "on" is prepended, and the first letter of the signal name upper cased. For example, the signal used in the example above has the following -- cgit v0.12 From be67e10cde56ba905a8bb85bdb5ecab2b3038ede Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 7 Sep 2009 15:09:01 +1000 Subject: Resolve qualified type even if not localfile. If remote content is fully-qualified to a unique URL, we do not need any qmldir (and for remote content, we don't support that yet). --- src/declarative/qml/qmlengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 6d3506c..e3d4840 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -1509,6 +1509,10 @@ public: if (s) { if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return)) return true; + if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) { + *url_return = QUrl(s->urls[0]+"/").resolved(QUrl(QLatin1String(unqualifiedtype + ".qml"))); + return true; + } } if (url_return) { *url_return = base.resolved(QUrl(QLatin1String(type + ".qml"))); -- cgit v0.12