Commit 05bb64e3 authored by Laurent Montel's avatar Laurent Montel 😁

Use :WebEngineExportHtmlPageJob directly

parent 80e383f5
......@@ -55,6 +55,7 @@ set(libwebengineviewer_webengine_SRCS
webengineaccesskey/webengineaccesskeyanchor.cpp
webengineaccesskey/webengineaccesskeyutils.cpp
webengineprintmessagebox.cpp
webengineexporthtmlpagejob.cpp
)
set(libwebengineviewer_findbar_SRCS
......
......@@ -12,7 +12,7 @@ ecm_add_test(zoomactionmenutest.cpp
)
ecm_add_test(webengineprintmessageboxtest.cpp ../webengineprintmessagebox.cpp
ecm_add_test(webengineprintmessageboxtest.cpp ../webengineprintmessagebox.cpp ../webengineexporthtmlpagejob.cpp
TEST_NAME webengineprintmessageboxtest
NAME_PREFIX "webengineviewer-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer KF5::I18n
......
......@@ -60,6 +60,29 @@ void WebEnginePrintMessageBox::setWebEngineView(QWebEngineView *engineView)
}
void WebEnginePrintMessageBox::slotOpenInBrowser()
{
if (mEngineView) {
//AutoDelete
WebEngineViewer::WebEngineExportHtmlPageJob *job = new WebEngineViewer::WebEngineExportHtmlPageJob(this);
job->setEngineView(mEngineView);
connect(job, &WebEngineExportHtmlPageJob::failed, this, &WebEnginePrintMessageBox::slotExportHtmlPageFailed);
connect(job, &WebEngineExportHtmlPageJob::success, this, &WebEnginePrintMessageBox::slotExportHtmlPageSuccess);
job->start();
} else {
}
//TODO
}
void WebEnginePrintMessageBox::slotExportHtmlPageSuccess(const QString &filename)
{
//TODO delete file
//TODO open browser
accept();
}
void WebEnginePrintMessageBox::slotExportHtmlPageFailed()
{
//TODO
}
......
......@@ -34,8 +34,10 @@ public:
QWebEngineView *engineView() const;
private Q_SLOTS:
void slotExportHtmlPageFailed();
void slotOpenInBrowser();
void slotExportHtmlPageSuccess(const QString &filename);
private:
QWebEngineView *mEngineView;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment