more information in cae of network error

master
Marc Wäckerlin 10 years ago
parent 0838a24b51
commit c9ec2b6122
  1. 25
      src/networkaccessmanager.hxx

@ -8,6 +8,7 @@
#define __NETWORKACCESS_MANAGER_HXX__ #define __NETWORKACCESS_MANAGER_HXX__
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkConfiguration> #include <QNetworkConfiguration>
#include <QNetworkProxy> #include <QNetworkProxy>
@ -180,7 +181,15 @@ class NetworkAccessManager: public QNetworkAccessManager {
case QNetworkAccessManager::CustomOperation: break; case QNetworkAccessManager::CustomOperation: break;
case QNetworkAccessManager::UnknownOperation: break; case QNetworkAccessManager::UnknownOperation: break;
} }
return QNetworkAccessManager::createRequest(op, req, outgoingData); QNetworkReply* reply
(QNetworkAccessManager::createRequest(op, req, outgoingData));
connect(reply, SIGNAL(encrypted()), SLOT(encryptedLog()));
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
SLOT(errorLog(QNetworkReply::NetworkError)));
connect(reply, SIGNAL(finished()), SLOT(finishedLog()));
connect(reply, SIGNAL(sslErrors(const QList<QSslError>&)),
SLOT(sslErrorsLog(const QList<QSslError>&)));
return reply;
} }
protected Q_SLOTS: protected Q_SLOTS:
QStringList supportedSchemesImplementation() const { QStringList supportedSchemesImplementation() const {
@ -188,12 +197,22 @@ class NetworkAccessManager: public QNetworkAccessManager {
return QNetworkAccessManager::supportedSchemesImplementation(); return QNetworkAccessManager::supportedSchemesImplementation();
} }
private Q_SLOTS: private Q_SLOTS:
void errorLog(QNetworkReply::NetworkError) {
log("**** Network Error: "
+ dynamic_cast<QNetworkReply*>(sender())->errorString());
}
void authenticationRequiredLog(QNetworkReply*, QAuthenticator*) { void authenticationRequiredLog(QNetworkReply*, QAuthenticator*) {
//log(__PRETTY_FUNCTION__); //log(__PRETTY_FUNCTION__);
} }
void encryptedLog() {
//log(__PRETTY_FUNCTION__);
}
void encryptedLog(QNetworkReply*) { void encryptedLog(QNetworkReply*) {
//log(__PRETTY_FUNCTION__); //log(__PRETTY_FUNCTION__);
} }
void finishedLog() {
//log(__PRETTY_FUNCTION__);
}
void finishedLog(QNetworkReply*) { void finishedLog(QNetworkReply*) {
//log(__PRETTY_FUNCTION__); //log(__PRETTY_FUNCTION__);
} }
@ -204,6 +223,10 @@ class NetworkAccessManager: public QNetworkAccessManager {
void proxyAuthenticationRequiredLog(const QNetworkProxy&, QAuthenticator*) { void proxyAuthenticationRequiredLog(const QNetworkProxy&, QAuthenticator*) {
//log(__PRETTY_FUNCTION__); //log(__PRETTY_FUNCTION__);
} }
void sslErrorsLog(const QList<QSslError>& errors) {
Q_FOREACH(const QSslError& error, errors)
log("**** SSL-Error: "+error.errorString());
}
void sslErrorsLog(QNetworkReply*, const QList<QSslError>&) { void sslErrorsLog(QNetworkReply*, const QList<QSslError>&) {
//log(__PRETTY_FUNCTION__); //log(__PRETTY_FUNCTION__);
} }

Loading…
Cancel
Save