diff options
author | Domrachev Alexandr <alexandr.domrachev@gmail.com> | 2009-06-20 14:40:50 +0400 |
---|---|---|
committer | Domrachev Alexandr <alexandr.domrachev@gmail.com> | 2009-06-20 14:40:50 +0400 |
commit | b3c0db45efc83bfba6f02f00b769b2870f9c40ba (patch) | |
tree | 52aa989abe5312c492f5ebb73dba0610751e59e8 /src/webpage.cpp | |
parent | Application::icon() changed to static (diff) | |
parent | rekonq 0.1.5: UI changes (diff) | |
download | rekonq-b3c0db45efc83bfba6f02f00b769b2870f9c40ba.tar.xz |
Merge branch 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git
* 'master' of git@gitorious.org:~avaddon/rekonq/avaddon-clone.git: (23 commits)
rekonq 0.1.5: UI changes
Various Fixes
RFC. History Menu Revisited.
History Panel Action fix
Removed unuseful history dialog. We use just history panel, from now on..
Removed recently closed tabs history
No more Action Back Menu
UI changes
New Tab tool button
Fixing webpage headers
Restored Unsupport Content Handler (new 1st implementation)
Fix forward declaration
Cosmetic networkmanager changes
SVN_SILENT made messages (.desktop file)
Forgot to remove unuseful KDE IS VERSION check. Removed now..
bookmark toolbar displaying ALL the bookmarks.
fixuifiles
SVN_SILENT made messages (.desktop file)
SVN_SILENT made messages (.desktop file)
SVN_SILENT made messages (.desktop file, second try)
...
Conflicts:
src/mainview.cpp
src/mainwindow.cpp
Diffstat (limited to 'src/webpage.cpp')
-rw-r--r-- | src/webpage.cpp | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/src/webpage.cpp b/src/webpage.cpp index d26b54aa..39511760 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -42,6 +42,10 @@ #include <KDebug> #include <KToolInvocation> +#include <KDE/KParts/BrowserRun> +#include <KDE/KMimeTypeTrader> +#include <KDE/KRun> + #include <kdewebkit/kwebpage.h> #include <kdewebkit/kwebview.h> @@ -123,16 +127,39 @@ KWebPage *WebPage::createWindow(QWebPage::WebWindowType type) // FIXME: implement here (perhaps) mimetype discerning && file loading (KToolInvocation??) -// void WebPage::slotHandleUnsupportedContent(QNetworkReply *reply) -// { -// -// if (reply->error() == QNetworkReply::NoError) -// { -// return slotDownloadRequested(reply->request(), reply); -// } -// -// viewErrorPage(reply); -// } +void WebPage::slotHandleUnsupportedContent(QNetworkReply *reply) +{ + + const KUrl url(reply->request().url()); + kDebug() << "title:" << url; + kDebug() << "error:" << reply->errorString(); + + QString filename = url.fileName(); + QString mimetype = reply->header(QNetworkRequest::ContentTypeHeader).toString(); + KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mimetype); + + KParts::BrowserRun::AskSaveResult res = KParts::BrowserRun::askSave( + url, + offer, + mimetype, + filename + ); + switch (res) + { + case KParts::BrowserRun::Save: + slotDownloadRequested(reply->request(), reply); + return; + case KParts::BrowserRun::Cancel: + return; + default: // non existant case + break; + } + + KUrl::List list; + list.append(url); + KRun::run(*offer,url,0); + return; +} void WebPage::manageNetworkErrors(QNetworkReply* reply) |