diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/protocolhandler.cpp | 8 | ||||
-rw-r--r-- | src/webpage.cpp | 28 |
2 files changed, 19 insertions, 17 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index c66af403..1b60d0dc 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -104,17 +104,13 @@ bool ProtocolHandler::handle(const QNetworkRequest &request, QWebFrame *frame) if(url.protocol() == QLatin1String("file")) { QFileInfo fileInfo(url.path()); - if(fileInfo.isFile()) - { - new KRun(url, 0, 0, true); - } - else // dir + if(fileInfo.isDir()) { QString html = dirHandling(url); frame->setHtml(html); Application::instance()->mainWindow()->mainView()->urlBar()->setUrl(url); + return true; } - return true; } return false; diff --git a/src/webpage.cpp b/src/webpage.cpp index 1bc8c1c1..00f71805 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -134,27 +134,33 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) { if (reply->error() == QNetworkReply::NoError) { - const KUrl url(reply->request().url()); + const KUrl url( reply->url() ); QString mimeType = reply->header(QNetworkRequest::ContentTypeHeader).toString(); KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimeType); + bool isLocal = url.isLocalFile(); + if( offer.isNull() ) // no service can handle this. We can just download it.. { - downloadRequest(reply->request()); + isLocal ? KMessageBox::sorry(view(), i18n("No service can handle this :(") ) : downloadRequest(reply->request()); return; } - KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), url, mimeType); - switch ( dlg.askEmbedOrSave() ) + if(!isLocal) { - case KParts::BrowserOpenOrSaveQuestion::Save: - downloadRequested(reply->request()); - return; - case KParts::BrowserOpenOrSaveQuestion::Cancel: - return; - default: // non extant case - break; + + KParts::BrowserOpenOrSaveQuestion dlg(Application::instance()->mainWindow(), url, mimeType); + switch ( dlg.askEmbedOrSave() ) + { + case KParts::BrowserOpenOrSaveQuestion::Save: + downloadRequested(reply->request()); + return; + case KParts::BrowserOpenOrSaveQuestion::Cancel: + return; + default: // non extant case + break; + } } // case KParts::BrowserRun::Embed KUrl::List list; |