From 9d18f8d02b73c2c9310b772c972ea1e0d1356102 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 16 Nov 2015 17:51:01 +0100 Subject: Add web action for saving the current web page Add the possibility to save web pages as single HTML file, complete HTML (with resource directory) or MHTML archive. Change-Id: Ic7e7cfda9432f3534c13350a6369d79bb17fd8b3 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineprofile.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/webengine/api/qquickwebengineprofile.cpp') diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index 303f038a8..0c3f7400b 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -45,12 +45,18 @@ #include #include "browser_context_adapter.h" +#include #include "web_engine_settings.h" using QtWebEngineCore::BrowserContextAdapter; QT_BEGIN_NAMESPACE +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::UnknownSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::UnknownSavePageFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::SingleHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::SingleHtmlSaveFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::CompleteHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::CompleteHtmlSaveFormat) +ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineCore::BrowserContextAdapterClient::MimeHtmlSaveFormat) + QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(BrowserContextAdapter* browserContext) : m_settings(new QQuickWebEngineSettings()) , m_browserContextRef(browserContext) @@ -94,6 +100,8 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) itemPrivate->downloadState = QQuickWebEngineDownloadItem::DownloadRequested; itemPrivate->totalBytes = info.totalBytes; itemPrivate->downloadPath = info.path; + itemPrivate->savePageFormat = static_cast( + info.savePageFormat); QQuickWebEngineDownloadItem *download = new QQuickWebEngineDownloadItem(itemPrivate, q); @@ -104,6 +112,7 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) QQuickWebEngineDownloadItem::DownloadState state = download->state(); info.path = download->path(); + info.savePageFormat = itemPrivate->savePageFormat; info.accepted = state != QQuickWebEngineDownloadItem::DownloadCancelled && state != QQuickWebEngineDownloadItem::DownloadRequested; } -- cgit v1.2.3