summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-05-25 13:43:07 +0200
committerMontel Laurent <[email protected]>2016-05-25 13:43:07 +0200
commit69c433d9ea886083a1f9958246154f6943423d4b (patch)
tree8e0e89f26c2385e6d5e03defa7a8e9bad04661a0
parent2f32cb1b41e5a281fc7e1cc2630fd09486290d18 (diff)
Add more debug + add show print preview
-rw-r--r--webengineviewer/src/autotests/CMakeLists.txt7
-rw-r--r--webengineviewer/src/webengineprintmessagebox.cpp22
-rw-r--r--webengineviewer/src/webengineprintmessagebox.h1
3 files changed, 24 insertions, 6 deletions
diff --git a/webengineviewer/src/autotests/CMakeLists.txt b/webengineviewer/src/autotests/CMakeLists.txt
index e6489b4..69cf0c9 100644
--- a/webengineviewer/src/autotests/CMakeLists.txt
+++ b/webengineviewer/src/autotests/CMakeLists.txt
@@ -1,3 +1,6 @@
+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
diff --git a/webengineviewer/src/webengineprintmessagebox.cpp b/webengineviewer/src/webengineprintmessagebox.cpp
index ff7d99b..30a8f33 100644
--- a/webengineviewer/src/webengineprintmessagebox.cpp
+++ b/webengineviewer/src/webengineprintmessagebox.cpp
@@ -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
+}
diff --git a/webengineviewer/src/webengineprintmessagebox.h b/webengineviewer/src/webengineprintmessagebox.h
index 840da89..4c3875d 100644
--- a/webengineviewer/src/webengineprintmessagebox.h
+++ b/webengineviewer/src/webengineprintmessagebox.h
@@ -38,6 +38,7 @@ private Q_SLOTS:
void slotOpenInBrowser();
void slotExportHtmlPageSuccess(const QString &filename);
+ void slotPrintPreview();
private:
QWebEngineView *mEngineView;
};