Details
Description
When saving a webpage to MHTML, the associated QWebEngineDownloadRequest returns the following values:
- isSavePageDownload() => true
- mimeType() => "application/x-mimearchive"
However, when the current webpage is already an MHTML file, saving the page gives a QWebEngineDownloadRequest with the following values:
- isSavePageDownload() => false
- mimeType() => "multipart/related"
Step 1
The initial MHTML file is created from a web page by using
QWebEnginePage::triggerAction(QWebEnginePage::SavePage);
//or
QWebEngineView::triggerAction(QWebEnginePage::SavePage);
The download request is handled with QWebEngineProfile::downloadRequested().
Step 2
The MHTML file is then opened with
auto page = new QWebEnginePage(); page->setUrl(QUrl::fromLocalFile(pathToMhtml);
Step 3
Finaly a new SavePage action is triggered just like in step 1.