From b570fd3c4e56c05d65e21c18c441153bfbe756f4 Mon Sep 17 00:00:00 2001 From: megabigbug Date: Thu, 30 Jul 2009 13:55:22 +0200 Subject: fix Webshortcuts, works with space and colon delimiter --- src/application.cpp | 27 ++++++++++++--------------- src/webview.cpp | 4 ++-- 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index ff52d935..60205772 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -262,27 +262,25 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) KToolInvocation::invokeMailer(url); return; } - - KUrl loadingUrl(url); - if (loadingUrl.isRelative()) + KUrl loadingUrl(url); + if (loadingUrl.isRelative() && loadingUrl.path().contains(".")) { QString fn = loadingUrl.url(KUrl::RemoveTrailingSlash); - if(loadingUrl.path().contains('.')) - { - loadingUrl.setUrl("//" + fn); - loadingUrl.setScheme("http"); - } - else + loadingUrl.setUrl("//" + fn); + loadingUrl.setScheme("http"); + } + else if(loadingUrl.scheme()!="http") + { + // this should let rekonq to support the beautiful KDE web browsing shortcuts + KUriFilterData data(loadingUrl.pathOrUrl()); + data.setCheckForExecutables (false); //if true, querries like "rekonq" or "dolphin" are considered as executables + if (KUriFilter::self()->filterUri(data)) { - loadingUrl.setUrl(fn); - loadingUrl.setScheme("gg"); + loadingUrl = data.uri().url(); } } - // this should let rekonq to support the beautiful KDE web browsing shortcuts - loadingUrl = KUriFilter::self()->filteredUri(loadingUrl); - WebView *webView; switch(type) @@ -310,7 +308,6 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type) } } - void Application::loadUrl(const QString& urlString, const Rekonq::OpenType& type) { return loadUrl( guessUrlFromString(urlString), type ); diff --git a/src/webview.cpp b/src/webview.cpp index a8a45077..51874627 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -164,7 +164,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) QStringList favoriteEngines; favoriteEngines << "wikipedia" << "google"; //defaults favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines); - const char keywordDelimiter = cg.readEntry("KeywordDelimiter", static_cast(':')); + QString keywordDelimiter = cg.readEntry("KeywordDelimiter", ":"); KService::Ptr service; KUriFilterData data; foreach (QString engine, favoriteEngines) @@ -208,7 +208,7 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) QStringList favoriteEngines; favoriteEngines << "wikipedia" << "google"; //defaults favoriteEngines = cg.readEntry("FavoriteSearchEngines", favoriteEngines); - const char keywordDelimiter = cg.readEntry("KeywordDelimiter", static_cast(':')); + QString keywordDelimiter = cg.readEntry("KeywordDelimiter", ":"); KService::Ptr service; KUriFilterData data; foreach (QString engine, favoriteEngines) -- cgit v1.2.1