summaryrefslogtreecommitdiff
path: root/examples/webenginewidgets/demobrowser/tabwidget.cpp
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-12-18 11:39:12 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2015-12-21 15:20:18 +0000
commitcaf813a167c8a31739e7ae192a4c4921607e3ead (patch)
treefabad445d476a993ea1729527960cf5f3dc12d0b /examples/webenginewidgets/demobrowser/tabwidget.cpp
parent6a8d99ab00ace2084820547572dc05ac8ad2bc5a (diff)
downloadqtwebengine-caf813a167c8a31739e7ae192a4c4921607e3ead.tar.gz
Add a "save page" dialog to demobrowser
Add a dialog to let the user choose the format and location when saving web pages. Change-Id: I19640d96add68bf08bdc4e4f9f24845ba1b0d22f Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'examples/webenginewidgets/demobrowser/tabwidget.cpp')
-rw-r--r--examples/webenginewidgets/demobrowser/tabwidget.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/webenginewidgets/demobrowser/tabwidget.cpp b/examples/webenginewidgets/demobrowser/tabwidget.cpp
index a7e94ee62..23903e88a 100644
--- a/examples/webenginewidgets/demobrowser/tabwidget.cpp
+++ b/examples/webenginewidgets/demobrowser/tabwidget.cpp
@@ -46,6 +46,7 @@
#include "downloadmanager.h"
#include "fullscreennotification.h"
#include "history.h"
+#include "savepagedialog.h"
#include "urllineedit.h"
#include "webview.h"
@@ -883,6 +884,14 @@ bool TabWidget::restoreState(const QByteArray &state)
void TabWidget::downloadRequested(QWebEngineDownloadItem *download)
{
+ if (download->savePageFormat() != QWebEngineDownloadItem::UnknownSaveFormat) {
+ SavePageDialog dlg(this, download->savePageFormat(), download->path());
+ if (dlg.exec() != SavePageDialog::Accepted)
+ return;
+ download->setSavePageFormat(dlg.pageFormat());
+ download->setPath(dlg.filePath());
+ }
+
BrowserApplication::downloadManager()->download(download);
download->accept();
}