diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 03b5d91..589e359 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -95,7 +95,6 @@ public: bool loadFromString(const QString& data); QString reportFileName(); void setReportFileName(const QString& fileName); - bool saveToFile(); bool saveToFile(const QString& fileName); QByteArray saveToByteArray(); QString saveToString(); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 5a51a2f..977a7e8 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -755,9 +755,10 @@ bool ReportEnginePrivate::loadFromString(const QString &report, const QString &n bool ReportEnginePrivate::saveToFile(const QString &fileName) { - if (fileName.isEmpty()) return false; - QFileInfo fi(fileName); - QString fn = fileName; + if (fileName.isEmpty() & m_fileName.isEmpty()) return false; + QString fn = fileName.isEmpty() ? m_fileName : fileName; + QFileInfo fi(fn); + if (fi.suffix().isEmpty()) fn+=".lrxml"; @@ -833,12 +834,6 @@ bool ReportEnginePrivate::isNeedToSave() return false; } -bool ReportEnginePrivate::saveToFile() -{ - if (m_fileName.isEmpty()) return false; - return saveToFile(m_fileName); -} - QString ReportEnginePrivate::renderToString() { LimeReport::ReportRender render; @@ -1255,12 +1250,6 @@ void ReportEngine::setReportFileName(const QString &fileName) return d->setReportFileName(fileName); } -bool ReportEngine::saveToFile() -{ - Q_D(ReportEngine); - return d->saveToFile(); -} - bool ReportEngine::saveToFile(const QString &fileName) { Q_D(ReportEngine); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 03b5d91..589e359 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -95,7 +95,6 @@ public: bool loadFromString(const QString& data); QString reportFileName(); void setReportFileName(const QString& fileName); - bool saveToFile(); bool saveToFile(const QString& fileName); QByteArray saveToByteArray(); QString saveToString(); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 9dde434..9f7ebf5 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -69,8 +69,7 @@ public: virtual void emitSaveFinished() = 0; virtual bool isNeedToSave() = 0; virtual void emitSaveReport() = 0; - virtual bool saveToFile() = 0; - virtual bool saveToFile(const QString& fileName) = 0; + virtual bool saveToFile(const QString& fileName = "") = 0; virtual bool isSaved() = 0; virtual QString reportName() = 0; virtual bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange) = 0; @@ -139,8 +138,7 @@ public: bool loadFromString(const QString& report, const QString& name = ""); QString reportFileName(){return m_fileName;} void setReportFileName(const QString& reportFileName){ m_fileName = reportFileName;} - bool saveToFile(); - bool saveToFile(const QString& fileName); + bool saveToFile(const QString& fileName = ""); QByteArray saveToByteArray(); QString saveToString(); bool isNeedToSave();