summaryrefslogtreecommitdiff
path: root/src/protocolhandler.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-12-16 02:26:19 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-12-16 02:26:19 +0100
commit5403b3eeb3309bdfebb9ced2cf091ce885065f88 (patch)
tree50d278515688c36bea37e49509a519e5a86810a5 /src/protocolhandler.cpp
parentFile protocol handling! Yeah! (diff)
downloadrekonq-5403b3eeb3309bdfebb9ced2cf091ce885065f88.tar.xz
local files krun!
Diffstat (limited to 'src/protocolhandler.cpp')
-rw-r--r--src/protocolhandler.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index c9b34945..26766377 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -28,6 +28,7 @@
// Local Includes
#include "newtabpage.h"
+#include "application.h"
// KDE Includes
#include <klocalizedstring.h>
@@ -99,8 +100,16 @@ bool ProtocolHandler::handle(const QNetworkRequest &request, QWebFrame *frame)
// "file" handling
if(url.protocol() == QLatin1String("file"))
{
- QString html = fileHandling(url);
- frame->setHtml( html );
+ QFileInfo fileInfo(url.path());
+ if(fileInfo.isFile())
+ {
+ new KRun(url, 0, 0, true);
+ }
+ else // dir
+ {
+ QString html = dirHandling(url);
+ frame->setHtml( html );
+ }
// KUrl::List list;
// list.append(url);
// KRun::run("dolphin %u",url,0);
@@ -112,7 +121,7 @@ bool ProtocolHandler::handle(const QNetworkRequest &request, QWebFrame *frame)
}
-QString ProtocolHandler::fileHandling(const KUrl &url)
+QString ProtocolHandler::dirHandling(const KUrl &url)
{
QDir dir(url.toLocalFile());
@@ -170,7 +179,7 @@ QString ProtocolHandler::fileHandling(const KUrl &url)
msg += "<td align=\"right\">";
if(item.isFile())
{
- msg += QString::number( item.size()/1024 ) + "KB";
+ msg += QString::number( item.size()/1024 ) + " KB";
}
msg += "</td>";
@@ -185,7 +194,6 @@ QString ProtocolHandler::fileHandling(const KUrl &url)
QString html = QString(QLatin1String(file.readAll()))
.arg(title)
-// .arg(imagesPath)
.arg(msg)
;