diff options
author | Michael Neves | 2012-01-30 19:34:43 +0100 |
---|---|---|
committer | Michael Neves | 2012-01-30 19:34:43 +0100 |
commit | fa5c7c872b06fe87005e6a8e18d1d10f16ca2554 (patch) | |
tree | fb7f660ad5c4731668889c37e2e6f8103645594a /src/fbgui | |
parent | Change pbs_url to https if ssl is enabled (diff) | |
download | fbgui-fa5c7c872b06fe87005e6a8e18d1d10f16ca2554.tar.gz fbgui-fa5c7c872b06fe87005e6a8e18d1d10f16ca2554.tar.xz fbgui-fa5c7c872b06fe87005e6a8e18d1d10f16ca2554.zip |
Added SSL ErrorHandler for QWebViews NetworkAccessManager
Diffstat (limited to 'src/fbgui')
-rw-r--r-- | src/fbgui/fbgui.cpp | 20 | ||||
-rw-r--r-- | src/fbgui/fbgui.h | 4 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp index b37e018..4c4a833 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 ErrorHandler SLOT + QObject::connect(_webView->page()->networkAccessManager(), + SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )), + this, + SLOT(sslErrorHandler(QNetworkReply*, const QList<QSslError> & ))); + // show cursor again since user is about to interact. //QWSServer::instance()->setCursorVisible(true); //TODO: ?enabled in original req.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); @@ -253,6 +259,7 @@ void fbgui::loadURL() { } // TODO: error page if no host. } + void fbgui::loadURLDone(bool success) { // done contains the success of the loading: false / true if (!success) { @@ -263,6 +270,19 @@ void fbgui::loadURLDone(bool success) { LOG4CXX_DEBUG(coreLogger, "Loaded URL: " << _webView->url().toString()); } } + + +//Handles SSL Errors +void fbgui::sslErrorHandler(QNetworkReply* reply, const QList<QSslError> & errlist) +{ + + foreach (QSslError err, errlist) + LOG4CXX_DEBUG(coreLogger, "SSL Error: " << err.errorString()); + + reply->ignoreSslErrors(); +} + + //------------------------------------------------------------------------------------------- /** * This method generates the POST data body. diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h index 3a62579..a13fe74 100644 --- a/src/fbgui/fbgui.h +++ b/src/fbgui/fbgui.h @@ -116,6 +116,10 @@ private slots: void prepareURLLoad(const QString&); void loadURLDone(bool success); + //ssl Error Handler for SSL Requests + void sslErrorHandler(QNetworkReply* qnr, const QList<QSslError> & errlist); + + // shut off the system void performShutDown(); // reboot the system |