[developerteam getadooble] SF.net SVN: dooble:[1256] trunk/browser/Source/dwebpage.cc
Brought to you by:
textfield
From: <tex...@us...> - 2010-04-25 01:23:43
|
Revision: 1256 http://dooble.svn.sourceforge.net/dooble/?rev=1256&view=rev Author: textfield Date: 2010-04-25 01:23:37 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Ease of reading. Modified Paths: -------------- trunk/browser/Source/dwebpage.cc Modified: trunk/browser/Source/dwebpage.cc =================================================================== --- trunk/browser/Source/dwebpage.cc 2010-04-19 23:00:31 UTC (rev 1255) +++ trunk/browser/Source/dwebpage.cc 2010-04-25 01:23:37 UTC (rev 1256) @@ -1,7 +1,7 @@ /**************************************************************************** ** Dooble - The Secure Internet Web Browser ** -** Copyright (c) 2008, 2009 Ronald Landheer-Cieslak, +** Copyright (c) 2008, 2009, 2010 Ronald Landheer-Cieslak, ** Gunther van Dooble, and the Dooble Team. ** All rights reserved. ** @@ -67,7 +67,7 @@ void dwebpage::handleUnsupportedContent(QNetworkReply *reply) { - if (!reply) return; // silent failure if no reply + if(!reply) return; // Silent failure, if no reply. bool show_error_page(false); bool emit_error_signal(false); @@ -78,25 +78,42 @@ switch (error) { - case QNetworkReply::NoError : // no error condition + case QNetworkReply::NoError: // No error condition. break; - case QNetworkReply::ConnectionRefusedError : // the remote server refused the connection (the server is not accepting requests) + case QNetworkReply::ConnectionRefusedError: /* + ** The remote server + ** refused the connection + ** (the server is not + ** accepting requests). + */ show_error_page = true; emit_error_signal = true; title_string = "Connection Error"; - message_string = "The remote server refused the connection (the server is not accepting requests)."; + message_string = "The remote server refused the connection " + "(the server is not accepting requests)."; break; - case QNetworkReply::RemoteHostClosedError : // the remote server closed the connection prematurely, before the entire reply was received and processed + case QNetworkReply::RemoteHostClosedError: /* + ** The remote server + ** closed the connection + ** prematurely, before the + ** entire reply was received + ** and processed. + */ show_error_page = true; emit_error_signal = true; title_string = "Server Error"; - message_string = "The remote server closed the connection prematurely, before the entire reply was received and processed."; + message_string = "The remote server closed the connection " + "prematurely, before the entire reply was received and processed."; break; - case QNetworkReply::HostNotFoundError : // the remote host name was not found (invalid hostname) + case QNetworkReply::HostNotFoundError: /* + ** The remote host name was + ** not found (invalid hostname). + */ show_error_page = true; emit_error_signal = true; title_string = "Connection Error"; - message_string = "The remote host name was not found (invalid hostname)."; + message_string = "The remote host name was not found " + "(invalid hostname)."; break; case QNetworkReply::TimeoutError : // the connection to the remote server timed out show_error_page = true; @@ -214,7 +231,7 @@ break; } - if (show_error_page && !never_show_error_page_) + if(show_error_page && !never_show_error_page_) { QFile file(QLatin1String(":/NavigationError.html")); bool is_opened = file.open(QIODevice::ReadOnly); @@ -229,10 +246,12 @@ QList<QWebFrame*> frames; frames.append(mainFrame()); bool shown(false); - while (!frames.isEmpty() && !shown) + + while(!frames.isEmpty() && !shown) { QWebFrame *frame = frames.takeFirst(); - if (frame->url() == reply->url()) + + if(frame->url() == reply->url()) { frame->setHtml(html, reply->url()); shown = true; @@ -240,25 +259,36 @@ else { QList<QWebFrame *> children = frame->childFrames(); + foreach(QWebFrame *frame, children) frames.append(frame); } } - if (!shown) + + if(!shown) + mainFrame()->setHtml(html, reply->url()); + else { - mainFrame()->setHtml(html, reply->url()); + /* + ** Already shown, or don't show here. + */ } - else - { /* already shown, or don't show here */ } - } else - { /* either not an error or don't show it */ } + { + /* + ** Either not an error or don't show it. + */ + } - if (emit_error_signal && !never_emit_error_signal_) + if(emit_error_signal && !never_emit_error_signal_) emit networkError(error); else - { /* don't emit any signals */ } + { + /* + ** Don't emit any signals. + */ + } } QWebPage *dwebpage::createWindow(WebWindowType type) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |