[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Bkwebkitpart=5D_src=3A_Do_not_show_error_page_when_t?=
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2011-02-01 0:02:39
Message-ID: 20110201000239.708E9A60BE () git ! kde ! org
[Download RAW message or body]

Git commit 8471115cad9f9c410c5d1fc762de6a0a5822431a by Dawit Alemayehu.
Pushed by adawit into branch 'master'.

Do not show error page when the request was blocked by adblock filter.
Other minor code cleanup.

M  +30   -16   src/webpage.cpp     

http://commits.kde.org/kwebkitpart/8471115cad9f9c410c5d1fc762de6a0a5822431a

diff --git a/src/webpage.cpp b/src/webpage.cpp
index 2f00797..552bd87 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -243,24 +243,32 @@ QString WebPage::errorPage(int code, const QString& text, const \
KUrl& reqUrl) co  
 bool WebPage::extension(Extension extension, const ExtensionOption *option, \
ExtensionReturn *output)  {
-    if (extension == QWebPage::ErrorPageExtension && !m_ignoreError) {
-        const QWebPage::ErrorPageExtensionOption *extOption = static_cast<const \
                QWebPage::ErrorPageExtensionOption*>(option);
-        //kDebug() << extOption->domain << extOption->error << \
                extOption->errorString;
-        if (extOption->domain == QWebPage::QtNetwork) {
-            QWebPage::ErrorPageExtensionReturn *extOutput = \
                static_cast<QWebPage::ErrorPageExtensionReturn*>(output);
-            extOutput->content = errorPage(m_kioErrorCode, extOption->errorString, \
                extOption->url).toUtf8();
-            extOutput->baseUrl = extOption->url;
-            return true;
+    switch (extension) {
+    case QWebPage::ErrorPageExtension: {
+        if (!m_ignoreError) {
+            const QWebPage::ErrorPageExtensionOption *extOption = static_cast<const \
QWebPage::ErrorPageExtensionOption*>(option); +            //kDebug() << \
extOption->domain << extOption->error << extOption->errorString; +            if \
(extOption->domain == QWebPage::QtNetwork) { +                \
QWebPage::ErrorPageExtensionReturn *extOutput = \
static_cast<QWebPage::ErrorPageExtensionReturn*>(output); +                \
extOutput->content = errorPage(m_kioErrorCode, extOption->errorString, \
extOption->url).toUtf8(); +                extOutput->baseUrl = extOption->url;
+                return true;
+            }
         }
+        break;
     }
-
-    if (extension == QWebPage::ChooseMultipleFilesExtension) {
+    case QWebPage::ChooseMultipleFilesExtension: {
         const QWebPage::ChooseMultipleFilesExtensionOption* extOption = \
                static_cast<const QWebPage::ChooseMultipleFilesExtensionOption*> \
                (option);
         QWebPage::ChooseMultipleFilesExtensionReturn *extOutput = \
                static_cast<QWebPage::ChooseMultipleFilesExtensionReturn*>(output);
-        if (currentFrame() == extOption->parentFrame)
+        if (currentFrame() == extOption->parentFrame) {
             extOutput->fileNames = \
                KFileDialog::getOpenFileNames(KUrl(extOption->suggestedFileNames.first()),
                
                                                                  QString(), view(), \
                i18n("Choose files to upload"));
-        return true;
+            return true;
+        }
+        break;
+    }
+    default:
+        break;
     }
 
     return KWebPage::extension(extension, option, output);
@@ -268,10 +276,16 @@ bool WebPage::extension(Extension extension, const \
ExtensionOption *option, Exte  
 bool WebPage::supportsExtension(Extension extension) const
 {
-    //kDebug() << extension;
-    if (extension == QWebPage::ErrorPageExtension ||
-        extension == QWebPage::ChooseMultipleFilesExtension)
+    kDebug() << extension;
+
+    switch (extension) {
+    case QWebPage::ErrorPageExtension:
+        return m_ignoreError;
+    case QWebPage::ChooseMultipleFilesExtension:
         return true;
+    default:
+        break;
+    }
 
     return KWebPage::supportsExtension(extension);
 }
@@ -487,7 +501,7 @@ void WebPage::slotRequestFinished(QNetworkReply *reply)
             if (isMainFrameRequest)
                 emit saveFrameStateRequested(frame, 0);
 
-            m_ignoreError = false;
+            m_ignoreError = (reply->attribute(QNetworkRequest::User).toInt() == \
QNetworkReply::ContentAccessDenied);  m_kioErrorCode = errCode;
             break;
     }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic