diff options
author | Tasuku Suzuki <tasuku.suzuki@nokia.com> | 2010-04-15 05:59:08 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-04-15 05:59:08 (GMT) |
commit | 3925bab16a88822fcef749cb6ba7c542688c2fae (patch) | |
tree | d1aa68416cf61baef54b787dc53ad3ad52bd78a1 /src/network | |
parent | 86b483104fa1e8c1b2bcd255f9b94992d1d1b864 (diff) | |
download | Qt-3925bab16a88822fcef749cb6ba7c542688c2fae.zip Qt-3925bab16a88822fcef749cb6ba7c542688c2fae.tar.gz Qt-3925bab16a88822fcef749cb6ba7c542688c2fae.tar.bz2 |
Introduce a qconfig feature for Bearer Management
Merge-request: 517
Reviewed-by: Aaron McCarthy <aaron.mccarthy@nokia.com>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessbackend.cpp | 3 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessbackend_p.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 16 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager.h | 6 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager_p.h | 6 | ||||
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 5 | ||||
-rw-r--r-- | src/network/bearer/qbearerengine.cpp | 4 | ||||
-rw-r--r-- | src/network/bearer/qbearerengine_p.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qbearerplugin.cpp | 4 | ||||
-rw-r--r-- | src/network/bearer/qbearerplugin_p.h | 5 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.cpp | 3 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.cpp | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession_p.h | 4 |
17 files changed, 79 insertions, 3 deletions
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 1fcfebb..f188bd5 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -346,6 +346,8 @@ void QNetworkAccessBackend::sslErrors(const QList<QSslError> &errors) #endif } +#ifndef QT_NO_BEARERMANAGEMENT + /*! Starts the backend. Returns true if the backend is started. Returns false if the backend could not be started due to an unopened or roaming session. The caller should recall this @@ -376,5 +378,6 @@ bool QNetworkAccessBackend::start() return false; } +#endif QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 9bc15e5..4ce37a6 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -111,7 +111,9 @@ public: // socket). virtual void open() = 0; +#ifndef QT_NO_BEARERMANAGEMENT virtual bool start(); +#endif virtual void closeDownstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 90afd2c..d26956f 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -742,6 +742,8 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request)); } +#ifndef QT_NO_BEARERMANAGEMENT + /*! \since 4.7 @@ -858,6 +860,8 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess } } +#endif // QT_NO_BEARERMANAGEMENT + /*! \since 4.7 @@ -915,11 +919,16 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. - if (!d->networkAccessible && !(req.url().scheme() == QLatin1String("file") || + if ( +#ifndef QT_NO_BEARERMANAGEMENT + !d->networkAccessible && +#endif + !(req.url().scheme() == QLatin1String("file") || req.url().scheme().isEmpty())) { return new QDisabledNetworkReply(this, req, op); } +#ifndef QT_NO_BEARERMANAGEMENT if (!d->networkSession && (d->initializeSession || !d->networkConfiguration.isEmpty())) { QNetworkConfigurationManager manager; if (!d->networkConfiguration.isEmpty()) { @@ -934,6 +943,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera if (d->networkSession) d->networkSession->setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), -1); +#endif QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && @@ -994,8 +1004,10 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() if (reply) emit q->finished(reply); +#ifndef QT_NO_BEARERMANAGEMENT if (networkSession && q->findChildren<QNetworkReply *>().count() == 1) networkSession->setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), 120000); +#endif } void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList<QSslError> &errors) @@ -1248,6 +1260,7 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { } +#ifndef QT_NO_BEARERMANAGEMENT void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config) { Q_Q(QNetworkAccessManager); @@ -1328,6 +1341,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession } } } +#endif // QT_NO_BEARERMANAGEMENT QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index c57c9c6..771bc70 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -62,7 +62,9 @@ class QNetworkReply; class QNetworkProxy; class QNetworkProxyFactory; class QSslError; +#ifndef QT_NO_BEARERMANAGEMENT class QNetworkConfiguration; +#endif class QNetworkReplyImplPrivate; class QNetworkAccessManagerPrivate; @@ -115,12 +117,14 @@ public: QNetworkReply *deleteResource(const QNetworkRequest &request); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = 0); +#ifndef QT_NO_BEARERMANAGEMENT void setConfiguration(const QNetworkConfiguration &config); QNetworkConfiguration configuration() const; QNetworkConfiguration activeConfiguration() const; void setNetworkAccessible(NetworkAccessibility accessible); NetworkAccessibility networkAccessible() const; +#endif Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY @@ -145,10 +149,12 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>)) +#ifndef QT_NO_BEARERMANAGEMENT Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) +#endif }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 1785685..695842c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -75,10 +75,12 @@ public: #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif +#ifndef QT_NO_BEARERMANAGEMENT networkSession(0), networkAccessible(QNetworkAccessManager::Accessible), online(false), initializeSession(true), +#endif cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -104,6 +106,7 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); +#ifndef QT_NO_BEARERMANAGEMENT void createSession(const QNetworkConfiguration &config); void _q_networkSessionClosed(); @@ -111,6 +114,7 @@ public: void _q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); void _q_networkSessionStateChanged(QNetworkSession::State state); +#endif // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -123,11 +127,13 @@ public: QNetworkProxyFactory *proxyFactory; #endif +#ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; QString networkConfiguration; QNetworkAccessManager::NetworkAccessibility networkAccessible; bool online; bool initializeSession; +#endif bool cookieJarCreated; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index edd6889..fa7420f 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -86,6 +86,7 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } +#ifndef QT_NO_BEARERMANAGEMENT if (!backend->start()) { // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session @@ -103,9 +104,9 @@ void QNetworkReplyImplPrivate::_q_startOperation() } else { qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); } - return; } +#endif if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) @@ -581,6 +582,7 @@ void QNetworkReplyImplPrivate::finished() totalSize = totalSize.toLongLong() + preMigrationDownloaded; if (!manager.isNull()) { +#ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *session = manager->d_func()->networkSession; if (session && session->state() == QNetworkSession::Roaming && state == Working && errorCode != QNetworkReply::OperationCanceledError) { @@ -600,6 +602,7 @@ void QNetworkReplyImplPrivate::finished() } } } +#endif } resumeNotificationHandling(); diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index c42e2d2..2f8624a 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -41,6 +41,8 @@ #include "qbearerengine_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QBearerEngine::QBearerEngine(QObject *parent) @@ -110,4 +112,6 @@ bool QBearerEngine::configurationsInUse() const #include "moc_qbearerengine_p.cpp" +#endif // QT_NO_BEARERMANAGEMENT + QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h index fd4bf87..70aa5fa 100644 --- a/src/network/bearer/qbearerengine_p.h +++ b/src/network/bearer/qbearerengine_p.h @@ -65,6 +65,8 @@ #include <QtCore/qsharedpointer.h> #include <QtCore/qmutex.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfiguration; @@ -110,4 +112,6 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 4509fd0..a5e8918 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -43,6 +43,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent) @@ -55,3 +57,5 @@ QBearerEnginePlugin::~QBearerEnginePlugin() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h index 36709c2..9652f14 100644 --- a/src/network/bearer/qbearerplugin_p.h +++ b/src/network/bearer/qbearerplugin_p.h @@ -58,6 +58,8 @@ #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -89,5 +91,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif +#endif // QT_NO_BEARERMANAGEMENT +#endif diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 6c6e28b..102b347 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -46,6 +46,8 @@ #include <QtCore/qstringlist.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); @@ -304,3 +306,4 @@ void QNetworkConfigurationManager::updateConfigurations() QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 79bb27c..3e44be1 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -49,6 +49,8 @@ #include <QtCore/qobject.h> #include <QtNetwork/qnetworkconfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_HEADER #ifndef QT_MOBILITY_BEARER @@ -111,5 +113,7 @@ QTM_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKCONFIGURATIONMANAGER_H diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index b4d4c6b..a651dd1 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -50,6 +50,8 @@ #include <QtCore/qthread.h> #include <QtCore/private/qcoreapplication_p.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, @@ -503,3 +505,5 @@ void QNetworkConfigurationManagerPrivate::disablePolling() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 4cb29e9..0649031 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -59,6 +59,8 @@ #include <QtCore/qmutex.h> #include <QtCore/qset.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngine; @@ -129,4 +131,6 @@ Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate *qNetworkConfigurationManag QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 638bee7..1ed6cbb 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -47,6 +47,8 @@ #include "qnetworkconfigmanager_p.h" #include "qnetworksession_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE /*! @@ -706,3 +708,5 @@ void QNetworkSession::disconnectNotify(const char *signal) #include "moc_qnetworksession.cpp" QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 2911d0a..e7fffac 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -48,6 +48,8 @@ #include <QtCore/qvariant.h> #include <QtNetwork/qnetworkconfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + #if defined(Q_OS_WIN) && defined(interface) #undef interface #endif @@ -149,4 +151,6 @@ QTM_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSION_H diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 1a6159a..c7b5718 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -56,6 +56,8 @@ #include "qnetworksession.h" #include "qnetworkconfiguration_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject @@ -146,5 +148,7 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSIONPRIVATE_H |