diff --git a/include/lrreportengine.h b/include/lrreportengine.h index beeef00..afbbcdc 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -98,6 +98,7 @@ signals: void renderPageFinished(int renderedPageCount); void onLoad(bool& loaded); void onSave(); + void saveFinished(); public slots: void cancelRender(); protected: diff --git a/limereport/lrreportdesignwidget.cpp b/limereport/lrreportdesignwidget.cpp index 93074a2..bdaab42 100644 --- a/limereport/lrreportdesignwidget.cpp +++ b/limereport/lrreportdesignwidget.cpp @@ -233,13 +233,23 @@ void ReportDesignWidget::saveToFile(const QString &fileName){ bool ReportDesignWidget::save() { if (!m_report->reportFileName().isEmpty()){ - return m_report->saveToFile(); + if (m_report->saveToFile()){ + m_report->emitSaveFinished(); + return true; + } } else { m_report->emitSaveReport(); - if (m_report->isSaved()) return true; - return m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)")); + if (m_report->isSaved()) { + m_report->emitSaveFinished(); + return true; + } + if (m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)"))){ + m_report->emitSaveFinished(); + return true; + }; } + return false; } bool ReportDesignWidget::loadFromFile(const QString &fileName) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index a2e4285..81d0fb8 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -361,6 +361,11 @@ bool ReportEnginePrivate::emitLoadReport() return result; } +void ReportEnginePrivate::emitSaveFinished() +{ + emit saveFinished(); +} + bool ReportEnginePrivate::isSaved() { foreach (PageDesignIntf* page, m_pages) { @@ -598,6 +603,7 @@ ReportEngine::ReportEngine(QObject *parent) connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished())); connect(d, SIGNAL(onSave()), this, SIGNAL(onSave())); connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&))); + connect(d, SIGNAL(saveFinished()), this, SIGNAL(saveFinished())); } ReportEngine::~ReportEngine() diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index beeef00..afbbcdc 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -98,6 +98,7 @@ signals: void renderPageFinished(int renderedPageCount); void onLoad(bool& loaded); void onSave(); + void saveFinished(); public slots: void cancelRender(); protected: diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index c5167ba..c86fd69 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -97,6 +97,7 @@ public: ReportEngine * q_ptr; void emitSaveReport(); bool emitLoadReport(); + void emitSaveFinished(); bool isSaved(); void setCurrentReportsDir(const QString& dirName); QString currentReportsDir(){ return m_reportsDir;} @@ -119,6 +120,7 @@ signals: void renderPageFinished(int renderedPageCount); void onLoad(bool& loaded); void onSave(); + void saveFinished(); public slots: void cancelRender(); protected: