summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/application.cpp45
-rw-r--r--src/rekonq.kcfg4
-rw-r--r--src/webview.cpp4
3 files changed, 32 insertions, 21 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 565c6ab3..6cfdf03c 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -46,6 +46,8 @@
#include <KPassivePopup>
#include <KToolInvocation>
#include <KUriFilter>
+#include <KMessageBox>
+#include <KProtocolInfo>
// Qt Includes
#include <QRegExp>
@@ -257,31 +259,41 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
if (url.isEmpty())
return;
+ if ( !url.isValid() )
+ {
+ KMessageBox::error(0, i18n("Malformed URL\n%1", url.url()));
+ return;
+ }
+
if (url.scheme() == QLatin1String("mailto"))
{
KToolInvocation::invokeMailer(url);
return;
}
-
+
KUrl loadingUrl(url);
- if (loadingUrl.isRelative())
+ // this should let rekonq filtering URI info and supporting
+ // the beautiful KDE web browsing shortcuts
+ KUriFilterData data(loadingUrl.pathOrUrl());
+ data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin"
+ // are considered as executables
+ if (KUriFilter::self()->filterUri(data))
{
- QString fn = loadingUrl.url(KUrl::RemoveTrailingSlash);
- if(loadingUrl.path().contains('.'))
- {
- loadingUrl.setUrl("//" + fn);
- loadingUrl.setScheme("http");
- }
- else
- {
- loadingUrl.setUrl(fn);
- loadingUrl.setScheme("gg");
- }
+ loadingUrl = data.uri().url();
+ }
+
+ if (loadingUrl.isRelative() && !loadingUrl.path().contains("."))
+ {
+ QString urlString = QString("http://www.google.com/search?q=%1").arg(loadingUrl.path());
+ loadingUrl = KUrl(urlString);
+ }
+
+ if ( !KProtocolInfo::isKnownProtocol( loadingUrl ) )
+ {
+ KMessageBox::error(0, i18n("Protocol not supported\n%1", url.protocol()));
+ return;
}
-
- // this should let rekonq to support the beautiful KDE web browsing shortcuts
- loadingUrl = KUriFilter::self()->filteredUri(loadingUrl);
WebView *webView;
@@ -310,7 +322,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/rekonq.kcfg b/src/rekonq.kcfg
index d6e3a8ae..50fa6621 100644
--- a/src/rekonq.kcfg
+++ b/src/rekonq.kcfg
@@ -24,7 +24,7 @@
<default>false</default>
</entry>
<entry name="showUrlsPopup" type="Bool">
- <default>false</default>
+ <default>true</default>
</entry>
</group>
@@ -37,7 +37,7 @@
<default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont))</default>
</entry>
<entry name="fontSize" type="Int">
- <default>12</default>
+ <default>16</default>
</entry>
</group>
diff --git a/src/webview.cpp b/src/webview.cpp
index a562b1ab..a4621dd0 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<int>(':'));
+ 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<int>(':'));
+ QString keywordDelimiter = cg.readEntry("KeywordDelimiter", ":");
KService::Ptr service;
KUriFilterData data;
foreach (QString engine, favoriteEngines)