From 962f44708ea40fe9a00fed17d8b2afba0deb2856 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 15 Jul 2009 23:50:12 +0200 Subject: Some backports from KdeWebKit and rekonq 0.1 implementation --- src/webpage.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/webpage.cpp') diff --git a/src/webpage.cpp b/src/webpage.cpp index e8e956ed..d0dd39fb 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -48,9 +48,7 @@ #include #include #include - -#include -#include +#include // Qt Includes #include @@ -179,12 +177,12 @@ void WebPage::viewErrorPage(QNetworkReply *reply) frames.append(frame); } } - if (m_loadingUrl == reply->url()) - { - mainFrame()->setHtml(html, reply->url()); - // Don't put error pages to the history. - Application::historyManager()->removeHistoryEntry(reply->url(), mainFrame()->title()); - } +// if (m_loadingUrl == reply->url()) +// { +// mainFrame()->setHtml(html, reply->url()); +// // Don't put error pages to the history. +// Application::historyManager()->removeHistoryEntry(reply->url(), mainFrame()->title()); +// } } @@ -257,16 +255,25 @@ void WebPage::slotDownloadRequested(const QNetworkRequest &request) // } // // if (downloadViaKIO) { -// const QString destUrl = KFileDialog::getSaveFileName(url.fileName(), QString(), view()); -// if (destUrl.isEmpty()) return; -// KIO::Job *job = KIO::file_copy(url, KUrl(destUrl), -1, KIO::Overwrite); -// //job->setMetaData(metadata); //TODO: add metadata from request -// job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache. -// job->addMetaData("cache", "cache"); // Use entry from cache if available. -// job->uiDelegate()->setAutoErrorHandlingEnabled(true); + const QString destUrl = KFileDialog::getSaveFileName(url.fileName(), QString(), view()); + if (destUrl.isEmpty()) return; + KIO::Job *job = KIO::file_copy(url, KUrl(destUrl), -1, KIO::Overwrite); + //job->setMetaData(metadata); //TODO: add metadata from request + job->addMetaData("MaxCacheSize", "0"); // Don't store in http cache. + job->addMetaData("cache", "cache"); // Use entry from cache if available. + job->uiDelegate()->setAutoErrorHandlingEnabled(true); // } + + } + +QString WebPage::chooseFile(QWebFrame *frame, const QString &suggestedFile) +{ + return KFileDialog::getOpenFileName(suggestedFile, QString(), frame->page()->view()); +} + + WebPage *WebPage::newWindow(WebWindowType type) { Q_UNUSED(type); -- cgit v1.2.1