diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-12-16 15:05:03 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-12-16 15:05:03 +0100 |
commit | 0f4543652464c80c80f4471450da274194ae687b (patch) | |
tree | 46f9d8aadbb4c023a17acf02b5459985154f336f /src/webpage.cpp | |
parent | rekonq 0.3.23 (diff) | |
download | rekonq-0f4543652464c80c80f4471450da274194ae687b.tar.xz |
Cleaner file management
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r-- | src/webpage.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
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; |