summaryrefslogtreecommitdiff
path: root/src/protocolhandler.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-01-10 12:55:58 +0100
committerAndrea Diamantini <adjam7@gmail.com>2010-01-10 12:55:58 +0100
commit3aa17f3d2d6b2e40da55456d2c7336abbb1df3b5 (patch)
treec5ec4c7e78a27fedc32fb6257cd376a10209a7b1 /src/protocolhandler.cpp
parentfix crash on window close (diff)
downloadrekonq-3aa17f3d2d6b2e40da55456d2c7336abbb1df3b5.tar.xz
Protocol Handling fix
We can now manage all the most important protocols :D
Diffstat (limited to 'src/protocolhandler.cpp')
-rw-r--r--src/protocolhandler.cpp31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 602ac016..cd75d06f 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -25,6 +25,7 @@
// Self Includes
#include "protocolhandler.h"
+#include "protocolhandler.moc"
// Auto Includes
#include "rekonq.h"
@@ -74,13 +75,17 @@ ProtocolHandler::~ProtocolHandler()
}
-bool ProtocolHandler::handle(const QNetworkRequest &request, QWebFrame *frame)
+bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *frame)
{
_url = request.url();
_frame = frame;
kDebug() << "URL PROTOCOL: " << _url;
+ // relative urls
+ if(_url.isRelative())
+ return false;
+
// "http(s)" (fast) handling
if( _url.protocol() == QLatin1String("http") || _url.protocol() == QLatin1String("https") )
return false;
@@ -134,6 +139,29 @@ bool ProtocolHandler::handle(const QNetworkRequest &request, QWebFrame *frame)
return true;
}
}
+
+ return false;
+}
+
+
+bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *frame)
+{
+ _url = request.url();
+ _frame = frame;
+
+ kDebug() << "URL PROTOCOL: " << _url;
+
+ // "http(s)" (fast) handling
+ if( _url.protocol() == QLatin1String("http") || _url.protocol() == QLatin1String("https") )
+ return false;
+
+ // "mailto" handling: It needs to be handled both here(mail links clicked)
+ // and in prehandling (mail url launched)
+ if ( _url.protocol() == QLatin1String("mailto") )
+ {
+ KToolInvocation::invokeMailer(_url);
+ return true;
+ }
// "ftp" handling. A little bit "hard" handling this. Hope I found
// the best solution.
@@ -154,6 +182,7 @@ bool ProtocolHandler::handle(const QNetworkRequest &request, QWebFrame *frame)
if(fileInfo.isDir())
{
_lister->openUrl(_url);
+ Application::instance()->mainWindow()->mainView()->urlBar()->setUrl(_url);
return true;
}
}