summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlworkerscript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlworkerscript.cpp')
-rw-r--r--src/declarative/qml/qmlworkerscript.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp
index 75c5179..f58aa8b 100644
--- a/src/declarative/qml/qmlworkerscript.cpp
+++ b/src/declarative/qml/qmlworkerscript.cpp
@@ -51,6 +51,7 @@
#include <QtCore/qwaitcondition.h>
#include <QtScript/qscriptvalueiterator.h>
#include <QtCore/qfile.h>
+#include <QtNetwork/qnetworkaccessmanager.h>
#include <QtDeclarative/qmlinfo.h>
QT_BEGIN_NAMESPACE
@@ -107,7 +108,14 @@ public:
struct ScriptEngine : public QmlScriptEngine
{
ScriptEngine(QmlWorkerScriptEnginePrivate *parent) : QmlScriptEngine(0), p(parent) {}
+ ~ScriptEngine() { delete manager; };
QmlWorkerScriptEnginePrivate *p;
+ QNetworkAccessManager *manager;
+
+ virtual QNetworkAccessManager *networkAccessManager() {
+ if (!manager) manager = new QNetworkAccessManager;
+ return manager;
+ }
};
ScriptEngine *workerEngine;
static QmlWorkerScriptEnginePrivate *get(QScriptEngine *e) {
@@ -128,6 +136,9 @@ public:
QScriptValue callback;
};
+ QNetworkAccessManager *networkAccessManager;
+ QNetworkAccessManager *getNetworkAccessManager();
+
QHash<int, WorkerScript *> workers;
QScriptValue getWorker(int);
@@ -224,7 +235,7 @@ private:
Q_DECLARE_METATYPE(QmlWorkerListModelAgent::VariantRef);
QmlWorkerScriptEnginePrivate::QmlWorkerScriptEnginePrivate()
-: workerEngine(0), m_nextId(0)
+: workerEngine(0), networkAccessManager(0), m_nextId(0)
{
}