summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-08-24 11:07:40 (GMT)
committerMontel Laurent <montel@kde.org>2016-08-24 11:07:40 (GMT)
commitd8c8042b88c57527aaf66a85bc5f25f4c377cacd (patch)
treedeb33af7c8f368a907a76f85531f11ce23f0e26e
parent4407b175a140a9e9dbed55ffc7718f4a9a0dc0b7 (diff)
Remove it (not used and in qt5.8 we will have real printdialog support)
-rw-r--r--webengineviewer/CMakeLists.txt2
-rw-r--r--webengineviewer/config-webengineviewer.h.cmake2
-rw-r--r--webengineviewer/src/CMakeLists.txt43
-rw-r--r--webengineviewer/src/autotests/webengineprintmessageboxtest.cpp18
-rw-r--r--webengineviewer/src/autotests/webengineprintmessageboxtest.h1
-rw-r--r--webengineviewer/src/print/autotests/CMakeLists.txt50
-rw-r--r--webengineviewer/src/print/autotests/printconfiguredialogtest.cpp47
-rw-r--r--webengineviewer/src/print/autotests/printconfiguredialogtest.h34
-rw-r--r--webengineviewer/src/print/autotests/printconfigurewidgettest.cpp57
-rw-r--r--webengineviewer/src/print/autotests/printconfigurewidgettest.h35
-rw-r--r--webengineviewer/src/print/autotests/printpreviewdialogtest.cpp51
-rw-r--r--webengineviewer/src/print/autotests/printpreviewdialogtest.h35
-rw-r--r--webengineviewer/src/print/autotests/printpreviewpageviewertest.cpp45
-rw-r--r--webengineviewer/src/print/autotests/printpreviewpageviewertest.h35
-rw-r--r--webengineviewer/src/print/autotests/printpreviewpagewidgettest.cpp67
-rw-r--r--webengineviewer/src/print/autotests/printpreviewpagewidgettest.h37
-rw-r--r--webengineviewer/src/print/autotests/printselectpagedialogtest.cpp52
-rw-r--r--webengineviewer/src/print/autotests/printselectpagedialogtest.h36
-rw-r--r--webengineviewer/src/print/autotests/printselectpagewidgettest.cpp65
-rw-r--r--webengineviewer/src/print/autotests/printselectpagewidgettest.h37
-rw-r--r--webengineviewer/src/print/autotests/printwebengineviewjobtest.cpp65
-rw-r--r--webengineviewer/src/print/autotests/printwebengineviewjobtest.h36
-rw-r--r--webengineviewer/src/print/printconfiguredialog.cpp55
-rw-r--r--webengineviewer/src/print/printconfiguredialog.h41
-rw-r--r--webengineviewer/src/print/printconfigurewidget.cpp89
-rw-r--r--webengineviewer/src/print/printconfigurewidget.h48
-rw-r--r--webengineviewer/src/print/printpreviewdialog.cpp102
-rw-r--r--webengineviewer/src/print/printpreviewdialog.h47
-rw-r--r--webengineviewer/src/print/printpreviewpageviewer.cpp102
-rw-r--r--webengineviewer/src/print/printpreviewpageviewer.h61
-rw-r--r--webengineviewer/src/print/printpreviewpagewidget.cpp199
-rw-r--r--webengineviewer/src/print/printpreviewpagewidget.h65
-rw-r--r--webengineviewer/src/print/printselectpagedialog.cpp77
-rw-r--r--webengineviewer/src/print/printselectpagedialog.h44
-rw-r--r--webengineviewer/src/print/printselectpagewidget.cpp63
-rw-r--r--webengineviewer/src/print/printselectpagewidget.h45
-rw-r--r--webengineviewer/src/print/printwebengineviewjob.cpp120
-rw-r--r--webengineviewer/src/print/printwebengineviewjob.h62
-rw-r--r--webengineviewer/src/print/tests/CMakeLists.txt51
-rw-r--r--webengineviewer/src/print/tests/printpreviewdialog_gui.cpp37
-rw-r--r--webengineviewer/src/print/tests/printpreviewdialog_gui.h23
-rw-r--r--webengineviewer/src/print/tests/printwebenginetest_gui.cpp89
-rw-r--r--webengineviewer/src/print/tests/printwebenginetest_gui.h40
-rw-r--r--webengineviewer/src/webengineprintmessagebox.cpp13
44 files changed, 0 insertions, 2323 deletions
diff --git a/webengineviewer/CMakeLists.txt b/webengineviewer/CMakeLists.txt
index 80cad10..1378ecc 100644
--- a/webengineviewer/CMakeLists.txt
+++ b/webengineviewer/CMakeLists.txt
@@ -10,8 +10,6 @@ ecm_setup_version(${MESSAGELIB_LIB_VERSION} VARIABLE_PREFIX WEBENGINEVIEWER
########### Targets ###########
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
-option(WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT "Build the print preview support based on poppler." TRUE)
-
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5WebEngineViewer")
diff --git a/webengineviewer/config-webengineviewer.h.cmake b/webengineviewer/config-webengineviewer.h.cmake
index 7bde893..dc1320a 100644
--- a/webengineviewer/config-webengineviewer.h.cmake
+++ b/webengineviewer/config-webengineviewer.h.cmake
@@ -1,6 +1,4 @@
#ifndef CONFIGWEBENGINEVIEWER_H
#define CONFIGWEBENGINEVIEWER_H
-#cmakedefine WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT 1
-
#endif
diff --git a/webengineviewer/src/CMakeLists.txt b/webengineviewer/src/CMakeLists.txt
index cfc5340..60ac0f4 100644
--- a/webengineviewer/src/CMakeLists.txt
+++ b/webengineviewer/src/CMakeLists.txt
@@ -8,36 +8,6 @@ if(BUILD_TESTING)
add_subdirectory(findbar/autotests)
endif()
-# Laurent Remove all code when QtWebEngine support real printing Disable it for 5.7 not finish yet
-if (Qt5WebEngineWidgets_VERSION VERSION_GREATER "5.7.99")
- if (WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT)
- find_package(Poppler "0.12.1" COMPONENTS Qt5)
- set_package_properties("Poppler" PROPERTIES
- TYPE RECOMMENDED
- PURPOSE "Support for print preview.")
-
- if (Poppler_Qt5_FOUND)
- set(libwebengineviewer_print_SRCS
- print/printpreviewdialog.cpp
- print/printpreviewpageviewer.cpp
- print/printpreviewpagewidget.cpp
- print/printwebengineviewjob.cpp
- print/printconfiguredialog.cpp
- print/printconfigurewidget.cpp
- print/printselectpagedialog.cpp
- print/printselectpagewidget.cpp
- )
- set(poppler_lib Poppler::Qt5 Qt5::PrintSupport)
- endif()
- if(BUILD_TESTING)
- add_subdirectory(print/autotests)
- add_subdirectory(print/tests)
- endif()
- endif()
-else()
- set(WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT FALSE)
-endif()
-
configure_file(../config-webengineviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/../config-webengineviewer.h )
set(libwebengineviewer_webengine_SRCS
@@ -123,19 +93,6 @@ install(TARGETS
EXPORT KF5WebEngineViewerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)
-if (WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT)
- ecm_generate_headers(WebEngineViewer_Camelprint_HEADERS
- HEADER_NAMES
- PrintPreviewDialog
- PrintWebEngineViewJob
- PrintConfigureDialog
- REQUIRED_HEADERS WebEngineViewer_print_HEADERS
- PREFIX WebEngineViewer
- RELATIVE print
- )
-
-endif()
-
ecm_generate_headers(WebEngineViewer_Camelfindbar_HEADERS
HEADER_NAMES
FindBarBase
diff --git a/webengineviewer/src/autotests/webengineprintmessageboxtest.cpp b/webengineviewer/src/autotests/webengineprintmessageboxtest.cpp
index 93851eb..58bb112 100644
--- a/webengineviewer/src/autotests/webengineprintmessageboxtest.cpp
+++ b/webengineviewer/src/autotests/webengineprintmessageboxtest.cpp
@@ -18,7 +18,6 @@
*/
#include "webengineprintmessageboxtest.h"
-#include "webengineviewer/config-webengineviewer.h"
#include "../webengineprintmessagebox.h"
#include <QTest>
#include <QPushButton>
@@ -40,23 +39,6 @@ void WebEnginePrintMessageBoxTest::shouldHaveDefaultValue()
QPushButton *openInBrowser = box.findChild<QPushButton *>(QStringLiteral("openinbrowser"));
QVERIFY(openInBrowser);
-#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
- QPushButton *openInPreviewDialogBox = box.findChild<QPushButton *>(QStringLiteral("openprintpreview"));
- QVERIFY(openInPreviewDialogBox);
-#endif
-}
-
-void WebEnginePrintMessageBoxTest::shouldEmitOpenPrintPreviewSignal()
-{
- WebEngineViewer::WebEnginePrintMessageBox box;
- QSignalSpy spyPrintPreview(&box, SIGNAL(openPrintPreview()));
-#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
- QPushButton *openInPreviewDialogBox = box.findChild<QPushButton *>(QStringLiteral("openprintpreview"));
- QTest::mouseClick(openInPreviewDialogBox, Qt::LeftButton);
- QCOMPARE(spyPrintPreview.count(), 1);
-#else
- Q_UNUSED(spyPrintPreview);
-#endif
}
void WebEnginePrintMessageBoxTest::shouldEmitOpenInBrowserSignal()
diff --git a/webengineviewer/src/autotests/webengineprintmessageboxtest.h b/webengineviewer/src/autotests/webengineprintmessageboxtest.h
index 29f362f..70feddf 100644
--- a/webengineviewer/src/autotests/webengineprintmessageboxtest.h
+++ b/webengineviewer/src/autotests/webengineprintmessageboxtest.h
@@ -31,7 +31,6 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
- void shouldEmitOpenPrintPreviewSignal();
void shouldEmitOpenInBrowserSignal();
};
diff --git a/webengineviewer/src/print/autotests/CMakeLists.txt b/webengineviewer/src/print/autotests/CMakeLists.txt
deleted file mode 100644
index c071cd8..0000000
--- a/webengineviewer/src/print/autotests/CMakeLists.txt
+++ /dev/null
@@ -1,50 +0,0 @@
-set(print_autotest_SRCS)
-ecm_qt_declare_logging_category(print_autotest_SRCS HEADER webengineviewer_debug.h IDENTIFIER WEBENGINEVIEWER_LOG CATEGORY_NAME log_webengineviewer)
-
-ecm_add_test(printpreviewdialogtest.cpp ../printpreviewdialog.cpp ../printpreviewpageviewer.cpp ../printpreviewpagewidget.cpp ../printselectpagedialog.cpp ../printselectpagewidget.cpp ${print_autotest_SRCS}
- TEST_NAME printpreviewdialogtest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n KF5::WidgetsAddons Poppler::Qt5 KF5::ConfigCore
- )
-
-ecm_add_test(printpreviewpageviewertest.cpp ../printpreviewpageviewer.cpp ${print_autotest_SRCS}
- TEST_NAME printpreviewpagetest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n KF5::WidgetsAddons Poppler::Qt5 KF5::ConfigCore
- )
-
-ecm_add_test(printpreviewpagewidgettest.cpp ../printpreviewpagewidget.cpp ../printpreviewpageviewer.cpp ${print_autotest_SRCS}
- TEST_NAME printpreviewpagewidgettest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n KF5::WidgetsAddons Poppler::Qt5 KF5::ConfigCore
- )
-
-ecm_add_test(printwebengineviewjobtest.cpp ../printwebengineviewjob.cpp ${print_autotest_SRCS}
- TEST_NAME printwebengineviewjobtest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::WebEngineWidgets Qt5::PrintSupport
- )
-
-ecm_add_test(printconfiguredialogtest.cpp ../printconfiguredialog.cpp ../printconfigurewidget.cpp ${print_autotest_SRCS}
- TEST_NAME printconfiguredialogtest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport
- )
-
-ecm_add_test(printconfigurewidgettest.cpp ../printconfigurewidget.cpp ${print_autotest_SRCS}
- TEST_NAME printconfigurewidgettest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport
- )
-
-ecm_add_test(printselectpagedialogtest.cpp ../printselectpagedialog.cpp ../printselectpagewidget.cpp ${print_autotest_SRCS}
- TEST_NAME printselectpagedialogtest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport KF5::ConfigCore
- )
-
-ecm_add_test(printselectpagewidgettest.cpp ../printselectpagewidget.cpp ${print_autotest_SRCS}
- TEST_NAME printselectpagewidgettest
- NAME_PREFIX "webengineviewer-print-"
- LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport
- )
diff --git a/webengineviewer/src/print/autotests/printconfiguredialogtest.cpp b/webengineviewer/src/print/autotests/printconfiguredialogtest.cpp
deleted file mode 100644
index 2b7fdb4..0000000
--- a/webengineviewer/src/print/autotests/printconfiguredialogtest.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printconfiguredialogtest.h"
-#include "../printconfiguredialog.h"
-#include "../printconfigurewidget.h"
-#include <QTest>
-#include <QDialogButtonBox>
-
-PrintConfigureDialogTest::PrintConfigureDialogTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintConfigureDialogTest::~PrintConfigureDialogTest()
-{
-
-}
-
-void PrintConfigureDialogTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintConfigureDialog dlg;
- WebEngineViewer::PrintConfigureWidget *w = dlg.findChild<WebEngineViewer::PrintConfigureWidget *>(QStringLiteral("configurewidget"));
- QVERIFY(w);
-
- QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
- QVERIFY(buttonBox);
-}
-
-QTEST_MAIN(PrintConfigureDialogTest)
diff --git a/webengineviewer/src/print/autotests/printconfiguredialogtest.h b/webengineviewer/src/print/autotests/printconfiguredialogtest.h
deleted file mode 100644
index 95b5210..0000000
--- a/webengineviewer/src/print/autotests/printconfiguredialogtest.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-#ifndef PRINTCONFIGUREDIALOGTEST_H
-#define PRINTCONFIGUREDIALOGTEST_H
-
-#include <QObject>
-
-class PrintConfigureDialogTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintConfigureDialogTest(QObject *parent = Q_NULLPTR);
- ~PrintConfigureDialogTest();
-private Q_SLOTS:
- void shouldHaveDefaultValue();
-};
-
-#endif // PRINTCONFIGUREDIALOGTEST_H
diff --git a/webengineviewer/src/print/autotests/printconfigurewidgettest.cpp b/webengineviewer/src/print/autotests/printconfigurewidgettest.cpp
deleted file mode 100644
index a31ba36..0000000
--- a/webengineviewer/src/print/autotests/printconfigurewidgettest.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printconfigurewidgettest.h"
-#include "../printconfigurewidget.h"
-#include <QTest>
-#include <QLayout>
-#include <QLabel>
-#include <QToolButton>
-
-PrintConfigureWidgetTest::PrintConfigureWidgetTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintConfigureWidgetTest::~PrintConfigureWidgetTest()
-{
-
-}
-
-void PrintConfigureWidgetTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintConfigureWidget w;
- QCOMPARE(w.layout()->margin(), 0);
-
- QLabel *printLayoutLabel = w.findChild<QLabel *>(QStringLiteral("printlayoutlabel"));
- QVERIFY(printLayoutLabel);
- QVERIFY(!printLayoutLabel->text().isEmpty());
-
- QVBoxLayout *printLayout = w.findChild<QVBoxLayout *>(QStringLiteral("printLayout"));
- QVERIFY(printLayout);
- QCOMPARE(printLayout->margin(), 0);
-
- QToolButton *selectPrintLayout = w.findChild<QToolButton *>(QStringLiteral("selectprintlayout"));
- QVERIFY(selectPrintLayout);
-
- QVERIFY(w.currentPageLayout().isValid());
-}
-
-QTEST_MAIN(PrintConfigureWidgetTest)
diff --git a/webengineviewer/src/print/autotests/printconfigurewidgettest.h b/webengineviewer/src/print/autotests/printconfigurewidgettest.h
deleted file mode 100644
index f7202ee..0000000
--- a/webengineviewer/src/print/autotests/printconfigurewidgettest.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTCONFIGUREWIDGETTEST_H
-#define PRINTCONFIGUREWIDGETTEST_H
-
-#include <QObject>
-
-class PrintConfigureWidgetTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintConfigureWidgetTest(QObject *parent = Q_NULLPTR);
- ~PrintConfigureWidgetTest();
-private Q_SLOTS:
- void shouldHaveDefaultValue();
-};
-
-#endif // PRINTCONFIGUREWIDGETTEST_H
diff --git a/webengineviewer/src/print/autotests/printpreviewdialogtest.cpp b/webengineviewer/src/print/autotests/printpreviewdialogtest.cpp
deleted file mode 100644
index 8c2dfb6..0000000
--- a/webengineviewer/src/print/autotests/printpreviewdialogtest.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printpreviewdialogtest.h"
-#include "../printpreviewdialog.h"
-#include "../printpreviewpagewidget.h"
-#include <QTest>
-#include <QDialogButtonBox>
-#include <QPushButton>
-
-PrintPreviewDialogTest::PrintPreviewDialogTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintPreviewDialogTest::~PrintPreviewDialogTest()
-{
-
-}
-
-void PrintPreviewDialogTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintPreviewDialog dlg;
-
- WebEngineViewer::PrintPreviewPageWidget *widget = dlg.findChild<WebEngineViewer::PrintPreviewPageWidget *>(QStringLiteral("printpreviewwidget"));
- QVERIFY(widget);
- QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
- QVERIFY(buttonBox);
-
- QPushButton *printButton = buttonBox->findChild<QPushButton *>(QStringLiteral("printbutton"));
- QVERIFY(printButton);
-}
-
-QTEST_MAIN(PrintPreviewDialogTest)
diff --git a/webengineviewer/src/print/autotests/printpreviewdialogtest.h b/webengineviewer/src/print/autotests/printpreviewdialogtest.h
deleted file mode 100644
index 1702772..0000000
--- a/webengineviewer/src/print/autotests/printpreviewdialogtest.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWDIALOGTEST_H
-#define PRINTPREVIEWDIALOGTEST_H
-
-#include <QObject>
-
-class PrintPreviewDialogTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintPreviewDialogTest(QObject *parent = Q_NULLPTR);
- ~PrintPreviewDialogTest();
-private Q_SLOTS:
- void shouldHaveDefaultValue();
-};
-
-#endif // PRINTPREVIEWDIALOGTEST_H
diff --git a/webengineviewer/src/print/autotests/printpreviewpageviewertest.cpp b/webengineviewer/src/print/autotests/printpreviewpageviewertest.cpp
deleted file mode 100644
index 8d228f6..0000000
--- a/webengineviewer/src/print/autotests/printpreviewpageviewertest.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printpreviewpageviewertest.h"
-#include "../printpreviewpageviewer.h"
-
-#include <QLabel>
-#include <QTest>
-
-PrintPreviewPageViewerTest::PrintPreviewPageViewerTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintPreviewPageViewerTest::~PrintPreviewPageViewerTest()
-{
-
-}
-
-void PrintPreviewPageViewerTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintPreviewPageViewer page;
- QLabel *label = page.findChild<QLabel *>(QStringLiteral("page"));
- QVERIFY(label);
- QCOMPARE(page.zoom(), 1.0);
-}
-
-QTEST_MAIN(PrintPreviewPageViewerTest)
diff --git a/webengineviewer/src/print/autotests/printpreviewpageviewertest.h b/webengineviewer/src/print/autotests/printpreviewpageviewertest.h
deleted file mode 100644
index 4e2402b..0000000
--- a/webengineviewer/src/print/autotests/printpreviewpageviewertest.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWPAGEVIEWERTEST_H
-#define PRINTPREVIEWPAGEVIEWERTEST_H
-
-#include <QObject>
-
-class PrintPreviewPageViewerTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintPreviewPageViewerTest(QObject *parent = Q_NULLPTR);
- ~PrintPreviewPageViewerTest();
-private Q_SLOTS:
- void shouldHaveDefaultValue();
-};
-
-#endif // PRINTPREVIEWPAGEVIEWERTEST_H
diff --git a/webengineviewer/src/print/autotests/printpreviewpagewidgettest.cpp b/webengineviewer/src/print/autotests/printpreviewpagewidgettest.cpp
deleted file mode 100644
index e4ccde0..0000000
--- a/webengineviewer/src/print/autotests/printpreviewpagewidgettest.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printpreviewpagewidgettest.h"
-#include "../printpreviewpagewidget.h"
-#include "../printpreviewpageviewer.h"
-
-#include <QTest>
-#include <QLayout>
-#include <QHBoxLayout>
-#include <QLabel>
-#include <QComboBox>
-
-PrintPreviewPageWidgetTest::PrintPreviewPageWidgetTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintPreviewPageWidgetTest::~PrintPreviewPageWidgetTest()
-{
-
-}
-
-void PrintPreviewPageWidgetTest::shouldHaveNotMargin()
-{
- WebEngineViewer::PrintPreviewPageWidget w;
- QCOMPARE(w.layout()->margin(), 0);
-}
-
-void PrintPreviewPageWidgetTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintPreviewPageWidget w;
- WebEngineViewer::PrintPreviewPageViewer *page = w.findChild<WebEngineViewer::PrintPreviewPageViewer *>(QStringLiteral("printpreviewpage"));
- QVERIFY(page);
-
- QHBoxLayout *hbox = w.findChild<QHBoxLayout *>(QStringLiteral("layoutcombobox"));
- QVERIFY(hbox);
- QCOMPARE(hbox->margin(), 0);
-
- QLabel *lab = w.findChild<QLabel *>(QStringLiteral("labelcombobox"));
- QVERIFY(lab);
-
- QComboBox *mPageComboBox = w.findChild<QComboBox *>(QStringLiteral("pagecombobox"));
- QVERIFY(mPageComboBox);
- QCOMPARE(mPageComboBox->count(), 0);
-
- QVERIFY(!w.deleteFile());
-}
-
-QTEST_MAIN(PrintPreviewPageWidgetTest)
diff --git a/webengineviewer/src/print/autotests/printpreviewpagewidgettest.h b/webengineviewer/src/print/autotests/printpreviewpagewidgettest.h
deleted file mode 100644
index c58fa66..0000000
--- a/webengineviewer/src/print/autotests/printpreviewpagewidgettest.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWPAGEWIDGETTEST_H
-#define PRINTPREVIEWPAGEWIDGETTEST_H
-
-#include <QObject>
-
-class PrintPreviewPageWidgetTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintPreviewPageWidgetTest(QObject *parent = Q_NULLPTR);
- ~PrintPreviewPageWidgetTest();
-
-private Q_SLOTS:
- void shouldHaveNotMargin();
- void shouldHaveDefaultValue();
-};
-
-#endif // PRINTPREVIEWPAGEWIDGETTEST_H
diff --git a/webengineviewer/src/print/autotests/printselectpagedialogtest.cpp b/webengineviewer/src/print/autotests/printselectpagedialogtest.cpp
deleted file mode 100644
index c2be9ed..0000000
--- a/webengineviewer/src/print/autotests/printselectpagedialogtest.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printselectpagedialogtest.h"
-#include "../printselectpagewidget.h"
-#include "../printselectpagedialog.h"
-
-#include <QTest>
-#include <QVBoxLayout>
-#include <QDialogButtonBox>
-
-PrintSelectPageDialogTest::PrintSelectPageDialogTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintSelectPageDialogTest::~PrintSelectPageDialogTest()
-{
-
-}
-
-void PrintSelectPageDialogTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintSelectPageDialog dlg;
- QVBoxLayout *mainLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
- QVERIFY(mainLayout);
-
- WebEngineViewer::PrintSelectPageWidget *mPrintSelectPage = dlg.findChild<WebEngineViewer::PrintSelectPageWidget *>(QStringLiteral("printselectpage"));
- QVERIFY(mPrintSelectPage);
-
- QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
- QVERIFY(buttonBox);
-}
-
-QTEST_MAIN(PrintSelectPageDialogTest)
diff --git a/webengineviewer/src/print/autotests/printselectpagedialogtest.h b/webengineviewer/src/print/autotests/printselectpagedialogtest.h
deleted file mode 100644
index 7d525bb..0000000
--- a/webengineviewer/src/print/autotests/printselectpagedialogtest.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTSELECTPAGEDIALOGTEST_H
-#define PRINTSELECTPAGEDIALOGTEST_H
-
-#include <QObject>
-
-class PrintSelectPageDialogTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintSelectPageDialogTest(QObject *parent = Q_NULLPTR);
- ~PrintSelectPageDialogTest();
-
-private Q_SLOTS:
- void shouldHaveDefaultValue();
-};
-
-#endif // PRINTSELECTPAGEDIALOGTEST_H
diff --git a/webengineviewer/src/print/autotests/printselectpagewidgettest.cpp b/webengineviewer/src/print/autotests/printselectpagewidgettest.cpp
deleted file mode 100644
index c856fed..0000000
--- a/webengineviewer/src/print/autotests/printselectpagewidgettest.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printselectpagewidgettest.h"
-#include "../printselectpagewidget.h"
-#include <QListWidget>
-#include <QTest>
-#include <QVBoxLayout>
-
-PrintSelectPageWidgetTest::PrintSelectPageWidgetTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintSelectPageWidgetTest::~PrintSelectPageWidgetTest()
-{
-
-}
-
-void PrintSelectPageWidgetTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintSelectPageWidget w;
- QVBoxLayout *mainLayout = w.findChild<QVBoxLayout *>(QStringLiteral("mainlayout"));
- QVERIFY(mainLayout);
- QCOMPARE(mainLayout->margin(), 0);
-
- QListWidget *mListPage = w.findChild<QListWidget *>(QStringLiteral("listpage"));
- QVERIFY(mListPage);
- QCOMPARE(mListPage->count(), 0);
-}
-
-void PrintSelectPageWidgetTest::shouldHadItems()
-{
- WebEngineViewer::PrintSelectPageWidget w;
- QListWidget *mListPage = w.findChild<QListWidget *>(QStringLiteral("listpage"));
- w.setPages(5);
- QCOMPARE(mListPage->count(), 5);
-}
-
-void PrintSelectPageWidgetTest::shouldNotAddPages()
-{
- WebEngineViewer::PrintSelectPageWidget w;
- QListWidget *mListPage = w.findChild<QListWidget *>(QStringLiteral("listpage"));
- w.setPages(0);
- QCOMPARE(mListPage->count(), 0);
-}
-
-QTEST_MAIN(PrintSelectPageWidgetTest)
diff --git a/webengineviewer/src/print/autotests/printselectpagewidgettest.h b/webengineviewer/src/print/autotests/printselectpagewidgettest.h
deleted file mode 100644
index 4064762..0000000
--- a/webengineviewer/src/print/autotests/printselectpagewidgettest.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTSELECTPAGEWIDGETTEST_H
-#define PRINTSELECTPAGEWIDGETTEST_H
-
-#include <QObject>
-
-class PrintSelectPageWidgetTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintSelectPageWidgetTest(QObject *parent = Q_NULLPTR);
- ~PrintSelectPageWidgetTest();
-private Q_SLOTS:
- void shouldHaveDefaultValue();
- void shouldHadItems();
- void shouldNotAddPages();
-};
-
-#endif // PRINTSELECTPAGEWIDGETTEST_H
diff --git a/webengineviewer/src/print/autotests/printwebengineviewjobtest.cpp b/webengineviewer/src/print/autotests/printwebengineviewjobtest.cpp
deleted file mode 100644
index d15ac51..0000000
--- a/webengineviewer/src/print/autotests/printwebengineviewjobtest.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printwebengineviewjobtest.h"
-#include "../printwebengineviewjob.h"
-#include <QTest>
-#include <QSignalSpy>
-#include <QWebEngineView>
-
-PrintWebEngineViewJobTest::PrintWebEngineViewJobTest(QObject *parent)
- : QObject(parent)
-{
-
-}
-
-PrintWebEngineViewJobTest::~PrintWebEngineViewJobTest()
-{
-
-}
-
-void PrintWebEngineViewJobTest::shouldHaveDefaultValue()
-{
- WebEngineViewer::PrintWebEngineViewJob job;
- QVERIFY(!job.engineView());
- QVERIFY(!job.pageLayout().isValid());
-}
-
-void PrintWebEngineViewJobTest::shouldFailedWhenWebEngineIsNotDefined()
-{
- WebEngineViewer::PrintWebEngineViewJob job;
- QSignalSpy spyFailed(&job, SIGNAL(failed()));
- QSignalSpy spySuccess(&job, SIGNAL(success(QString)));
- job.start();
- QCOMPARE(spyFailed.count(), 1);
- QCOMPARE(spySuccess.count(), 0);
-}
-
-void PrintWebEngineViewJobTest::shouldFailedWhenPageLayoutIsNotDefined()
-{
- WebEngineViewer::PrintWebEngineViewJob job;
- QSignalSpy spyFailed(&job, SIGNAL(failed()));
- QSignalSpy spySuccess(&job, SIGNAL(success(QString)));
- job.setEngineView(new QWebEngineView());
- job.start();
- QCOMPARE(spyFailed.count(), 1);
- QCOMPARE(spySuccess.count(), 0);
-}
-
-QTEST_MAIN(PrintWebEngineViewJobTest)
diff --git a/webengineviewer/src/print/autotests/printwebengineviewjobtest.h b/webengineviewer/src/print/autotests/printwebengineviewjobtest.h
deleted file mode 100644
index 46f32a7..0000000
--- a/webengineviewer/src/print/autotests/printwebengineviewjobtest.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-#ifndef PRINTWEBENGINEVIEWJOBTEST_H
-#define PRINTWEBENGINEVIEWJOBTEST_H
-
-#include <QObject>
-
-class PrintWebEngineViewJobTest : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintWebEngineViewJobTest(QObject *parent = Q_NULLPTR);
- ~PrintWebEngineViewJobTest();
-private Q_SLOTS:
- void shouldHaveDefaultValue();
- void shouldFailedWhenWebEngineIsNotDefined();
- void shouldFailedWhenPageLayoutIsNotDefined();
-};
-
-#endif // PRINTWEBENGINEVIEWJOBTEST_H
diff --git a/webengineviewer/src/print/printconfiguredialog.cpp b/webengineviewer/src/print/printconfiguredialog.cpp
deleted file mode 100644
index 6a757e0..0000000
--- a/webengineviewer/src/print/printconfiguredialog.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printconfiguredialog.h"
-#include "printconfigurewidget.h"
-#include <QDialogButtonBox>
-#include <QVBoxLayout>
-#include <KLocalizedString>
-
-using namespace WebEngineViewer;
-
-PrintConfigureDialog::PrintConfigureDialog(QWidget *parent)
- : QDialog(parent)
-{
- setWindowTitle(i18n("Print Setup"));
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
-
- mConfigureWidget = new PrintConfigureWidget(this);
- mConfigureWidget->setObjectName(QStringLiteral("configurewidget"));
- mainLayout->addWidget(mConfigureWidget);
-
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
- buttonBox->setObjectName(QStringLiteral("buttonBox"));
- mainLayout->addWidget(buttonBox);
-
- connect(buttonBox, &QDialogButtonBox::accepted, this, &PrintConfigureDialog::accept);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &PrintConfigureDialog::reject);
-}
-
-PrintConfigureDialog::~PrintConfigureDialog()
-{
-
-}
-
-QPageLayout PrintConfigureDialog::currentPageLayout() const
-{
- return mConfigureWidget->currentPageLayout();
-}
diff --git a/webengineviewer/src/print/printconfiguredialog.h b/webengineviewer/src/print/printconfiguredialog.h
deleted file mode 100644
index 79dae85..0000000
--- a/webengineviewer/src/print/printconfiguredialog.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTCONFIGUREDIALOG_H
-#define PRINTCONFIGUREDIALOG_H
-
-#include "webengineviewer_export.h"
-#include <QDialog>
-#include <QPageLayout>
-
-namespace WebEngineViewer
-{
-class PrintConfigureWidget;
-class WEBENGINEVIEWER_EXPORT PrintConfigureDialog : public QDialog
-{
- Q_OBJECT
-public:
- explicit PrintConfigureDialog(QWidget *parent = Q_NULLPTR);
- ~PrintConfigureDialog();
- QPageLayout currentPageLayout() const;
-private:
- PrintConfigureWidget *mConfigureWidget;
-};
-}
-#endif // PRINTCONFIGUREDIALOG_H
diff --git a/webengineviewer/src/print/printconfigurewidget.cpp b/webengineviewer/src/print/printconfigurewidget.cpp
deleted file mode 100644
index afa79bb..0000000
--- a/webengineviewer/src/print/printconfigurewidget.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printconfigurewidget.h"
-#include "webengineviewer_debug.h"
-#include <QHBoxLayout>
-#include <KLocalizedString>
-#include <QLabel>
-#include <QToolButton>
-#include <QPageSetupDialog>
-#include <QPrinter>
-
-using namespace WebEngineViewer;
-
-PrintConfigureWidget::PrintConfigureWidget(QWidget *parent)
- : QWidget(parent),
- mCurrentPageLayout(QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0.0, 0.0, 0.0, 0.0)))
-{
- QHBoxLayout *layout = new QHBoxLayout;
- layout->setMargin(0);
- setLayout(layout);
-
- QVBoxLayout *printLayout = new QVBoxLayout;
- printLayout->setObjectName(QStringLiteral("printLayout"));
- layout->addLayout(printLayout);
- printLayout->setMargin(0);
-
- mPrintLayoutLabel = new QLabel(this);
- mPrintLayoutLabel->setObjectName(QStringLiteral("printlayoutlabel"));
- layout->addWidget(mPrintLayoutLabel);
-
- mSelectPrintLayout = new QToolButton(this);
- mSelectPrintLayout->setText(i18n("..."));
- mSelectPrintLayout->setObjectName(QStringLiteral("selectprintlayout"));
- mSelectPrintLayout->setToolTip(i18n("Select Print Layout"));
- layout->addWidget(mSelectPrintLayout);
- connect(mSelectPrintLayout, &QToolButton::clicked, this, &PrintConfigureWidget::slotSelectPrintLayout);
-
- updatePageLayoutLabel();
-}
-
-PrintConfigureWidget::~PrintConfigureWidget()
-{
-
-}
-
-void PrintConfigureWidget::slotSelectPrintLayout()
-{
- QPrinter printer;
-
- if (!printer.setPageLayout(mCurrentPageLayout)) {
- qCDebug(WEBENGINEVIEWER_LOG) << "Print Setup unsupported";
- }
- QPageSetupDialog dlg(&printer, this);
- if (dlg.exec() != QDialog::Accepted) {
- return;
- }
- mCurrentPageLayout = printer.pageLayout();
- updatePageLayoutLabel();
-}
-
-QPageLayout PrintConfigureWidget::currentPageLayout() const
-{
- return mCurrentPageLayout;
-}
-
-void PrintConfigureWidget::updatePageLayoutLabel()
-{
- mPrintLayoutLabel->setText(i18n("Print Layout: %1, %2",
- mCurrentPageLayout.pageSize().name(),
- mCurrentPageLayout.orientation() == QPageLayout::Portrait
- ? i18n("Portrait") : i18n("Landscape")));
-}
diff --git a/webengineviewer/src/print/printconfigurewidget.h b/webengineviewer/src/print/printconfigurewidget.h
deleted file mode 100644
index f2b5243..0000000
--- a/webengineviewer/src/print/printconfigurewidget.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTCONFIGUREWIDGET_H
-#define PRINTCONFIGUREWIDGET_H
-
-#include <QWidget>
-#include <QPageLayout>
-class QLabel;
-class QToolButton;
-namespace WebEngineViewer
-{
-class PrintConfigureWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit PrintConfigureWidget(QWidget *parent = Q_NULLPTR);
- ~PrintConfigureWidget();
-
- QPageLayout currentPageLayout() const;
-
-private Q_SLOTS:
- void slotSelectPrintLayout();
-
-private:
- void updatePageLayoutLabel();
- QPageLayout mCurrentPageLayout;
- QLabel *mPrintLayoutLabel;
- QToolButton *mSelectPrintLayout;
-};
-}
-#endif // PRINTCONFIGUREWIDGET_H
diff --git a/webengineviewer/src/print/printpreviewdialog.cpp b/webengineviewer/src/print/printpreviewdialog.cpp
deleted file mode 100644
index 2b2db13..0000000
--- a/webengineviewer/src/print/printpreviewdialog.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printpreviewdialog.h"
-#include "printselectpagedialog.h"
-#include "printpreviewpagewidget.h"
-#include "webengineviewer_debug.h"
-#include <KLocalizedString>
-#include <QVBoxLayout>
-#include <KConfigGroup>
-#include <KSharedConfig>
-#include <QDialogButtonBox>
-#include <QPushButton>
-#include <QPointer>
-
-using namespace WebEngineViewer;
-
-PrintPreviewDialog::PrintPreviewDialog(QWidget *parent)
- : QDialog(parent)
-{
- setWindowTitle(i18n("Preview"));
- QVBoxLayout *layout = new QVBoxLayout;
- setLayout(layout);
-
- mPrintPreviewWidget = new PrintPreviewPageWidget(this);
- mPrintPreviewWidget->setObjectName(QStringLiteral("printpreviewwidget"));
- layout->addWidget(mPrintPreviewWidget);
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
- mPrintButton = new QPushButton(i18n("Print"));
- mPrintButton->setObjectName(QStringLiteral("printbutton"));
- connect(mPrintButton, &QPushButton::clicked, this, &PrintPreviewDialog::slotPrint);
- buttonBox->addButton(mPrintButton, QDialogButtonBox::ActionRole);
- buttonBox->setObjectName(QStringLiteral("buttonbox"));
- layout->addWidget(buttonBox);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &PrintPreviewDialog::reject);
- readConfig();
-}
-
-PrintPreviewDialog::~PrintPreviewDialog()
-{
- writeConfig();
-}
-
-void PrintPreviewDialog::writeConfig()
-{
- KConfigGroup group(KSharedConfig::openConfig(), "PrintPreviewDialog");
- group.writeEntry("Size", size());
- group.sync();
-}
-
-void PrintPreviewDialog::readConfig()
-{
- KConfigGroup group(KSharedConfig::openConfig(), "PrintPreviewDialog");
-
- const QSize size = group.readEntry("Size", QSize(500, 300));
- if (size.isValid()) {
- resize(size);
- }
-}
-
-void PrintPreviewDialog::loadFile(const QString &path, bool deleteFile)
-{
- if (!mPrintPreviewWidget->loadFile(path, deleteFile)) {
- mPrintButton->setEnabled(false);
- }
-}
-
-void PrintPreviewDialog::slotPrint()
-{
- QList<int> lstPages;
- if (mPrintPreviewWidget->pageCount() > 1) {
- QPointer<WebEngineViewer::PrintSelectPageDialog> dlg = new WebEngineViewer::PrintSelectPageDialog(this);
- dlg->setPages(mPrintPreviewWidget->pageCount());
- if (dlg->exec()) {
- lstPages = dlg->pages();
- }
- delete dlg;
- } else {
- lstPages.append(0);
- }
-
- if (!lstPages.isEmpty()) {
- mPrintPreviewWidget->print(lstPages);
- }
- accept();
-}
diff --git a/webengineviewer/src/print/printpreviewdialog.h b/webengineviewer/src/print/printpreviewdialog.h
deleted file mode 100644
index c5d16d0..0000000
--- a/webengineviewer/src/print/printpreviewdialog.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWDIALOG_H
-#define PRINTPREVIEWDIALOG_H
-
-#include <QDialog>
-#include <webengineviewer_export.h>
-namespace WebEngineViewer
-{
-class PrintPreviewPageWidget;
-class WEBENGINEVIEWER_EXPORT PrintPreviewDialog : public QDialog
-{
- Q_OBJECT
-public:
- explicit PrintPreviewDialog(QWidget *parent = Q_NULLPTR);
- ~PrintPreviewDialog();
- void loadFile(const QString &path, bool deleteFile = false);
-
-private Q_SLOTS:
- void slotPrint();
-
-private:
- void writeConfig();
- void readConfig();
- PrintPreviewPageWidget *mPrintPreviewWidget;
- QPushButton *mPrintButton;
-};
-}
-
-#endif // PRINTPREVIEWDIALOG_H
diff --git a/webengineviewer/src/print/printpreviewpageviewer.cpp b/webengineviewer/src/print/printpreviewpageviewer.cpp
deleted file mode 100644
index 463f1a8..0000000
--- a/webengineviewer/src/print/printpreviewpageviewer.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printpreviewpageviewer.h"
-#include <poppler-qt5.h>
-
-#include <QLabel>
-#include <QApplication>
-#include <QDesktopWidget>
-#include <QWheelEvent>
-#include <QShortcut>
-
-using namespace WebEngineViewer;
-
-PrintPreviewPageViewer::PrintPreviewPageViewer(QWidget *parent)
- : QScrollArea(parent),
- mDpiX(QApplication::desktop()->physicalDpiX()),
- mDpiY(QApplication::desktop()->physicalDpiY()),
- mZoom(1.0)
-{
- mImage = new QLabel(this);
- mImage->setObjectName(QStringLiteral("page"));
- mImage->resize(0, 0);
- setWidget(mImage);
- initializeActions();
-}
-
-PrintPreviewPageViewer::~PrintPreviewPageViewer()
-{
-
-}
-
-void PrintPreviewPageViewer::initializeActions()
-{
- QShortcut *shortcut = new QShortcut(this);
- shortcut->setKey(QKeySequence(Qt::Key_PageUp));
- connect(shortcut, &QShortcut::activated, this, &PrintPreviewPageViewer::pageUp);
-
- shortcut = new QShortcut(this);
- shortcut->setKey(QKeySequence(Qt::Key_PageDown));
- connect(shortcut, &QShortcut::activated, this, &PrintPreviewPageViewer::pageDown);
-}
-
-void PrintPreviewPageViewer::showPage(Poppler::Page *page)
-{
- const double resX = mDpiX * mZoom;
- const double resY = mDpiY * mZoom;
-
- const QImage image = page->renderToImage(resX, resY);
- if (!image.isNull()) {
- mImage->resize(image.size());
- mImage->setPixmap(QPixmap::fromImage(image));
- } else {
- mImage->resize(0, 0);
- mImage->setPixmap(QPixmap());
- }
-}
-
-void PrintPreviewPageViewer::setZoom(qreal zoom)
-{
- if (mZoom != zoom) {
- mZoom = zoom;
- Q_EMIT reloadPage();
- }
-}
-
-qreal PrintPreviewPageViewer::zoom() const
-{
- return mZoom;
-}
-
-void PrintPreviewPageViewer::wheelEvent(QWheelEvent *e)
-{
- if (QApplication::keyboardModifiers() & Qt::ControlModifier) {
- const int numDegrees = e->delta() / 8;
- const int numSteps = numDegrees / 15;
-
- const qreal factor = (mZoom * 100) + numSteps * 10;
- if (factor >= 10 && factor <= 300) {
- setZoom(factor / 100);
- }
- e->accept();
- return;
- }
- QScrollArea::wheelEvent(e);
-}
diff --git a/webengineviewer/src/print/printpreviewpageviewer.h b/webengineviewer/src/print/printpreviewpageviewer.h
deleted file mode 100644
index 98a2282..0000000
--- a/webengineviewer/src/print/printpreviewpageviewer.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWPAGEVIEWER_H
-#define PRINTPREVIEWPAGEVIEWER_H
-
-#include <QScrollArea>
-
-class QLabel;
-namespace Poppler
-{
-class Page;
-}
-namespace WebEngineViewer
-{
-class PrintPreviewPageViewer : public QScrollArea
-{
- Q_OBJECT
-public:
- explicit PrintPreviewPageViewer(QWidget *parent = Q_NULLPTR);
- ~PrintPreviewPageViewer();
-
- void showPage(Poppler::Page *page);
-
- void setZoom(qreal zoom);
- qreal zoom() const;
-
-Q_SIGNALS:
- void reloadPage();
- void pageDown();
- void pageUp();
-
-protected:
- void wheelEvent(QWheelEvent *e) Q_DECL_OVERRIDE;
-
-private:
- void initializeActions();
- int mDpiX;
- int mDpiY;
- qreal mZoom;
- QLabel *mImage;
-};
-}
-
-#endif // PRINTPREVIEWPAGEVIEWER_H
diff --git a/webengineviewer/src/print/printpreviewpagewidget.cpp b/webengineviewer/src/print/printpreviewpagewidget.cpp
deleted file mode 100644
index 20b6ee8..0000000
--- a/webengineviewer/src/print/printpreviewpagewidget.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printpreviewpagewidget.h"
-#include "printpreviewpageviewer.h"
-#include "webengineviewer_debug.h"
-
-#include <poppler-qt5.h>
-
-#include <QLabel>
-#include <QDir>
-#include <QComboBox>
-#include <QDebug>
-#include <QFile>
-#include <QVBoxLayout>
-#include <KMessageBox>
-#include <KLocalizedString>
-
-using namespace WebEngineViewer;
-
-PrintPreviewPageWidget::PrintPreviewPageWidget(QWidget *parent)
- : QWidget(parent),
- mDeleteFile(false),
- mDoc(Q_NULLPTR),
- mPageCount(0)
-{
- QVBoxLayout *layout = new QVBoxLayout;
- layout->setMargin(0);
-
- QHBoxLayout *hbox = new QHBoxLayout;
- hbox->setObjectName(QStringLiteral("layoutcombobox"));
- hbox->setMargin(0);
- layout->addLayout(hbox);
- mPageComboboxLab = new QLabel(i18n("Page:"), this);
- mPageComboboxLab->setObjectName(QStringLiteral("labelcombobox"));
- hbox->addWidget(mPageComboboxLab);
-
- mPageComboBox = new QComboBox(this);
- mPageComboBox->setObjectName(QStringLiteral("pagecombobox"));
- hbox->addWidget(mPageComboBox);
- hbox->addStretch(1);
- connect(mPageComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(showPage(int)));
-
- mPrintPreviewPage = new PrintPreviewPageViewer(this);
- mPrintPreviewPage->setObjectName(QStringLiteral("printpreviewpage"));
- layout->addWidget(mPrintPreviewPage);
- connect(mPrintPreviewPage, &PrintPreviewPageViewer::reloadPage, this, &PrintPreviewPageWidget::slotReloadPage);
- connect(mPrintPreviewPage, &PrintPreviewPageViewer::pageDown, this, &PrintPreviewPageWidget::slotPageDown);
- connect(mPrintPreviewPage, &PrintPreviewPageViewer::pageUp, this, &PrintPreviewPageWidget::slotPageUp);
-
- setLayout(layout);
-}
-
-PrintPreviewPageWidget::~PrintPreviewPageWidget()
-{
- if (mDeleteFile && !mFilePath.isEmpty()) {
- QFile file(mFilePath);
- bool removeFile = file.remove();
- if (removeFile) {
- qCWarning(WEBENGINEVIEWER_LOG) << "File removed " << mFilePath;
- } else {
- qCWarning(WEBENGINEVIEWER_LOG) << "Impossible to remove file " << mFilePath;
- }
- }
- delete mDoc;
- mDoc = Q_NULLPTR;
-}
-
-bool PrintPreviewPageWidget::loadFile(const QString &path, bool deleteFile)
-{
- if (path.isEmpty()) {
- return false;
- }
- mDeleteFile = deleteFile;
- mFilePath = path;
- mDoc = Poppler::Document::load(path);
- if (!mDoc) {
- KMessageBox::error(this, i18n("Unable to open file \"%1\"", path), i18n("Open file error"));
- return false;
- }
- mDoc->setRenderHint(Poppler::Document::TextAntialiasing, true);
- mDoc->setRenderHint(Poppler::Document::Antialiasing, true);
-
- fillComboBox();
-
- showPage(0);
- return true;
-}
-
-void PrintPreviewPageWidget::fillComboBox()
-{
- mPageComboBox->clear();
- mPageCount = mDoc->numPages();
- if (mPageCount == 1) {
- mPageComboBox->hide();
- mPageComboboxLab->hide();
- } else {
- for (int i = 0; i < mPageCount; ++i) {
- mPageComboBox->addItem(QString::number(i + 1));
- }
- }
-}
-
-int PrintPreviewPageWidget::pageCount() const
-{
- return mPageCount;
-}
-
-bool PrintPreviewPageWidget::deleteFile() const
-{
- return mDeleteFile;
-}
-
-void PrintPreviewPageWidget::showPage(int index)
-{
- if (index >= 0) {
- Poppler::Page *popplerPage = mDoc->page(index);
- mPrintPreviewPage->showPage(popplerPage);
- delete popplerPage;
- }
-}
-
-void PrintPreviewPageWidget::print(const QList<int> &pages)
-{
-#if 0
- Poppler::PSConverter *psConverter = mDoc->psConverter();
- QTemporaryFile tf(QDir::tempPath() + QLatin1String("/kmail_XXXXXX.ps"));
- if (!tf.open()) {
-
- }
- psConverter->setPageList(pages);
- psConverter->setRightMargin(0);
- psConverter->setBottomMargin(0);
- psConverter->setLeftMargin(0);
- psConverter->setTopMargin(0);
- psConverter->setStrictMargins(false);
- psConverter->setPSOptions(psConverter->psOptions() | Poppler::PSConverter::HideAnnotations);
- if (psConverter->convert()) {
- if (!QStandardPaths::findExecutable(QStringLiteral("lpr-cups")).isEmpty()) {
- exe = QStringLiteral("lpr-cups");
- } else if (!QStandardPaths::findExecutable(QStringLiteral("lpr.cups")).isEmpty()) {
- exe = QStringLiteral("lpr.cups");
- } else if (!QStandardPaths::findExecutable(QStringLiteral("lpr")).isEmpty()) {
- exe = QStringLiteral("lpr");
- } else if (!QStandardPaths::findExecutable(QStringLiteral("lp")).isEmpty()) {
- exe = QStringLiteral("lp");
- } else {
-
- }
- delete psConverter;
-#else
- qDebug() << " void PrintPreviewPageWidget::print(const QList<int> &page) not implemented";
-#endif
- //TODO
- }
-
- void PrintPreviewPageWidget::slotReloadPage()
- {
- const int currentIndex = mPageComboBox->currentIndex();
- showPage(currentIndex == -1 ? 0 : currentIndex);
- }
-
- void PrintPreviewPageWidget::slotPageDown()
- {
- const int currentIndex = mPageComboBox->currentIndex();
- if (currentIndex != -1) {
- const int newIndex = currentIndex + 1;
- if (newIndex < mPageComboBox->count()) {
- mPageComboBox->setCurrentIndex(newIndex);
- }
- }
- }
-
- void PrintPreviewPageWidget::slotPageUp()
- {
- const int currentIndex = mPageComboBox->currentIndex();
- if (currentIndex != -1) {
- const int newIndex = currentIndex - 1;
- if (newIndex >= 0) {
- mPageComboBox->setCurrentIndex(newIndex);
- }
- }
- }
diff --git a/webengineviewer/src/print/printpreviewpagewidget.h b/webengineviewer/src/print/printpreviewpagewidget.h
deleted file mode 100644
index 7c07d7c..0000000
--- a/webengineviewer/src/print/printpreviewpagewidget.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWPAGEWIDGET_H
-#define PRINTPREVIEWPAGEWIDGET_H
-
-#include <QWidget>
-
-class QComboBox;
-class QLabel;
-namespace Poppler
-{
-class Document;
-}
-namespace WebEngineViewer
-{
-class PrintPreviewPageViewer;
-class PrintPreviewPageWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit PrintPreviewPageWidget(QWidget *parent = Q_NULLPTR);
- ~PrintPreviewPageWidget();
-
- bool loadFile(const QString &path, bool deleteFile = false);
-
- void print(const QList<int> &page);
- bool deleteFile() const;
-
- int pageCount() const;
-
-private Q_SLOTS:
- void showPage(int index);
- void slotReloadPage();
- void slotPageDown();
- void slotPageUp();
-
-private:
- void fillComboBox();
- QString mFilePath;
- bool mDeleteFile;
- PrintPreviewPageViewer *mPrintPreviewPage;
- Poppler::Document *mDoc;
- QComboBox *mPageComboBox;
- QLabel *mPageComboboxLab;
- int mPageCount;
-};
-}
-#endif // PRINTPREVIEWPAGEWIDGET_H
diff --git a/webengineviewer/src/print/printselectpagedialog.cpp b/webengineviewer/src/print/printselectpagedialog.cpp
deleted file mode 100644
index 6075aa4..0000000
--- a/webengineviewer/src/print/printselectpagedialog.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printselectpagedialog.h"
-#include "printselectpagewidget.h"
-
-#include <KConfigGroup>
-#include <KSharedConfig>
-#include <QVBoxLayout>
-#include <QDialogButtonBox>
-
-using namespace WebEngineViewer;
-
-PrintSelectPageDialog::PrintSelectPageDialog(QWidget *parent)
- : QDialog(parent)
-{
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->setObjectName(QStringLiteral("mainlayout"));
- mPrintSelectPage = new PrintSelectPageWidget(this);
- mPrintSelectPage->setObjectName(QStringLiteral("printselectpage"));
- mainLayout->addWidget(mPrintSelectPage);
-
- QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
- buttonBox->setObjectName(QStringLiteral("buttonbox"));
- mainLayout->addWidget(buttonBox);
- connect(buttonBox, &QDialogButtonBox::accepted, this, &PrintSelectPageDialog::accept);
- connect(buttonBox, &QDialogButtonBox::rejected, this, &PrintSelectPageDialog::reject);
- readConfig();
-}
-
-PrintSelectPageDialog::~PrintSelectPageDialog()
-{
- writeConfig();
-}
-
-void PrintSelectPageDialog::writeConfig()
-{
- KConfigGroup group(KSharedConfig::openConfig(), "PrintSelectPageDialog");
- group.writeEntry("Size", size());
- group.sync();
-}
-
-void PrintSelectPageDialog::readConfig()
-{
- KConfigGroup group(KSharedConfig::openConfig(), "PrintSelectPageDialog");
-
- const QSize size = group.readEntry("Size", QSize(500, 300));
- if (size.isValid()) {
- resize(size);
- }
-}
-
-QList<int> PrintSelectPageDialog::pages() const
-{
- return mPrintSelectPage->pages();
-}
-
-void PrintSelectPageDialog::setPages(int pages)
-{
- mPrintSelectPage->setPages(pages);
-}
diff --git a/webengineviewer/src/print/printselectpagedialog.h b/webengineviewer/src/print/printselectpagedialog.h
deleted file mode 100644
index 6c878cf..0000000
--- a/webengineviewer/src/print/printselectpagedialog.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTSELECTPAGEDIALOG_H
-#define PRINTSELECTPAGEDIALOG_H
-
-#include <QDialog>
-
-namespace WebEngineViewer
-{
-class PrintSelectPageWidget;
-class PrintSelectPageDialog : public QDialog
-{
- Q_OBJECT
-public:
- explicit PrintSelectPageDialog(QWidget *parent = Q_NULLPTR);
- ~PrintSelectPageDialog();
-
- QList<int> pages() const;
- void setPages(int pages);
-private:
- void writeConfig();
- void readConfig();
- PrintSelectPageWidget *mPrintSelectPage;
-};
-}
-
-#endif // PRINTSELECTPAGEDIALOG_H
diff --git a/webengineviewer/src/print/printselectpagewidget.cpp b/webengineviewer/src/print/printselectpagewidget.cpp
deleted file mode 100644
index 66c6ca1..0000000
--- a/webengineviewer/src/print/printselectpagewidget.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printselectpagewidget.h"
-#include <QVBoxLayout>
-#include <KLocalizedString>
-#include <QListWidget>
-
-using namespace WebEngineViewer;
-PrintSelectPageWidget::PrintSelectPageWidget(QWidget *parent)
- : QWidget(parent)
-{
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->setObjectName(QStringLiteral("mainlayout"));
- mainLayout->setMargin(0);
-
- mListPage = new QListWidget(this);
- mListPage->setObjectName(QStringLiteral("listpage"));
- mainLayout->addWidget(mListPage);
-}
-
-PrintSelectPageWidget::~PrintSelectPageWidget()
-{
-
-}
-
-void PrintSelectPageWidget::setPages(int page)
-{
- for (int i = 0; i < page; ++i) {
- QListWidgetItem *item = new QListWidgetItem(i18n("Page %1", (i + 1)), mListPage);
- item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
- item->setCheckState(Qt::Unchecked);
- item->setData(PageIndex, i);
- }
-}
-
-QList<int> PrintSelectPageWidget::pages() const
-{
- QList<int> listPages;
- for (int i = 0; i < mListPage->count(); ++i) {
- QListWidgetItem *item = mListPage->item(i);
- if (item->checkState() == Qt::Checked) {
- listPages.append(item->data(PageIndex).toInt());
- }
- }
- return listPages;
-}
diff --git a/webengineviewer/src/print/printselectpagewidget.h b/webengineviewer/src/print/printselectpagewidget.h
deleted file mode 100644
index 58704a6..0000000
--- a/webengineviewer/src/print/printselectpagewidget.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTSELECTPAGEWIDGET_H
-#define PRINTSELECTPAGEWIDGET_H
-
-#include <QWidget>
-class QListWidget;
-namespace WebEngineViewer
-{
-class PrintSelectPageWidget : public QWidget
-{
- Q_OBJECT
-public:
- explicit PrintSelectPageWidget(QWidget *parent = Q_NULLPTR);
- ~PrintSelectPageWidget();
-
- QList<int> pages() const;
- void setPages(int page);
-
-private:
- enum TypeItem {
- PageIndex = Qt::UserRole + 1
- };
-
- QListWidget *mListPage;
-};
-}
-#endif // PRINTSELECTPAGEWIDGET_H
diff --git a/webengineviewer/src/print/printwebengineviewjob.cpp b/webengineviewer/src/print/printwebengineviewjob.cpp
deleted file mode 100644
index 553d9e9..0000000
--- a/webengineviewer/src/print/printwebengineviewjob.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printwebengineviewjob.h"
-#include "webengineviewer_debug.h"
-#include <QWebEngineView>
-
-using namespace WebEngineViewer;
-
-template<typename Arg, typename R, typename C>
-struct InvokeWrapper {
- R *receiver;
- void (C::*memberFun)(Arg);
- void operator()(Arg result)
- {
- (receiver->*memberFun)(result);
- }
-};
-
-template<typename Arg, typename R, typename C>
-InvokeWrapper<Arg, R, C> invoke(R *receiver, void (C::*memberFun)(Arg))
-{
- InvokeWrapper<Arg, R, C> wrapper = {receiver, memberFun};
- return wrapper;
-}
-
-PrintWebEngineViewJob::PrintWebEngineViewJob(QObject *parent)
- : QObject(parent),
- mEngineView(Q_NULLPTR)
-{
-
-}
-
-PrintWebEngineViewJob::~PrintWebEngineViewJob()
-{
-
-}
-
-void PrintWebEngineViewJob::unableToPrint()
-{
- Q_EMIT failed();
- deleteLater();
-}
-
-void PrintWebEngineViewJob::start()
-{
- if (mEngineView) {
- if (!mTemporaryFile.open()) {
- unableToPrint();
- } else {
- if (mPageLayout.isValid()) {
- mTemporaryFile.setAutoRemove(false);
-#if QT_VERSION >= 0x050700
- mEngineView->page()->printToPdf(invoke(this, &PrintWebEngineViewJob::slotHandlePdfPrinted), mPageLayout);
-#else
- unableToPrint();
-#endif
- } else {
- unableToPrint();
- }
- }
- } else {
- unableToPrint();
- }
-}
-
-void PrintWebEngineViewJob::slotHandlePdfPrinted(const QByteArray &result)
-{
- if (result.isEmpty()) {
- return;
- }
-
- QFile file(mTemporaryFile.fileName());
- if (!file.open(QFile::WriteOnly)) {
- qCDebug(WEBENGINEVIEWER_LOG) << "unable to open temporary file";
- unableToPrint();
- return;
- }
-
- file.write(result.data(), result.size());
- file.close();
- Q_EMIT success(mTemporaryFile.fileName());
- deleteLater();
-}
-
-QPageLayout PrintWebEngineViewJob::pageLayout() const
-{
- return mPageLayout;
-}
-
-QWebEngineView *PrintWebEngineViewJob::engineView() const
-{
- return mEngineView;
-}
-
-void PrintWebEngineViewJob::setEngineView(QWebEngineView *engineView)
-{
- mEngineView = engineView;
-}
-
-void PrintWebEngineViewJob::setPageLayout(const QPageLayout &pageLayout)
-{
- mPageLayout = pageLayout;
-}
diff --git a/webengineviewer/src/print/printwebengineviewjob.h b/webengineviewer/src/print/printwebengineviewjob.h
deleted file mode 100644
index cd67110..0000000
--- a/webengineviewer/src/print/printwebengineviewjob.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTWEBENGINEVIEWJOB_H
-#define PRINTWEBENGINEVIEWJOB_H
-
-#include "webengineviewer_export.h"
-
-#include <QObject>
-#include <QPageLayout>
-#include <QTemporaryFile>
-
-class QWebEngineView;
-namespace WebEngineViewer
-{
-class WEBENGINEVIEWER_EXPORT PrintWebEngineViewJob : public QObject
-{
- Q_OBJECT
-public:
- explicit PrintWebEngineViewJob(QObject *parent = Q_NULLPTR);
- ~PrintWebEngineViewJob();
-
- void start();
-
- QWebEngineView *engineView() const;
- void setEngineView(QWebEngineView *engineView);
-
- void setPageLayout(const QPageLayout &pageLayout);
-
- QPageLayout pageLayout() const;
-
-Q_SIGNALS:
- void failed();
- void success(const QString &temporaryFileName);
-
-private Q_SLOTS:
- void slotHandlePdfPrinted(const QByteArray &result);
-
-private:
- void unableToPrint();
- QPageLayout mPageLayout;
- QTemporaryFile mTemporaryFile;
- QWebEngineView *mEngineView;
-};
-}
-#endif // PRINTWEBENGINEVIEWJOB_H
diff --git a/webengineviewer/src/print/tests/CMakeLists.txt b/webengineviewer/src/print/tests/CMakeLists.txt
deleted file mode 100644
index c72ee8f..0000000
--- a/webengineviewer/src/print/tests/CMakeLists.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-set(print_test_SRCS)
-ecm_qt_declare_logging_category(print_test_SRCS HEADER webengineviewer_debug.h IDENTIFIER WEBENGINEVIEWER_LOG CATEGORY_NAME log_webengineviewer)
-
-set(printpreviewdialog_gui_test_SRCS
- printpreviewdialog_gui.cpp
- ../printpreviewdialog.cpp
- ../printpreviewpageviewer.cpp
- ../printpreviewpagewidget.cpp
- ../printselectpagedialog.cpp
- ../printselectpagewidget.cpp
- ${print_test_SRCS}
- )
-
-add_executable(printpreviewdialog_gui ${printpreviewdialog_gui_test_SRCS})
-
-target_link_libraries(printpreviewdialog_gui
- Qt5::Widgets
- Qt5::Gui
- KF5::I18n
- KF5::WidgetsAddons
- Poppler::Qt5
- KF5::ConfigCore
- )
-
-#########
-set(printwebenginetest_gui_test_SRCS
- printwebenginetest_gui.cpp
- ../printpreviewdialog.cpp
- ../printpreviewpageviewer.cpp
- ../printpreviewpagewidget.cpp
- ../printwebengineviewjob.cpp
- ../printconfiguredialog.cpp
- ../printconfigurewidget.cpp
- ../printselectpagedialog.cpp
- ../printselectpagewidget.cpp
- ${print_test_SRCS}
- )
-
-add_executable(printwebenginetest_gui ${printwebenginetest_gui_test_SRCS})
-
-target_link_libraries(printwebenginetest_gui
- Qt5::Widgets
- Qt5::Gui
- KF5::I18n
- KF5::WidgetsAddons
- Poppler::Qt5
- KF5::ConfigCore
- Qt5::PrintSupport
- Qt5::WebEngineWidgets
- Qt5::WebEngine
- )
diff --git a/webengineviewer/src/print/tests/printpreviewdialog_gui.cpp b/webengineviewer/src/print/tests/printpreviewdialog_gui.cpp
deleted file mode 100644
index 5c81647..0000000
--- a/webengineviewer/src/print/tests/printpreviewdialog_gui.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "../printpreviewdialog.h"
-
-#include <QApplication>
-#include <QStandardPaths>
-#include <QFileDialog>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QStandardPaths::setTestModeEnabled(true);
- app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
- const QString filename = QFileDialog::getOpenFileName(0, QStringLiteral("Open PDF"), QString(), QStringLiteral("*.pdf"));
- WebEngineViewer::PrintPreviewDialog dlg;
- dlg.loadFile(filename);
- dlg.show();
- const int ret = app.exec();
- return ret;
-}
diff --git a/webengineviewer/src/print/tests/printpreviewdialog_gui.h b/webengineviewer/src/print/tests/printpreviewdialog_gui.h
deleted file mode 100644
index 71d793d..0000000
--- a/webengineviewer/src/print/tests/printpreviewdialog_gui.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTPREVIEWDIALOG_GUI_H
-#define PRINTPREVIEWDIALOG_GUI_H
-
-#endif // PRINTPREVIEWDIALOG_GUI_H
diff --git a/webengineviewer/src/print/tests/printwebenginetest_gui.cpp b/webengineviewer/src/print/tests/printwebenginetest_gui.cpp
deleted file mode 100644
index 8d25ac3..0000000
--- a/webengineviewer/src/print/tests/printwebenginetest_gui.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#include "printwebenginetest_gui.h"
-#include "../printwebengineviewjob.h"
-#include "../printconfiguredialog.h"
-#include "../printpreviewdialog.h"
-
-#include <QApplication>
-#include <QStandardPaths>
-#include <QVBoxLayout>
-#include <QPushButton>
-#include <QWebEngineView>
-#include <QDebug>
-
-PrintWebEngineTest_Gui::PrintWebEngineTest_Gui(QWidget *parent)
- : QWidget(parent)
-{
- QVBoxLayout *mainLayout = new QVBoxLayout;
- setLayout(mainLayout);
-
- mWebEngine = new QWebEngineView(this);
- mainLayout->addWidget(mWebEngine);
- mWebEngine->load(QUrl(QStringLiteral("http://www.kde.org")));
-
- QPushButton *printButton = new QPushButton(QStringLiteral("Print"), this);
- mainLayout->addWidget(printButton);
- connect(printButton, &QPushButton::clicked, this, &PrintWebEngineTest_Gui::slotPrint);
-}
-
-PrintWebEngineTest_Gui::~PrintWebEngineTest_Gui()
-{
-
-}
-
-void PrintWebEngineTest_Gui::slotPrint()
-{
- WebEngineViewer::PrintConfigureDialog dlg(this);
- if (dlg.exec()) {
- const QPageLayout pageLayout = dlg.currentPageLayout();
- WebEngineViewer::PrintWebEngineViewJob *job = new WebEngineViewer::PrintWebEngineViewJob(this);
- job->setEngineView(mWebEngine);
- job->setPageLayout(pageLayout);
- connect(job, &WebEngineViewer::PrintWebEngineViewJob::failed, this, &PrintWebEngineTest_Gui::slotPdfFailed);
- connect(job, &WebEngineViewer::PrintWebEngineViewJob::success, this, &PrintWebEngineTest_Gui::slotPdfCreated);
- job->start();
- //Don't delete it, it's autodelete
- }
-}
-
-void PrintWebEngineTest_Gui::slotPdfCreated(const QString &filename)
-{
- WebEngineViewer::PrintPreviewDialog dlg(this);
- dlg.loadFile(filename, true);
- dlg.exec();
-}
-
-void PrintWebEngineTest_Gui::slotPdfFailed()
-{
- qDebug() << "void PrintWebEngineTest_Gui::slotPdfFailed()";
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QStandardPaths::setTestModeEnabled(true);
- app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
-
- PrintWebEngineTest_Gui *w = new PrintWebEngineTest_Gui;
- w->show();
- const int ret = app.exec();
- return ret;
-}
diff --git a/webengineviewer/src/print/tests/printwebenginetest_gui.h b/webengineviewer/src/print/tests/printwebenginetest_gui.h
deleted file mode 100644
index 330eeab..0000000
--- a/webengineviewer/src/print/tests/printwebenginetest_gui.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- Copyright (C) 2016 Laurent Montel <montel@kde.org>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
-
-#ifndef PRINTWEBENGINETEST_GUI_H
-#define PRINTWEBENGINETEST_GUI_H
-
-#include <QWidget>
-class QWebEngineView;
-class PrintWebEngineTest_Gui : public QWidget
-{
- Q_OBJECT
-public:
- explicit PrintWebEngineTest_Gui(QWidget *parent = Q_NULLPTR);
- ~PrintWebEngineTest_Gui();
-
-private Q_SLOTS:
- void slotPrint();
- void slotPdfFailed();
- void slotPdfCreated(const QString &filename);
-private:
- QWebEngineView *mWebEngine;
-};
-
-#endif // PRINTWEBENGINETEST_GUI_H
diff --git a/webengineviewer/src/webengineprintmessagebox.cpp b/webengineviewer/src/webengineprintmessagebox.cpp
index 0a8e4be..f66649a 100644
--- a/webengineviewer/src/webengineprintmessagebox.cpp
+++ b/webengineviewer/src/webengineprintmessagebox.cpp
@@ -19,14 +19,12 @@
#include "webengineprintmessagebox.h"
#include "webengineviewer_debug.h"
-#include <webengineviewer/config-webengineviewer.h>
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
-//#define PRINTING_IMPLEMENTED 1
using namespace WebEngineViewer;
WebEnginePrintMessageBox::WebEnginePrintMessageBox(QWidget *parent)
: QDialog(parent)
@@ -50,17 +48,6 @@ WebEnginePrintMessageBox::WebEnginePrintMessageBox(QWidget *parent)
openInBrowser->setObjectName(QStringLiteral("openinbrowser"));
buttonBox->addButton(openInBrowser, QDialogButtonBox::ActionRole);
-#ifdef PRINTING_IMPLEMENTED
-
-#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
- QPushButton *openInPreviewDialogBox = new QPushButton(i18n("Print Preview"), this);
- connect(openInPreviewDialogBox, &QPushButton::clicked, this, &WebEnginePrintMessageBox::slotPrintPreview);
- openInPreviewDialogBox->setObjectName(QStringLiteral("openprintpreview"));
- buttonBox->addButton(openInPreviewDialogBox, QDialogButtonBox::ActionRole);
-#endif
-
-#endif
-
mainLayout->addWidget(buttonBox);
}