32 #include "network-web/silentnetworkaccessmanager.h"
34 #include <QNetworkReply>
35 #include <QAuthenticator>
38 SilentNetworkAccessManager::SilentNetworkAccessManager(QObject *parent)
40 connect(
this, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
41 this, SLOT(onAuthenticationRequired(QNetworkReply*,QAuthenticator*)));
44 SilentNetworkAccessManager::~SilentNetworkAccessManager() {
45 qDebug(
"Destroying SilentNetworkAccessManages instance.");
48 void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply *reply,
49 QAuthenticator *authenticator) {
50 QObject *originating_object = reply->request().originatingObject();
52 if (originating_object->property(
"protected").toBool()) {
54 authenticator->setUser(originating_object->property(
"username").toString());
55 authenticator->setPassword(originating_object->property(
"password").toString());
57 qDebug(
"Feed '%s' requested authentication and got it.",
58 qPrintable(reply->url().toString()));
60 reply->setProperty(
"authentication-given",
true);
64 qDebug(
"Feed '%s' requested authentication but username/password is not available.",
65 qPrintable(reply->url().toString()));
67 reply->setProperty(
"authentication-given",
false);
Base class for all network access managers.