summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-05-25 21:37:03 +0200
committerMontel Laurent <[email protected]>2016-05-25 21:37:03 +0200
commitba4794338ae5803e1f53e2dd1eb0a22471a81caa (patch)
tree783235f586f42bec5abacad36e69ab68c4648f45
parent5253cbe800bbc07c009b859cf92617989ca9470e (diff)
continue to implement print
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp31
-rw-r--r--messageviewer/src/viewer/viewer_p.h2
-rw-r--r--webengineviewer/src/print/printpreviewdialog.cpp2
-rw-r--r--webengineviewer/src/print/printpreviewdialog.h4
-rw-r--r--webengineviewer/src/print/printwebengineviewjob.h4
-rw-r--r--webengineviewer/src/webengineaccesskey/autotests/webengineaccesskeyanchortest.cpp2
-rw-r--r--webengineviewer/src/webengineprintmessagebox.h3
7 files changed, 38 insertions, 10 deletions
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 76e430d..9105834 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -38,6 +38,7 @@
#include "job/attachmenteditjob.h"
#include "job/modifymessagedisplayformatjob.h"
#include "viewerplugins/viewerplugintoolmanager.h"
+#include <WebEngineViewer/WebEnginePrintMessageBox>
#include <KContacts/VCardConverter>
#ifdef MESSAGEVIEWER_READER_HTML_DEBUG
#include <MimeMessagePart/FileHtmlWriter>
@@ -52,8 +53,7 @@
#include <KActionCollection>
#include <KActionMenu>
#include <KCharsets>
-#include <QWebView>
-#include <QWebFrame>
+
#include <QMenu>
#include <KMessageBox>
#include <KMimeTypeChooser>
@@ -89,7 +89,7 @@
#include <QPrintDialog>
#include <QMimeDatabase>
#include <QWheelEvent>
-
+#include <QPointer>
//libkdepim
#include "Libkdepim/BroadcastStatus"
#include <MessageCore/AttachmentPropertiesDialog>
@@ -2175,7 +2175,23 @@ void ViewerPrivate::slotPrintPreview()
if (!mMessage) {
return;
}
- qDebug() << "ViewerPrivate::slotPrintPreview() not implemented";
+ QPointer<WebEngineViewer::WebEnginePrintMessageBox> dialog = new WebEngineViewer::WebEnginePrintMessageBox(q);
+ connect(dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openInBrowser, this, &ViewerPrivate::slotOpenInBrowser);
+ connect(dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openPrintPreview, this, &ViewerPrivate::slotOpenPrintPreviewDialog);
+ dialog->setWebEngineView(mViewer);
+ dialog->exec();
+ delete dialog;
+}
+
+void ViewerPrivate::slotOpenInBrowser(const QString &filename)
+{
+ //TODO
+}
+
+void ViewerPrivate::slotOpenPrintPreviewDialog()
+{
+//TODO exclude when we have not support.
+ //TODO
}
void ViewerPrivate::slotPrintMessage()
@@ -2185,7 +2201,12 @@ void ViewerPrivate::slotPrintMessage()
if (!mMessage) {
return;
}
- qDebug() << " ViewerPrivate::slotPrintMsg() not implemented";
+ QPointer<WebEngineViewer::WebEnginePrintMessageBox> dialog = new WebEngineViewer::WebEnginePrintMessageBox(q);
+ connect(dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openInBrowser, this, &ViewerPrivate::slotOpenInBrowser);
+ connect(dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openPrintPreview, this, &ViewerPrivate::slotOpenPrintPreviewDialog);
+ dialog->setWebEngineView(mViewer);
+ dialog->exec();
+ delete dialog;
}
void ViewerPrivate::slotSetEncoding()
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index 4d563f8..2a1cf3a 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -472,6 +472,8 @@ private Q_SLOTS:
void slotStyleChanged(MessageViewer::HeaderStylePlugin *plugin);
void slotStyleUpdated();
void slotWheelZoomChanged(int numSteps);
+ void slotOpenPrintPreviewDialog();
+ void slotOpenInBrowser(const QString &filename);
public Q_SLOTS:
/** An URL has been activate with a click. */
void slotUrlOpen(const QUrl &url = QUrl());
diff --git a/webengineviewer/src/print/printpreviewdialog.cpp b/webengineviewer/src/print/printpreviewdialog.cpp
index a787896..1d08a62 100644
--- a/webengineviewer/src/print/printpreviewdialog.cpp
+++ b/webengineviewer/src/print/printpreviewdialog.cpp
@@ -75,6 +75,8 @@ void PrintPreviewDialog::loadFile(const QString &path, bool deleteFile)
void PrintPreviewDialog::slotPrint()
{
+ //TODO add dialog box to select page.
+
//TODO select page ?
//mPrintPreviewWidget->print();
//TODO
diff --git a/webengineviewer/src/print/printpreviewdialog.h b/webengineviewer/src/print/printpreviewdialog.h
index 7467346..e4c0ef6 100644
--- a/webengineviewer/src/print/printpreviewdialog.h
+++ b/webengineviewer/src/print/printpreviewdialog.h
@@ -19,11 +19,11 @@
#define PRINTPREVIEWDIALOG_H
#include <QDialog>
-
+#include <webengineviewer_export.h>
namespace WebEngineViewer
{
class PrintPreviewPageWidget;
-class PrintPreviewDialog : public QDialog
+class WEBENGINEVIEWER_EXPORT PrintPreviewDialog : public QDialog
{
Q_OBJECT
public:
diff --git a/webengineviewer/src/print/printwebengineviewjob.h b/webengineviewer/src/print/printwebengineviewjob.h
index 666c27c..82905e9 100644
--- a/webengineviewer/src/print/printwebengineviewjob.h
+++ b/webengineviewer/src/print/printwebengineviewjob.h
@@ -18,6 +18,8 @@
#ifndef PRINTWEBENGINEVIEWJOB_H
#define PRINTWEBENGINEVIEWJOB_H
+#include "webengineviewer_export.h"
+
#include <QObject>
#include <QPageLayout>
#include <QTemporaryFile>
@@ -25,7 +27,7 @@
class QWebEngineView;
namespace WebEngineViewer
{
-class PrintWebEngineViewJob : public QObject
+class WEBENGINEVIEWER_EXPORT PrintWebEngineViewJob : public QObject
{
Q_OBJECT
public:
diff --git a/webengineviewer/src/webengineaccesskey/autotests/webengineaccesskeyanchortest.cpp b/webengineviewer/src/webengineaccesskey/autotests/webengineaccesskeyanchortest.cpp
index 75a7d82..523269c 100644
--- a/webengineviewer/src/webengineaccesskey/autotests/webengineaccesskeyanchortest.cpp
+++ b/webengineviewer/src/webengineaccesskey/autotests/webengineaccesskeyanchortest.cpp
@@ -42,4 +42,4 @@ void WebEngineAccessKeyAnchorTest::shouldReturnEmptyAccessKeyAnchor()
QVERIFY(accessKeyAnchor.innerText().isEmpty());
}
-QTEST_MAIN(WebEngineAccessKeyAnchorTest)
+QTEST_APPLESS_MAIN(WebEngineAccessKeyAnchorTest)
diff --git a/webengineviewer/src/webengineprintmessagebox.h b/webengineviewer/src/webengineprintmessagebox.h
index afb7b8a..fcdf1ba 100644
--- a/webengineviewer/src/webengineprintmessagebox.h
+++ b/webengineviewer/src/webengineprintmessagebox.h
@@ -19,10 +19,11 @@
#define WEBENGINEPRINTMESSAGEBOX_H
#include <QDialog>
+#include "webengineviewer_export.h"
class QWebEngineView;
namespace WebEngineViewer
{
-class WebEnginePrintMessageBox : public QDialog
+class WEBENGINEVIEWER_EXPORT WebEnginePrintMessageBox : public QDialog
{
Q_OBJECT
public: