From 7faab870fa5a17c669f4def25479ce24b18520c3 Mon Sep 17 00:00:00 2001 From: Michael Neves Date: Mon, 30 Jan 2012 20:31:15 +0100 Subject: Added HTTP Error Handling --- src/fbgui/fbgui.cpp | 17 ++++++++++++++++- src/fbgui/fbgui.h | 6 ++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'src/fbgui') diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp index 4c4a833..fcc652c 100644 --- a/src/fbgui/fbgui.cpp +++ b/src/fbgui/fbgui.cpp @@ -245,6 +245,12 @@ void fbgui::loadURL() { QByteArray postData = generatePOSTData(); QNetworkRequest req(baseURL); + //Connect webViews NetworkAccessManager to SSLErrorHandler SLOT + QObject::connect(_webView->page()->networkAccessManager(), + SIGNAL(finished(QNetworkReply*)), + this, + SLOT(errorHandler(QNetworkReply*))); + //Connect webViews NetworkAccessManager to ErrorHandler SLOT QObject::connect(_webView->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList & )), @@ -272,7 +278,7 @@ void fbgui::loadURLDone(bool success) { } -//Handles SSL Errors +//Handles QNetworkReply SSL Errors void fbgui::sslErrorHandler(QNetworkReply* reply, const QList & errlist) { @@ -282,6 +288,15 @@ void fbgui::sslErrorHandler(QNetworkReply* reply, const QList & errli reply->ignoreSslErrors(); } +//Handles QNetworkReply Errors +void fbgui::errorHandler(QNetworkReply* reply) +{ + + LOG4CXX_DEBUG(coreLogger, "HTTP Error: " << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()); + + +} + //------------------------------------------------------------------------------------------- /** diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h index a13fe74..04aa38b 100644 --- a/src/fbgui/fbgui.h +++ b/src/fbgui/fbgui.h @@ -116,9 +116,11 @@ private slots: void prepareURLLoad(const QString&); void loadURLDone(bool success); - //ssl Error Handler for SSL Requests - void sslErrorHandler(QNetworkReply* qnr, const QList & errlist); + //SSL Error Handler for SSL Requests + void sslErrorHandler(QNetworkReply* reply, const QList & errlist); + //Error Handler for http Requests + void errorHandler(QNetworkReply* reply); // shut off the system void performShutDown(); -- cgit v1.2.3-55-g7522