diff options
author | Andres Salomon <dilinger@queued.net> | 2021-01-18 04:00:14 -0500 |
---|---|---|
committer | Andres Salomon <dilinger@queued.net> | 2021-01-18 04:00:14 -0500 |
commit | 09eb39236666e81d5da014acea011dcd74d0999b (patch) | |
tree | 52876d96be71be1a39d5d935c1295a51995e8949 /lib/networkaccessmanager.cpp | |
parent | f1788ee27f33e9339334e0d79bde9a27d9ce2e44 (diff) | |
parent | a4e78956f105875625b572d8b98459ffa86fafe5 (diff) | |
download | libquotient-09eb39236666e81d5da014acea011dcd74d0999b.tar.gz libquotient-09eb39236666e81d5da014acea011dcd74d0999b.zip |
Update upstream source from tag 'upstream/0.6.4'
Update to upstream version '0.6.4'
with Debian dir aa8705fd74743e79c043bc9e3e425d5064404cfe
Diffstat (limited to 'lib/networkaccessmanager.cpp')
-rw-r--r-- | lib/networkaccessmanager.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/lib/networkaccessmanager.cpp b/lib/networkaccessmanager.cpp index 7d9cb360..e8aa85df 100644 --- a/lib/networkaccessmanager.cpp +++ b/lib/networkaccessmanager.cpp @@ -13,25 +13,24 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "networkaccessmanager.h" -#include <QtNetwork/QNetworkReply> #include <QtCore/QCoreApplication> +#include <QtNetwork/QNetworkReply> -using namespace QMatrixClient; +using namespace Quotient; -class NetworkAccessManager::Private -{ - public: - QList<QSslError> ignoredSslErrors; +class NetworkAccessManager::Private { +public: + QList<QSslError> ignoredSslErrors; }; NetworkAccessManager::NetworkAccessManager(QObject* parent) : QNetworkAccessManager(parent), d(std::make_unique<Private>()) -{ } +{} QList<QSslError> NetworkAccessManager::ignoredSslErrors() const { @@ -51,10 +50,13 @@ void NetworkAccessManager::clearIgnoredSslErrors() static NetworkAccessManager* createNam() { auto nam = new NetworkAccessManager(QCoreApplication::instance()); - // See #109. Once Qt bearer management gets better, this workaround - // should become unnecessary. - nam->connect(nam, &QNetworkAccessManager::networkAccessibleChanged, - [nam] { nam->setNetworkAccessible(QNetworkAccessManager::Accessible); }); +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + // See #109; in newer Qt, bearer management is deprecated altogether + NetworkAccessManager::connect(nam, + &QNetworkAccessManager::networkAccessibleChanged, [nam] { + nam->setNetworkAccessible(QNetworkAccessManager::Accessible); + }); +#endif return nam; } @@ -66,11 +68,10 @@ NetworkAccessManager* NetworkAccessManager::instance() NetworkAccessManager::~NetworkAccessManager() = default; -QNetworkReply* NetworkAccessManager::createRequest(Operation op, - const QNetworkRequest& request, QIODevice* outgoingData) +QNetworkReply* NetworkAccessManager::createRequest( + Operation op, const QNetworkRequest& request, QIODevice* outgoingData) { - auto reply = - QNetworkAccessManager::createRequest(op, request, outgoingData); + auto reply = QNetworkAccessManager::createRequest(op, request, outgoingData); reply->ignoreSslErrors(d->ignoredSslErrors); return reply; } |