diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/protocolhandler.cpp | 18 | ||||
| -rw-r--r-- | src/protocolhandler.h | 2 | ||||
| -rw-r--r-- | src/webpage.cpp | 2 | 
3 files changed, 14 insertions, 8 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)                              ; diff --git a/src/protocolhandler.h b/src/protocolhandler.h index 09a28c21..8628a4f7 100644 --- a/src/protocolhandler.h +++ b/src/protocolhandler.h @@ -44,7 +44,7 @@ public:     bool handle(const QNetworkRequest &request, QWebFrame *frame);  private: -   QString fileHandling(const KUrl &url); +   QString dirHandling(const KUrl &url);  };  #endif  // PROTOCOL_HANDLER_H diff --git a/src/webpage.cpp b/src/webpage.cpp index accf0e44..1890e74c 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -224,7 +224,6 @@ QString WebPage::errorPage(QNetworkReply *reply)      }      QString title = i18n("Error loading: %1", reply->url().path());  -    QString imagesPath = QString("file://") + KGlobal::dirs()->findResourceDir("data", "rekonq/pics/bg.png") + QString("rekonq/pics");      QString msg = "<h1>" + reply->errorString() + "</h1>";      QString urlString = reply->url().toString( QUrl::RemoveUserInfo | QUrl::RemoveQuery ); @@ -239,7 +238,6 @@ QString WebPage::errorPage(QNetworkReply *reply)      QString html = QString(QLatin1String(file.readAll()))                              .arg(title) -                            .arg(imagesPath)                              .arg(msg)                              ;      return html;  | 
