Commit ba479433 authored by Laurent Montel's avatar Laurent Montel 😁

continue to implement print

parent 5253cbe8
......@@ -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()
......
......@@ -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());
......
......@@ -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
......
......@@ -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:
......
......@@ -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:
......
......@@ -42,4 +42,4 @@ void WebEngineAccessKeyAnchorTest::shouldReturnEmptyAccessKeyAnchor()
QVERIFY(accessKeyAnchor.innerText().isEmpty());
}
QTEST_MAIN(WebEngineAccessKeyAnchorTest)
QTEST_APPLESS_MAIN(WebEngineAccessKeyAnchorTest)
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment