diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/application.cpp | 45 | ||||
-rw-r--r-- | src/mainwindow.cpp | 11 | ||||
-rw-r--r-- | src/rekonq.kcfg | 4 | ||||
-rw-r--r-- | src/webview.cpp | 4 |
4 files changed, 40 insertions, 24 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/mainwindow.cpp b/src/mainwindow.cpp index cebb7454..27ed8e37 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -931,13 +931,18 @@ void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status) break; } - m_popup->setView(msg); - + m_popup->setFrameShape(QFrame::NoFrame); + QLabel *label = new QLabel(msg); + m_popup->setLineWidth(0); + m_popup->setView(label); + m_popup->setFixedSize(0, 0); + m_popup->layout()->setAlignment(Qt::AlignTop); + m_popup->layout()->setMargin(4); int h = KGlobalSettings::generalFont().pointSize(); // setting popus in bottom-left position int x = geometry().x(); - int y = geometry().y() + height() - h*4; + int y = geometry().y() + height() - h*3; QPoint p(x,y); m_popup->show(p); 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) |