Fix #28 signal saveFinished has been added

This commit is contained in:
Arin Alexander 2016-04-21 17:44:58 +03:00
parent cb54963db9
commit 2e4ee6ca05
5 changed files with 23 additions and 3 deletions

View File

@ -98,6 +98,7 @@ signals:
void renderPageFinished(int renderedPageCount); void renderPageFinished(int renderedPageCount);
void onLoad(bool& loaded); void onLoad(bool& loaded);
void onSave(); void onSave();
void saveFinished();
public slots: public slots:
void cancelRender(); void cancelRender();
protected: protected:

View File

@ -233,13 +233,23 @@ void ReportDesignWidget::saveToFile(const QString &fileName){
bool ReportDesignWidget::save() bool ReportDesignWidget::save()
{ {
if (!m_report->reportFileName().isEmpty()){ if (!m_report->reportFileName().isEmpty()){
return m_report->saveToFile(); if (m_report->saveToFile()){
m_report->emitSaveFinished();
return true;
}
} }
else { else {
m_report->emitSaveReport(); m_report->emitSaveReport();
if (m_report->isSaved()) return true; if (m_report->isSaved()) {
return m_report->saveToFile(QFileDialog::getSaveFileName(this,tr("Report file name"),"","Report files (*.lrxml);; All files (*)")); 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) bool ReportDesignWidget::loadFromFile(const QString &fileName)

View File

@ -361,6 +361,11 @@ bool ReportEnginePrivate::emitLoadReport()
return result; return result;
} }
void ReportEnginePrivate::emitSaveFinished()
{
emit saveFinished();
}
bool ReportEnginePrivate::isSaved() bool ReportEnginePrivate::isSaved()
{ {
foreach (PageDesignIntf* page, m_pages) { foreach (PageDesignIntf* page, m_pages) {
@ -598,6 +603,7 @@ ReportEngine::ReportEngine(QObject *parent)
connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished())); connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished()));
connect(d, SIGNAL(onSave()), this, SIGNAL(onSave())); connect(d, SIGNAL(onSave()), this, SIGNAL(onSave()));
connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&))); connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&)));
connect(d, SIGNAL(saveFinished()), this, SIGNAL(saveFinished()));
} }
ReportEngine::~ReportEngine() ReportEngine::~ReportEngine()

View File

@ -98,6 +98,7 @@ signals:
void renderPageFinished(int renderedPageCount); void renderPageFinished(int renderedPageCount);
void onLoad(bool& loaded); void onLoad(bool& loaded);
void onSave(); void onSave();
void saveFinished();
public slots: public slots:
void cancelRender(); void cancelRender();
protected: protected:

View File

@ -97,6 +97,7 @@ public:
ReportEngine * q_ptr; ReportEngine * q_ptr;
void emitSaveReport(); void emitSaveReport();
bool emitLoadReport(); bool emitLoadReport();
void emitSaveFinished();
bool isSaved(); bool isSaved();
void setCurrentReportsDir(const QString& dirName); void setCurrentReportsDir(const QString& dirName);
QString currentReportsDir(){ return m_reportsDir;} QString currentReportsDir(){ return m_reportsDir;}
@ -119,6 +120,7 @@ signals:
void renderPageFinished(int renderedPageCount); void renderPageFinished(int renderedPageCount);
void onLoad(bool& loaded); void onLoad(bool& loaded);
void onSave(); void onSave();
void saveFinished();
public slots: public slots:
void cancelRender(); void cancelRender();
protected: protected: