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

List:       kde-commits
Subject:    =?utf-8?q?=5Bkde-baseapps=5D_konqueror/src=3A_Show_proper_error_?=
From:       Dawit Alemayehu <adawit () kde ! org>
Date:       2011-06-16 16:44:49
Message-ID: 20110616164449.A8F10A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 02edd1c5ad0286006ec2f457ec26697068f14444 by Dawit Alemayehu.
Committed on 10/06/2011 at 17:05.
Pushed by adawit into branch 'master'.

Show proper error message when a malformed url is entered, e.g. www.kde,org.
Avoid converting a error url into another error url.

BUG: 218501
FIXED-IN: 4.6.5

(cherry picked from commit 69de0ca6475e8523c2b7de5bdd2471b68024912a)

M  +11   -8    konqueror/src/konqmainwindow.cpp     
M  +6    -2    konqueror/src/konqmisc.cpp     

http://commits.kde.org/kde-baseapps/02edd1c5ad0286006ec2f457ec26697068f14444

diff --git a/konqueror/src/konqmainwindow.cpp b/konqueror/src/konqmainwindow.cpp
index 1ca09ba..10ba53b 100644
--- a/konqueror/src/konqmainwindow.cpp
+++ b/konqueror/src/konqmainwindow.cpp
@@ -525,15 +525,18 @@ void KonqMainWindow::openUrl(KonqView *_view, const KUrl &_url,
     if (mimeType.isEmpty())
         mimeType = req.args.mimeType();
 
-    if (!url.isValid()) {
-        // I think we can't really get here anymore; I tried and didn't succeed.
-        // URL filtering catches this case before hand, and in cases without \
                filtering
-        // (e.g. HTML link), the url is empty here, not invalid.
-        // But just to be safe, let's keep this code path, even if it can't show the \
                typed string.
-        url = KParts::BrowserRun::makeErrorUrl(KIO::ERR_MALFORMED_URL, url.url() \
                /*empty*/, url.url() /*empty*/);
-    } else if (!KProtocolInfo::isKnownProtocol(url)) {
-        url = KParts::BrowserRun::makeErrorUrl(KIO::ERR_UNSUPPORTED_PROTOCOL, \
url.protocol(), url.url()); +    if (url.protocol() != QLatin1String("error")) {
+        if (!url.isValid()) {
+            // I think we can't really get here anymore; I tried and didn't succeed.
+            // URL filtering catches this case before hand, and in cases without \
filtering +            // (e.g. HTML link), the url is empty here, not invalid.
+            // But just to be safe, let's keep this code path, even if it can't show \
the typed string. +            url = \
KParts::BrowserRun::makeErrorUrl(KIO::ERR_MALFORMED_URL, url.url() /*empty*/, \
url.url() /*empty*/); +        } else if (!KProtocolInfo::isKnownProtocol(url)) {
+            url = KParts::BrowserRun::makeErrorUrl(KIO::ERR_UNSUPPORTED_PROTOCOL, \
url.protocol(), url.url()); +        }
     }
+
     if (url.url() == "about:blank" || url.protocol() == "error") {
         mimeType = "text/html";
     }
diff --git a/konqueror/src/konqmisc.cpp b/konqueror/src/konqmisc.cpp
index 8a0543e..c46dc07 100644
--- a/konqueror/src/konqmisc.cpp
+++ b/konqueror/src/konqmisc.cpp
@@ -194,8 +194,12 @@ KUrl KonqMisc::konqFilteredURL(KonqMainWindow* parent, const \
QString& _url, cons  
     if( KUriFilter::self()->filterUri( data ) )
     {
-      if( data.uriType() == KUriFilterData::Error && !data.errorMsg().isEmpty() ) {
-        return KParts::BrowserRun::makeErrorUrl(KIO::ERR_SLAVE_DEFINED, \
data.errorMsg(), _url); +      if( data.uriType() == KUriFilterData::Error ) {
+        if (data.errorMsg().isEmpty()) {
+          return KParts::BrowserRun::makeErrorUrl(KIO::ERR_MALFORMED_URL, _url, \
_url); +        } else {
+          return KParts::BrowserRun::makeErrorUrl(KIO::ERR_SLAVE_DEFINED, \
data.errorMsg(), _url); +        }
       } else {
         return data.uri();
       }


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

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