Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

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

Add print preview support

parent 4975ba38
......@@ -44,7 +44,7 @@ set(KPIMTEXTEDIT_LIB_VERSION "5.6.40")
set(LIBGRANTLEETHEME_LIB_VERSION_LIB "5.6.40")
set(LIBKDEPIM_LIB_VERSION_LIB "5.6.40")
set(LIBKLEO_LIB_VERSION_LIB "5.6.40")
set(MESSAGELIB_LIB_VERSION_LIB "5.6.40")
set(MESSAGELIB_LIB_VERSION_LIB "5.6.43")
set(PIMCOMMON_LIB_VERSION_LIB "5.6.40")
set(SYNDICATION_LIB_VERSION "5.6.40")
......
......@@ -106,6 +106,11 @@ ArticleViewerWebEngine::~ArticleViewerWebEngine()
{
}
void ArticleViewerWebEngine::execPrintPreviewPage(QPrinter *printer, int timeout)
{
mPageEngine->execPrintPreviewPage(printer, timeout);
}
void ArticleViewerWebEngine::slotWebPageMutedOrAudibleChanged()
{
Q_EMIT webPageMutedOrAudibleChanged(page()->isAudioMuted(), page()->recentlyAudible());
......
......@@ -70,6 +70,7 @@ public:
void createViewerPluginToolManager(KActionCollection *ac, QWidget *parent);
void execPrintPreviewPage(QPrinter *printer, int timeout);
protected:
QUrl mCurrentUrl;
KActionCollection *mActionCollection;
......
......@@ -35,9 +35,11 @@
#include <webengineviewer/config-webengineviewer.h>
#include <WebEngineViewer/WebEngineExportHtmlPageJob>
#include <QApplication>
#include <QPrinter>
#ifdef WEBENGINEVIEWER_PRINT_SUPPORT
#include <QPrintDialog>
#include <QPrintPreviewDialog>
#endif
using namespace Akregator;
......@@ -171,10 +173,26 @@ void ArticleViewerWebEngineWidgetNg::slotHandlePagePrinted(bool result)
void ArticleViewerWebEngineWidgetNg::slotPrintPreview()
{
#ifndef WEBENGINEVIEWER_PRINT_SUPPORT
QPointer<WebEngineViewer::WebEnginePrintMessageBox> dialog = new WebEngineViewer::WebEnginePrintMessageBox(this);
connect(dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openInBrowser, this, &ArticleViewerWebEngineWidgetNg::slotOpenInBrowser);
dialog->exec();
delete dialog;
#else
QPrintPreviewDialog* dialog = new QPrintPreviewDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->resize(800, 750);
connect(dialog, &QPrintPreviewDialog::paintRequested, this, [=](QPrinter *printing) {
QApplication::setOverrideCursor(Qt::WaitCursor);
mArticleViewerNg->execPrintPreviewPage(printing, 10*1000);
QApplication::restoreOverrideCursor();
});
dialog->open();
#endif
}
void ArticleViewerWebEngineWidgetNg::slotOpenInBrowser()
......
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