summaryrefslogtreecommitdiff
path: root/src/webpage.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-03-03 12:09:10 +0100
committerAndrea Diamantini <adjam7@gmail.com>2011-03-03 12:09:10 +0100
commit7c30852c517a16cfdb7fa5759ce725258ad1e754 (patch)
tree4dbee91a9ddaa52cb69ff1ce774e42e7c840550e /src/webpage.cpp
parentRevert back commit for bug 267460, we need to reparent the GUI objects depend... (diff)
parentClean up the "rekonq handling chain" to work as: (diff)
downloadrekonq-7c30852c517a16cfdb7fa5759ce725258ad1e754.tar.xz
Merge branch 'Fixes'
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r--src/webpage.cpp28
1 files changed, 10 insertions, 18 deletions
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)