Commit 69c433d9 authored by Laurent Montel's avatar Laurent Montel 😁

Add more debug + add show print preview

parent 2f32cb1b
set(testwebengineviewer_webengine_SRCS)
ecm_qt_declare_logging_category(testwebengineviewer_webengine_SRCS HEADER webengineviewer_debug.h IDENTIFIER WEBENGINEVIEWER_LOG CATEGORY_NAME log_webengineviewer)
ecm_add_test(webhittestresulttest.cpp ../webhittestresult.cpp
TEST_NAME webhittestresulttest
NAME_PREFIX "webengineviewer-"
......@@ -12,13 +15,13 @@ ecm_add_test(zoomactionmenutest.cpp
)
ecm_add_test(webengineprintmessageboxtest.cpp ../webengineprintmessagebox.cpp ../webengineexporthtmlpagejob.cpp
ecm_add_test(webengineprintmessageboxtest.cpp ${testwebengineviewer_webengine_SRCS} ../webengineprintmessagebox.cpp ../webengineexporthtmlpagejob.cpp
TEST_NAME webengineprintmessageboxtest
NAME_PREFIX "webengineviewer-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer KF5::I18n
)
ecm_add_test(webengineexporthtmlpagejobtest.cpp ../webengineexporthtmlpagejob.cpp
ecm_add_test(webengineexporthtmlpagejobtest.cpp ${testwebengineviewer_webengine_SRCS} ../webengineexporthtmlpagejob.cpp
TEST_NAME webengineexporthtmlpagejobtest
NAME_PREFIX "webengineviewer-"
LINK_LIBRARIES Qt5::Test KF5::WebEngineViewer
......
......@@ -16,6 +16,7 @@
*/
#include "webengineprintmessagebox.h"
#include "webengineviewer_debug.h"
#include "webengineexporthtmlpagejob.h"
#include "config-webengineviewer.h"
#include <KLocalizedString>
......@@ -46,6 +47,13 @@ WebEnginePrintMessageBox::WebEnginePrintMessageBox(QWidget *parent)
openInBrowser->setObjectName(QStringLiteral("openinbrowser"));
buttonBox->addButton(openInBrowser, QDialogButtonBox::ActionRole);
#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
QPushButton *openInPreviewDialogBox = new QPushButton(i18n("Print Preview"), this);
connect(openInPreviewDialogBox, &QPushButton::clicked, this, &WebEnginePrintMessageBox::slotPrintPreview);
openInPreviewDialogBox->setObjectName(QStringLiteral("openinbrowser"));
buttonBox->addButton(openInPreviewDialogBox, QDialogButtonBox::ActionRole);
#endif
mainLayout->addWidget(buttonBox);
}
......@@ -68,11 +76,9 @@ void WebEnginePrintMessageBox::slotOpenInBrowser()
connect(job, &WebEngineExportHtmlPageJob::failed, this, &WebEnginePrintMessageBox::slotExportHtmlPageFailed);
connect(job, &WebEngineExportHtmlPageJob::success, this, &WebEnginePrintMessageBox::slotExportHtmlPageSuccess);
job->start();
} else {
qCDebug(WEBENGINEVIEWER_LOG) << "WebEngineView not defined";
}
//TODO
}
void WebEnginePrintMessageBox::slotExportHtmlPageSuccess(const QString &filename)
......@@ -84,10 +90,18 @@ void WebEnginePrintMessageBox::slotExportHtmlPageSuccess(const QString &filename
void WebEnginePrintMessageBox::slotExportHtmlPageFailed()
{
//TODO
qCDebug(WEBENGINEVIEWER_LOG) << "Impossible to export html page";
accept();
}
QWebEngineView *WebEnginePrintMessageBox::engineView() const
{
return mEngineView;
}
void WebEnginePrintMessageBox::slotPrintPreview()
{
#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
//TODO
#endif
}
......@@ -38,6 +38,7 @@ private Q_SLOTS:
void slotOpenInBrowser();
void slotExportHtmlPageSuccess(const QString &filename);
void slotPrintPreview();
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