summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-03-17 00:49:27 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-03-18 03:56:53 (GMT)
commitcb7e008ee713729dd27666df7282888325c0963a (patch)
tree6958a32f52fb5572d09a528cbeb5c8ed8fb35c59 /src/network
parent729bbd99736dd88847018a3378fc89e3be348d87 (diff)
downloadQt-cb7e008ee713729dd27666df7282888325c0963a.zip
Qt-cb7e008ee713729dd27666df7282888325c0963a.tar.gz
Qt-cb7e008ee713729dd27666df7282888325c0963a.tar.bz2
Add flag to indicate that network sessions are expected on a platform.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp14
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h4
-rw-r--r--src/network/bearer/qnetworkconfigmanager.cpp2
-rw-r--r--src/network/bearer/qnetworkconfigmanager.h3
4 files changed, 11 insertions, 12 deletions
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)