summaryrefslogtreecommitdiff
path: root/src/protocolhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/protocolhandler.cpp')
-rw-r--r--src/protocolhandler.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index be236843..23743acf 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -49,6 +49,8 @@
#include <KProcess>
#include <KStandardDirs>
#include <KToolInvocation>
+#include <KProtocolInfo>
+#include <KRun>
// Qt Includes
#include <QtNetwork/QNetworkRequest>
@@ -74,10 +76,14 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
_url = request.url();
_frame = frame;
- // "http(s)" (fast) handling
- if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https"))
+ // rekonq can handle http/s browsing easily
+ if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https") || _url.protocol() == QL1S("file"))
return false;
+ // rekonq can handle file & ftp schemes, if you like,,
+ if (_url.protocol() == QL1S("ftp") || _url.protocol() == QL1S("file"))
+ return false;
+
// relative urls
if (_url.isRelative())
return false;
@@ -104,28 +110,8 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
return true;
}
- // "mailto" handling
- if (_url.protocol() == QL1S("mailto"))
- {
- KToolInvocation::invokeMailer(_url);
- return true;
- }
-
- // "apturl" handling
- if (_url.protocol() == QL1S ("apt"))
- {
- //Declare apturl as QString
- QString apturl="apturl";
- //We need to convert the url to QStringList to pass as a argument to apturl
- QStringList host;
- host << _url.url();
-
- if ( KProcess::execute (apturl,host)==0)
- return true;
- else
- return false;
-
- }
+ // NOTE
+ // handle here "custom" rekonq protocols
// "abp" handling
if (_url.protocol() == QL1S("abp"))
@@ -172,6 +158,22 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
return true;
}
+ //If rekonq cant handle a protocol by itself, it will hand it over to KDE via KRun
+ if(KProtocolInfo::isKnownProtocol(_url))
+ {
+ new KRun(_url, Application::instance()->mainWindow());
+ return true; //No need to delete KRun, it autodeletes itself
+ }
+ else
+ {
+ //Error Message, for those protocols even KDE cant handle
+ KMessageBox::error( Application::instance()->mainWindow(), i18nc("@info",
+ "rekonq can not handle this URL. \
+ Please use an appropriate application to open it."));
+ return false;
+ }
+
+
return false;
}