summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-04-24 16:47:55 +0200
committerAndrea Diamantini <adjam7@gmail.com>2012-04-24 16:47:55 +0200
commit4c0ad2049f3b49590a7d19f89ebcb767c3c15283 (patch)
treec043cc517efb6e8601266977e9f17a1277d3c32f /src
parentset Main Window on KDirLister (diff)
downloadrekonq-4c0ad2049f3b49590a7d19f89ebcb767c3c15283.tar.xz
Clean up url management
- Let ftp url(s) work again - Do NOT check url twice via KUriFilter (removed MainWindow::filterUrl) - ensure we are lowering just http url hosts - mailto via urlbar handling BUG: 298114 CCBUG: 284829
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp41
-rw-r--r--src/mainwindow.h7
-rw-r--r--src/protocolhandler.cpp10
-rw-r--r--src/urlbar/urlresolver.cpp13
-rw-r--r--src/webpage.cpp4
5 files changed, 24 insertions, 51 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 99430b9c..68772bea 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -86,7 +86,6 @@
#include <KParts/BrowserExtension>
#include <KMimeTypeTrader>
-#include <KUriFilterData>
// Qt Includes
#include <QtCore/QTimer>
@@ -106,9 +105,6 @@
#include <QTextDocument>
-KUriFilter *MainWindow::s_uriFilter;
-
-
MainWindow::MainWindow()
: KXmlGuiWindow()
, m_view(new MainView(this))
@@ -228,9 +224,6 @@ MainWindow::MainWindow()
// accept d'n'd
setAcceptDrops(true);
- if (!s_uriFilter)
- s_uriFilter = KUriFilter::self();
-
// Things that need to be setup after the call to setupGUI() and after ctor call
QTimer::singleShot(1, this, SLOT(postLaunch()));
}
@@ -1625,9 +1618,9 @@ void MainWindow::loadUrl(const KUrl& url,
void MainWindow::loadCheckedUrl(const KUrl& url, const Rekonq::OpenType& type, QWebHistory *webHistory)
{
- // First, calculate url
- KUrl urlToLoad = filterUrlToLoad(url);
-
+ // NOTE: At this point, url should just be resolved via urlresolver.
+ // No need to check it twice
+
WebTab *tab = 0;
switch (type)
{
@@ -1656,7 +1649,7 @@ void MainWindow::loadCheckedUrl(const KUrl& url, const Rekonq::OpenType& type, Q
WebView *view = tab->view();
if (view)
{
- view->load(urlToLoad);
+ view->load(url);
if (webHistory)
{
@@ -1669,29 +1662,3 @@ void MainWindow::loadCheckedUrl(const KUrl& url, const Rekonq::OpenType& type, Q
}
}
}
-
-
-// ------------------------------------------------------------------------------------------
-
-
-KUrl MainWindow::filterUrlToLoad(const KUrl &url)
-{
- QString urlString = url.pathOrUrl();
- // Bookmarklets handling
- if (urlString.startsWith(QL1S("javascript:")))
- {
- return KUrl(urlString);
- }
-
- // this should let rekonq filtering URI info and supporting
- // the beautiful KDE web browsing shortcuts
- KUriFilterData data(urlString);
- data.setCheckForExecutables(false); // if true, queries like "rekonq" or "dolphin" are considered as executables
-
- if (s_uriFilter->filterUri(data) && data.uriType() != KUriFilterData::Error)
- {
- return data.uri();
- }
-
- return QUrl::fromUserInput(urlString);
-}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index d652a499..e647cc88 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -50,8 +50,6 @@ class WebInspectorPanel;
class WebTab;
class ZoomBar;
-class KUriFilter;
-
class QWebFrame;
class QWebHistory;
class QLabel;
@@ -70,11 +68,6 @@ public:
MainWindow();
~MainWindow();
-
- static KUriFilter *s_uriFilter;
- static KUrl filterUrlToLoad(const KUrl &url);
-
-
inline MainView *mainView() const
{
return m_view;
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 657e8a21..d69171ac 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -169,7 +169,15 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
return true;
}
-
+
+ // "mailto" handling: It needs to be handled both in preHandling (mail url launched)
+ // and in postHandling (mail links clicked)
+ if (_url.protocol() == QL1S("mailto"))
+ {
+ KToolInvocation::invokeMailer(_url);
+ return true;
+ }
+
// "apt" handling
// NOTE: this is a stupid workaround to ensure apt protocol works
if (_url.protocol() == QL1S("apt"))
diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp
index 6d6a2378..833a48f9 100644
--- a/src/urlbar/urlresolver.cpp
+++ b/src/urlbar/urlresolver.cpp
@@ -35,11 +35,7 @@
// KDE Includes
#include <KBookmark>
-#include <KUriFilter>
-#include <KCompletion>
#include <KService>
-#include <KConfig>
-#include <KConfigGroup>
#include <KProtocolInfo>
// Qt Includes
@@ -256,9 +252,14 @@ void UrlResolver::computeQurlFromUserInput()
QUrl urlFromUserInput = QUrl::fromUserInput(url);
if (urlFromUserInput.isValid())
{
+ // ensure http(s) hosts are lower cases
+ if (urlFromUserInput.scheme().startsWith("http"))
+ {
+ QString hst = urlFromUserInput.host();
+ urlFromUserInput.setHost(hst.toLower());
+ }
+
QString urlString = urlFromUserInput.toString();
- if (!urlFromUserInput.isLocalFile())
- urlString = urlString.toLower();
QString gTitle = i18nc("Browse a website", "Browse");
UrlSearchItem gItem(UrlSearchItem::Browse, urlString, gTitle);
_qurlFromUserInput << gItem;
diff --git a/src/webpage.cpp b/src/webpage.cpp
index c6e318e8..ce1151da 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -527,6 +527,10 @@ void WebPage::manageNetworkErrors(QNetworkReply *reply)
break;
case QNetworkReply::UnknownNetworkError: // unknown network-related error detected
+ // last chance for the strange things (eg: FTP, custom schemes, etc...)
+ if (_protHandler.postHandling(reply->request(), mainFrame()))
+ return;
+
case QNetworkReply::ConnectionRefusedError: // remote server refused connection
case QNetworkReply::HostNotFoundError: // invalid hostname
case QNetworkReply::TimeoutError: // connection time out