From 6ddb1b2a0fb39c758c975652b242bbfa8feaea57 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sat, 16 Mar 2013 15:07:54 +0100 Subject: Support "open in webapp" && "install webapp" links And now... :D --- src/webtab/protocolhandler.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/webtab/protocolhandler.cpp') diff --git a/src/webtab/protocolhandler.cpp b/src/webtab/protocolhandler.cpp index e9f6a77c..4b456112 100644 --- a/src/webtab/protocolhandler.cpp +++ b/src/webtab/protocolhandler.cpp @@ -31,7 +31,10 @@ #include "rekonq.h" // Local Includes +#include "application.h" + #include "historymanager.h" + #include "webpage.h" #include "webtab.h" #include "urlbar.h" @@ -142,6 +145,26 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra return false; } + kDebug() << "FN: " << _url.fileName(); + kDebug() << "DIR: " << _url.directory(); + + if (_url.directory() == QL1S("webapp")) + { + if (_url.fileName() == QL1S("launch")) + { + QString value = _url.queryItemValue(QL1S("url")); + rApp->loadUrl(KUrl(value), Rekonq::WebApp); + return true; + } + if (_url.fileName() == QL1S("install")) + { + QString urlValue = _url.queryItemValue(QL1S("url")); + QString titleValue = _url.queryItemValue(QL1S("title")); + rApp->createWebAppShortcut(urlValue, titleValue); + return true; + } + } + if (encodedUrl == QByteArray("about:home")) { switch (ReKonfig::newTabStartPage()) -- cgit v1.2.1