Merge pull request #109 from sg-james/feature/pdf-signal

Add printedToPDF signal for digitally signing saved pdfs.
This commit is contained in:
fralx 2018-05-21 21:18:52 +03:00 committed by GitHub
commit b21a63e8a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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) {
@ -1159,7 +1166,9 @@ ReportEngine::ReportEngine(QObject *parent)
connect(d, SIGNAL(onSave()), this, SIGNAL(onSave()));
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(loaded()), this, SIGNAL(loaded()));
connect(d, SIGNAL(printedToPDF(QString)), this, SIGNAL(printedToPDF(QString)));
connect(d, SIGNAL(getAviableLanguages(QList<QLocale::Language>*)),
this, SIGNAL(getAviableLanguages(QList<QLocale::Language>*)));

View File

@ -122,10 +122,14 @@ signals:
void onLoad(bool& loaded);
void onSave();
void saveFinished();
void loaded();
void loaded();
void printedToPDF(QString fileName);
void getAviableLanguages(QList<QLocale::Language>* languages);
void currentDefaulLanguageChanged(QLocale::Language);
QLocale::Language getCurrentDefaultLanguage();
public slots:
void cancelRender();
protected:

View File

@ -151,6 +151,7 @@ public:
void emitSaveReport();
bool emitLoadReport();
void emitSaveFinished();
void emitPrintedToPDF(QString fileName);
bool isSaved();
void setCurrentReportsDir(const QString& dirName);
QString currentReportsDir(){ return m_reportsDir;}
@ -195,10 +196,14 @@ signals:
void onLoad(bool& loaded);
void onSave();
void saveFinished();
void loaded();
void loaded();
void printedToPDF(QString fileName);
void getAviableLanguages(QList<QLocale::Language>* languages);
void currentDefaulLanguageChanged(QLocale::Language);
QLocale::Language getCurrentDefaultLanguage();
public slots:
bool slotLoadFromFile(const QString& fileName);
void cancelRender();