From cb7e008ee713729dd27666df7282888325c0963a Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 17 Mar 2010 10:49:27 +1000 Subject: Add flag to indicate that network sessions are expected on a platform. --- mkspecs/common/symbian/symbian.conf | 3 --- mkspecs/linux-g++-maemo/qmake.conf | 3 --- src/network/access/qnetworkaccessmanager.cpp | 14 +++++++------- src/network/access/qnetworkaccessmanager_p.h | 4 ---- src/network/bearer/qnetworkconfigmanager.cpp | 2 ++ src/network/bearer/qnetworkconfigmanager.h | 3 ++- src/plugins/bearer/icd/qicdengine.cpp | 3 ++- src/plugins/bearer/symbian/symbianengine.cpp | 3 ++- 8 files changed, 15 insertions(+), 20 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 239b998..1053ab3 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -9,9 +9,6 @@ QMAKE_INCREMENTAL_STYLE = sublib DEFINES += UNICODE QT_KEYPAD_NAVIGATION QT_SOFTKEYS_ENABLED QT_USE_MATH_H_FLOATS -# QNetworkAccessManager to create a network session by default -DEFINES += QT_QNAM_DEFAULT_NETWORK_SESSION - QMAKE_COMPILER_DEFINES += SYMBIAN QMAKE_EXT_OBJ = .o diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index e272e72..ca201bc 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -33,7 +33,4 @@ DEFINES += QT_GL_NO_SCISSOR_TEST # Work round SGX 1.4 driver bug (text corrupted), modify glyph cache width: DEFINES += QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -# QNetworkAccessManager to create a network session by default -DEFINES += QT_QNAM_DEFAULT_NETWORK_SESSION - load(qt_config) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 1940dd1..4518d4c 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -880,15 +880,17 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QDisabledNetworkReply(this, req, op); } -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION if (!d->networkSession && (d->initializeSession || !d->networkConfiguration.isEmpty())) { QNetworkConfigurationManager manager; - if (d->networkConfiguration.isEmpty()) - d->createSession(manager.defaultConfiguration()); - else + if (!d->networkConfiguration.isEmpty()) { d->createSession(manager.configurationFromIdentifier(d->networkConfiguration)); + } else { + if (manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired) + d->createSession(manager.defaultConfiguration()); + else + d->initializeSession = false; + } } -#endif if (d->networkSession) d->networkSession->setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), -1); @@ -1208,9 +1210,7 @@ void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &co { Q_Q(QNetworkAccessManager); -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION initializeSession = false; -#endif if (networkSession) delete networkSession; diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 4a2a840..0140268 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -77,9 +77,7 @@ public: #endif networkSession(0), networkAccessEnabled(true), -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION initializeSession(true), -#endif cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -126,9 +124,7 @@ public: QNetworkSession *networkSession; QString networkConfiguration; bool networkAccessEnabled; -#ifdef QT_QNAM_DEFAULT_NETWORK_SESSION bool initializeSession; -#endif bool cookieJarCreated; diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index e7595a4..0cd5efb 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -166,6 +166,8 @@ QNetworkConfigurationManagerPrivate *qNetworkConfigurationManagerPrivate() sockets. \value DataStatistics If this flag is set QNetworkSession can provide statistics about transmitted and received data. + \value NetworkSessionRequired If this flag is set the platform requires that a network + session is created before network operations can be performed. */ /*! diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 73041fe..bb4d8a0 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -64,7 +64,8 @@ public: SystemSessionSupport = 0x00000004, ApplicationLevelRoaming = 0x00000008, ForcedRoaming = 0x00000010, - DataStatistics = 0x00000020 + DataStatistics = 0x00000020, + NetworkSessionRequired = 0x00000040 }; Q_DECLARE_FLAGS(Capabilities, Capability) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 5e9dc0a..f70a209 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -417,7 +417,8 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const { return QNetworkConfigurationManager::CanStartAndStopInterfaces | QNetworkConfigurationManager::DataStatistics | - QNetworkConfigurationManager::ForcedRoaming; + QNetworkConfigurationManager::ForcedRoaming | + QNetworkConfigurationManager::NetworkSessionRequired; } QNetworkSessionPrivate *QIcdEngine::createSessionBackend() diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 980892a..4d65b80 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -184,7 +184,8 @@ QNetworkConfigurationManager::Capabilities SymbianEngine::capabilities() const capFlags = QNetworkConfigurationManager::CanStartAndStopInterfaces | QNetworkConfigurationManager::DirectConnectionRouting | QNetworkConfigurationManager::SystemSessionSupport | - QNetworkConfigurationManager::DataStatistics; + QNetworkConfigurationManager::DataStatistics | + QNetworkConfigurationManager::NetworkSessionRequired; #ifdef SNAP_FUNCTIONALITY_AVAILABLE capFlags |= QNetworkConfigurationManager::ApplicationLevelRoaming | -- cgit v0.12