diff options
25 files changed, 115 insertions, 3 deletions
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 74fa8eed48..c66047adbd 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -505,6 +505,11 @@ #define QT_NO_XMLSTREAMWRITER #endif +// Bearer Management +#if !defined(QT_NO_BEARERMANAGEMENT) && (defined(QT_NO_LIBRARY)) +#define QT_NO_BEARERMANAGEMENT +#endif + // Context menu #if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU)) #define QT_NO_CONTEXTMENU diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 00535562fb..ed173b1907 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1098,6 +1098,14 @@ Requires: TEMPORARYFILE Name: QNetworkDiskCache SeeAlso: ??? +Feature: BEARERMANAGEMENT +Description: Provides bearer management support +Section: Networking +Requires: LIBRARY +Name: Bearer Management +SeeAlso: ??? + + # Utilities Feature: COMPLETER diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 1fcfebbf38..f188bd569c 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 9bc15e5aad..4ce37a6af3 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 90afd2c325..d26956f387 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 c57c9c668d..771bc70034 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 1785685365..695842caf9 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 edd6889a75..fa7420f73b 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 c42e2d2e48..2f8624a0d0 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 fd4bf878b7..70aa5fa5a0 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 4509fd02bf..a5e8918e0b 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 36709c2743..9652f14297 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 6c6e28b800..102b347d77 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 79bb27cae5..3e44be1b11 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 b4d4c6b0da..a651dd1cba 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 4cb29e90cb..0649031459 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 638bee7e3e..1ed6cbb233 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 2911d0a1a0..e7fffac534 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 1a6159ae9a..c7b5718461 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 diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index ba85d9389d..ec1b689d8a 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -45,6 +45,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QGenericEnginePlugin : public QBearerEnginePlugin @@ -82,3 +84,5 @@ Q_EXPORT_STATIC_PLUGIN(QGenericEnginePlugin) Q_EXPORT_PLUGIN2(qgenericbearer, QGenericEnginePlugin) QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index d65025bb9c..41ff3e0b7c 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -64,6 +64,8 @@ #include <unistd.h> #endif +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE #ifndef QT_NO_NETWORKINTERFACE @@ -349,3 +351,4 @@ bool QGenericEngine::requiresPolling() const QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 616a3fd1d6..82d22af08b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -47,6 +47,8 @@ #include <QMap> #include <QTimer> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -89,5 +91,7 @@ private: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 740def3dab..6c30d0f052 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -44,6 +44,8 @@ #include <QtNetwork/private/qbearerengine_p.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngineImpl : public QBearerEngine @@ -78,4 +80,5 @@ Q_SIGNALS: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT #endif diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 33cce6922a..ef5f347d9e 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -49,6 +49,8 @@ #include <QtCore/qdebug.h> #include <QtCore/qmutex.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE static QBearerEngineImpl *getEngineFromId(const QString &id) @@ -439,3 +441,6 @@ void QNetworkSessionPrivateImpl::decrementTimeout() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT + diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index acf1ccec51..a4902eb860 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -60,6 +60,8 @@ #include <QtCore/qdatetime.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngineImpl; @@ -129,5 +131,7 @@ private: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSION_IMPL_H |