diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-11-16 17:51:01 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-12-11 06:37:32 +0000 |
commit | 9d18f8d02b73c2c9310b772c972ea1e0d1356102 (patch) | |
tree | 7cc8c93950db0797916146620c6fb2e56ad0acc4 /src/webenginewidgets/api/qwebenginedownloaditem.cpp | |
parent | 222faea4af492f3286e9adca9c3d57a0f553a52a (diff) |
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 <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginedownloaditem.cpp')
-rw-r--r-- | src/webenginewidgets/api/qwebenginedownloaditem.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.cpp b/src/webenginewidgets/api/qwebenginedownloaditem.cpp index 6c9413280..9650f5e0e 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.cpp +++ b/src/webenginewidgets/api/qwebenginedownloaditem.cpp @@ -76,6 +76,7 @@ QWebEngineDownloadItemPrivate::QWebEngineDownloadItemPrivate(QWebEngineProfilePr , downloadFinished(false) , downloadId(-1) , downloadState(QWebEngineDownloadItem::DownloadCancelled) + , savePageFormat(QWebEngineDownloadItem::MimeHtmlSaveFormat) , downloadUrl(url) , totalBytes(-1) , receivedBytes(0) @@ -201,6 +202,19 @@ quint32 QWebEngineDownloadItem::id() const */ /*! + \enum QWebEngineDownloadItem::SavePageFormat + + This enum describes the format that is used to save a web page. + + \value UnknownSaveFormat This is not a request for downloading a complete web page. + \value SingleHtmlSaveFormat The page is saved as a single HTML page. Resources such as images + are not saved. + \value CompleteHtmlSaveFormat The page is saved as a complete HTML page, for example a directory + containing the single HTML page and the resources. + \value MimeHtmlSaveFormat The page is saved as a complete web page in the MIME HTML format. +*/ + +/*! Returns the download item's current state. \sa QWebEngineDownloadItem::DownloadState @@ -289,6 +303,28 @@ bool QWebEngineDownloadItem::isFinished() const return d->downloadFinished; } +/*! + Returns the format the web page will be saved in if this is a download request for a web page. + + \sa setSavePageFormat() +*/ +QWebEngineDownloadItem::SavePageFormat QWebEngineDownloadItem::savePageFormat() const +{ + Q_D(const QWebEngineDownloadItem); + return d->savePageFormat; +} + +/*! + Sets the format the web page will be saved in if this is a download request for a web page. + + \sa savePageFormat() +*/ +void QWebEngineDownloadItem::setSavePageFormat(QWebEngineDownloadItem::SavePageFormat format) +{ + Q_D(QWebEngineDownloadItem); + d->savePageFormat = format; +} + QWebEngineDownloadItem::QWebEngineDownloadItem(QWebEngineDownloadItemPrivate *p, QObject *parent) : QObject(parent) , d_ptr(p) |