0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

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 onLoad(bool& loaded);
void onSave();
void saveFinished();
public slots:
void cancelRender();
protected:

View File

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

View File

@ -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()

View File

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

View File

@ -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: