From 79baeef72c7d006109ed5767be79843da5fb13e9 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 8 May 2018 09:30:10 -0400 Subject: [PATCH] Add printedToPDF signal for digitally signing saved pdfs. --- limereport/lrpreviewreportwidget.cpp | 1 + limereport/lrreportengine.cpp | 10 +++++++++- limereport/lrreportengine.h | 1 + limereport/lrreportengine_p.h | 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index 5443adf..5ef2693 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -200,6 +200,7 @@ void PreviewReportWidget::printToPDF() foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){ d_ptr->m_previewPage->reactivatePageItem(pageItem); } + d_ptr->m_report->emitPrintedToPDF(fileName); } } diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index e699459..13adeb2 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -484,7 +484,9 @@ bool ReportEnginePrivate::printToPDF(const QString &fileName) QPrinter printer; printer.setOutputFileName(fn); printer.setOutputFormat(QPrinter::PdfFormat); - return printReport(&printer); + bool success = printReport(&printer); + if(success) emitPrintedToPDF(fileName); + return success; } return false; } @@ -600,6 +602,11 @@ void ReportEnginePrivate::emitSaveFinished() emit saveFinished(); } +void ReportEnginePrivate::emitPrintedToPDF(QString fileName) +{ + emit printedToPDF(fileName); +} + bool ReportEnginePrivate::isSaved() { foreach (PageDesignIntf* page, m_pages) { @@ -1139,6 +1146,7 @@ ReportEngine::ReportEngine(QObject *parent) connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&))); connect(d, SIGNAL(saveFinished()), this, SIGNAL(saveFinished())); connect(d, SIGNAL(loaded()), this, SIGNAL(loaded())); + connect(d, SIGNAL(printedToPDF(QString)), this, SIGNAL(printedToPDF(QString))); } ReportEngine::~ReportEngine() diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index bed2d88..7b098d9 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -121,6 +121,7 @@ signals: void onSave(); void saveFinished(); void loaded(); + void printedToPDF(QString fileName); public slots: void cancelRender(); protected: diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index d0bc16f..912ae5d 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -147,6 +147,7 @@ public: void emitSaveReport(); bool emitLoadReport(); void emitSaveFinished(); + void emitPrintedToPDF(QString fileName); bool isSaved(); void setCurrentReportsDir(const QString& dirName); QString currentReportsDir(){ return m_reportsDir;} @@ -190,6 +191,7 @@ signals: void onSave(); void saveFinished(); void loaded(); + void printedToPDF(QString fileName); public slots: bool slotLoadFromFile(const QString& fileName); void cancelRender();