summaryrefslogtreecommitdiffstats
path: root/tools/qmlviewer/qmlviewer.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-06-16 05:47:42 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-06-16 05:47:42 (GMT)
commit2f3aca28242fb4849f62b7391460ba66361f29d7 (patch)
treeed2af6ca68c669124ad676d153310b1b62ddda20 /tools/qmlviewer/qmlviewer.cpp
parent27f14fcbf4eeec1b5f2255e1a0ebc74a221964a1 (diff)
downloadQt-2f3aca28242fb4849f62b7391460ba66361f29d7.zip
Qt-2f3aca28242fb4849f62b7391460ba66361f29d7.tar.gz
Qt-2f3aca28242fb4849f62b7391460ba66361f29d7.tar.bz2
Use system configuration for proxy settings
Diffstat (limited to 'tools/qmlviewer/qmlviewer.cpp')
-rw-r--r--tools/qmlviewer/qmlviewer.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index 75a8f1c..af543c9 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -39,6 +39,7 @@
#include <QAction>
#include <QFileDialog>
#include <QTimer>
+#include <QNetworkProxyFactory>
class PreviewDeviceSkin : public DeviceSkin
{
@@ -153,6 +154,8 @@ QmlViewer::QmlViewer(QFxTestEngine::TestMode testMode, const QString &testDir, Q
if (mb)
layout->addWidget(mb);
layout->addWidget(canvas);
+
+ setupProxy();
}
QMenuBar *QmlViewer::menuBar() const
@@ -677,6 +680,21 @@ void QmlViewer::setDeviceKeys(bool on)
devicemode = on;
}
+void QmlViewer::setupProxy()
+{
+ class SystemProxyFactory : public QNetworkProxyFactory
+ {
+ public:
+ virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query)
+ {
+ return QNetworkProxyFactory::systemProxyForQuery(query);
+ }
+ };
+
+ QNetworkAccessManager * nam = canvas->engine()->networkAccessManager();
+ nam->setProxyFactory(new SystemProxyFactory);
+}
+
void QmlViewer::setCacheEnabled(bool on)
{
QNetworkAccessManager * nam = canvas->engine()->networkAccessManager();