diff options
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkaccessbackend.cpp | 19 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessbackend_p.h | 2 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager.cpp | 22 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager.h | 3 | ||||
-rw-r--r-- | src/network/access/qnetworkaccessmanager_p.h | 6 |
5 files changed, 49 insertions, 3 deletions
diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 54d9dbd..c712fff 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -363,12 +363,31 @@ void QNetworkAccessBackend::start() qDebug() << "Open session if required"; if (!manager->session->isOpen()) manager->session->open(); + else + sessionOpened(); } void QNetworkAccessBackend::sessionOpened() { + manager->sendDebugMessage(QLatin1String("Session opened")); qDebug() << "Session opened, calling open()"; open(); } +void QNetworkAccessBackend::preferredConfigurationChanged(const QNetworkConfiguration &config, + bool isSeamless) +{ + QString message = QString::fromLatin1("preferredConfiguirationChanged %1 %2") + .arg(config.name()) .arg(isSeamless); + + manager->sendDebugMessage(message); + manager->session->ignore(); +} + +void QNetworkAccessBackend::newConfigurationActivated() +{ + manager->sendDebugMessage(QLatin1String("newConfigurationActivated")); + manager->session->reject(); +} + QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 04cc5b0..62ac736 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -189,6 +189,8 @@ protected slots: private slots: void sessionOpened(); + void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); + void newConfigurationActivated(); private: friend class QNetworkAccessManager; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 38ab1c6..b8edefa 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -349,8 +349,8 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent) { ensureInitialized(); - d_func()->session = - new QNetworkSession(QNetworkConfigurationManager().defaultConfiguration(), this); + QNetworkConfigurationManager manager; + d_func()->session = new QNetworkSession(manager.defaultConfiguration(), this); } /*! @@ -672,7 +672,7 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ /*! \since 4.7 - Sets the network configuration that will be used to \a config. + Sets the network configuration that will be used when creating a network session to \a config. \sa configuration() */ @@ -695,6 +695,22 @@ QNetworkConfiguration QNetworkAccessManager::configuration() const } /*! + \since 4.7 + + Returns the current active network configuration. + + \sa configuration() +*/ +QNetworkConfiguration QNetworkAccessManager::activeConfiguration() const +{ + QNetworkConfigurationManager manager; + + return manager.configurationFromIdentifier( + d_func()->session->sessionProperty(QLatin1String("ActiveConfiguration")).toString()); + +} + +/*! Returns a new QNetworkReply object to handle the operation \a op and request \a req. The device \a outgoingData is always 0 for Get and Head requests, but is the value passed to post() and put() in diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index 8e1c3b6..82bbd03 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -106,6 +106,7 @@ public: void setConfiguration(const QNetworkConfiguration &config); QNetworkConfiguration configuration() const; + QNetworkConfiguration activeConfiguration() const; Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY @@ -117,6 +118,8 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); #endif + void debugMessage(const QString &message); + protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData = 0); diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 4eeff4b..b6a266c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -101,6 +101,12 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); + void sendDebugMessage(const QString &message) + { + Q_Q(QNetworkAccessManager); + emit q->debugMessage(message); + } + // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; |