Commit 9538a303 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Start to fix print to pdf

CCBUG: 422095
parent 96d598c7
Pipeline #41295 failed with stage
in 5 minutes and 1 second
......@@ -2372,8 +2372,24 @@ void ViewerPrivate::slotPrintMessage()
delete dialog;
return;
}
if (dialog->printer()->outputFormat() == QPrinter::PdfFormat) {
mViewer->page()->printToPdf(dialog->printer()->outputFileName(), dialog->printer()->pageLayout());
connect(mViewer->page(), &QWebEnginePage::pdfPrintingFinished, this, &ViewerPrivate::slotPdfPrintingFinished);
  • Uhm, shouldn't we connect to the signal before invoking the method that may trigger it?

Please register or sign in to reply
} else {
mViewer->page()->print(mCurrentPrinter, invoke(this, &ViewerPrivate::slotHandlePagePrinted));
}
delete dialog;
mViewer->page()->print(mCurrentPrinter, invoke(this, &ViewerPrivate::slotHandlePagePrinted));
}
void ViewerPrivate::slotPdfPrintingFinished(const QString &filePath, bool success)
{
Q_UNUSED(filePath)
if (!success) {
qCWarning(MESSAGEVIEWER_LOG) << "Print to pdf failed";
}
delete mCurrentPrinter;
mCurrentPrinter = nullptr;
Q_EMIT printingFinished();
}
void ViewerPrivate::slotHandlePagePrinted(bool result)
......
......@@ -588,11 +588,12 @@ private:
void slotDelayPrintPreview();
void applyZoomValue(qreal factor, bool saveConfig = true);
void slotZoomChanged(qreal zoom);
void assignMessageItem(const Akonadi::Item &item);
void slotPdfPrintingFinished(const QString &filePath, bool success);
MimeTreeParser::NodeHelper *mNodeHelper = nullptr;
bool mHtmlMailGlobalSetting = false;
bool mHtmlLoadExternalDefaultSetting = false;
bool mHtmlLoadExtOverride = false;
void assignMessageItem(const Akonadi::Item &item);
public:
KMime::Message::Ptr mMessage; //the current message, if it was set manually
Akonadi::Item mMessageItem; //the message item from Akonadi
......
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