diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-03-03 12:09:10 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-03-03 12:09:10 +0100 |
commit | 7c30852c517a16cfdb7fa5759ce725258ad1e754 (patch) | |
tree | 4dbee91a9ddaa52cb69ff1ce774e42e7c840550e /src | |
parent | Revert back commit for bug 267460, we need to reparent the GUI objects depend... (diff) | |
parent | Clean up the "rekonq handling chain" to work as: (diff) | |
download | rekonq-7c30852c517a16cfdb7fa5759ce725258ad1e754.tar.xz |
Merge branch 'Fixes'
Diffstat (limited to 'src')
-rw-r--r-- | src/protocolhandler.cpp | 36 | ||||
-rw-r--r-- | src/webpage.cpp | 28 |
2 files changed, 18 insertions, 46 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 2c5f2ada..36efe2a7 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -101,22 +101,6 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra _url = request.url(); _frame = frame; - // rekonq can handle http/s browsing easily - if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https")) - return false; - - // rekonq can handle file & ftp schemes, if you like,, - if (_url.protocol() == QL1S("ftp") || _url.protocol() == QL1S("file")) - return false; - - // rekonq can handle kde documentation protocol - if (_url.protocol() == QL1S("man") || _url.protocol() == QL1S("help") || _url.protocol() == QL1S("info")) - return false; - - // relative urls - if (_url.isRelative()) - return false; - // javascript handling if (_url.protocol() == QL1S("javascript")) { @@ -140,9 +124,6 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra return true; } - // NOTE - // handle here "custom" rekonq protocols - // "abp" handling if (_url.protocol() == QL1S("abp")) { @@ -192,18 +173,17 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra return true; } - // If rekonq cannot handle a protocol by itself, it will hand it over to KDE via KRun + // let webkit try to load a known (or missing) protocol... if (KProtocolInfo::isKnownProtocol(_url)) - { - new KRun(_url, rApp->mainWindow()); // No need to delete KRun, it autodeletes itself - return true; - } - - // Error Message, for those protocols even KDE cannot handle + return false; + + // Error Message, for those protocols we cannot handle + // FIXME change this sentence AFTER STRING FREEZE to: "rekonq doesn't know how to handle this protocol: _url.protocol()" KMessageBox::error(rApp->mainWindow(), i18nc("@info", "rekonq cannot handle this URL. \ - Please use an appropriate application to open it.")); - return false; + Please use an appropriate application to open it.")); + + return true; } diff --git a/src/webpage.cpp b/src/webpage.cpp index 036e9db1..cc89a57d 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -66,6 +66,8 @@ #include <KService> #include <KToolInvocation> #include <KWebWallet> +#include <KProtocolInfo> +#include <KRun> #include <kparts/browseropenorsavequestion.h> @@ -403,6 +405,14 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) // get reply url... KUrl replyUrl = reply->url(); + bool isLocal = replyUrl.isLocalFile(); + if(isLocal && KProtocolInfo::isKnownProtocol(replyUrl)) + { + kDebug() << "WARNING: launching a new app..."; + new KRun(replyUrl, rApp->mainWindow()); // No need to delete KRun, it autodeletes itself + return; + } + // Get suggested file name... extractSuggestedFileName(reply, _suggestedFileName); @@ -419,8 +429,6 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) KService::Ptr appService = KMimeTypeTrader::self()->preferredService(_mimeType); - bool isLocal = replyUrl.isLocalFile(); - if (appService.isNull()) // no service can handle this. We can just download it.. { kDebug() << "no service can handle this. We can just download it.."; @@ -471,22 +479,6 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) return; } - // HACK: The check below is necessary to break an infinite - // recursion that occurs whenever this function is called as a result - // of receiving content that can be rendered by the app using this engine. - // For example a text/html header that containing a content-disposition - // header is received by the app using this class. - const QString& appName = QCoreApplication::applicationName(); - - if (appName == appService->desktopEntryName() || appService->exec().trimmed().startsWith(appName)) - { - kDebug() << "SELF..."; - QNetworkRequest req(reply->request()); - req.setRawHeader("x-kdewebkit-ignore-disposition", "true"); - currentFrame()->load(req); - return; - } - // case KParts::BrowserRun::Embed KParts::ReadOnlyPart *pa = KMimeTypeTrader::createPartInstanceFromQuery<KParts::ReadOnlyPart>(_mimeType, view(), this, QString()); if (pa) |