Redundant saveToFile() has been removed

This commit is contained in:
Arin Alex 2018-02-07 22:43:31 +03:00
parent 5b81a75d3c
commit 04bf1dfbdb
4 changed files with 6 additions and 21 deletions

View File

@ -95,7 +95,6 @@ public:
bool loadFromString(const QString& data); bool loadFromString(const QString& data);
QString reportFileName(); QString reportFileName();
void setReportFileName(const QString& fileName); void setReportFileName(const QString& fileName);
bool saveToFile();
bool saveToFile(const QString& fileName); bool saveToFile(const QString& fileName);
QByteArray saveToByteArray(); QByteArray saveToByteArray();
QString saveToString(); QString saveToString();

View File

@ -755,9 +755,10 @@ bool ReportEnginePrivate::loadFromString(const QString &report, const QString &n
bool ReportEnginePrivate::saveToFile(const QString &fileName) bool ReportEnginePrivate::saveToFile(const QString &fileName)
{ {
if (fileName.isEmpty()) return false; if (fileName.isEmpty() & m_fileName.isEmpty()) return false;
QFileInfo fi(fileName); QString fn = fileName.isEmpty() ? m_fileName : fileName;
QString fn = fileName; QFileInfo fi(fn);
if (fi.suffix().isEmpty()) if (fi.suffix().isEmpty())
fn+=".lrxml"; fn+=".lrxml";
@ -833,12 +834,6 @@ bool ReportEnginePrivate::isNeedToSave()
return false; return false;
} }
bool ReportEnginePrivate::saveToFile()
{
if (m_fileName.isEmpty()) return false;
return saveToFile(m_fileName);
}
QString ReportEnginePrivate::renderToString() QString ReportEnginePrivate::renderToString()
{ {
LimeReport::ReportRender render; LimeReport::ReportRender render;
@ -1255,12 +1250,6 @@ void ReportEngine::setReportFileName(const QString &fileName)
return d->setReportFileName(fileName); return d->setReportFileName(fileName);
} }
bool ReportEngine::saveToFile()
{
Q_D(ReportEngine);
return d->saveToFile();
}
bool ReportEngine::saveToFile(const QString &fileName) bool ReportEngine::saveToFile(const QString &fileName)
{ {
Q_D(ReportEngine); Q_D(ReportEngine);

View File

@ -95,7 +95,6 @@ public:
bool loadFromString(const QString& data); bool loadFromString(const QString& data);
QString reportFileName(); QString reportFileName();
void setReportFileName(const QString& fileName); void setReportFileName(const QString& fileName);
bool saveToFile();
bool saveToFile(const QString& fileName); bool saveToFile(const QString& fileName);
QByteArray saveToByteArray(); QByteArray saveToByteArray();
QString saveToString(); QString saveToString();

View File

@ -69,8 +69,7 @@ public:
virtual void emitSaveFinished() = 0; virtual void emitSaveFinished() = 0;
virtual bool isNeedToSave() = 0; virtual bool isNeedToSave() = 0;
virtual void emitSaveReport() = 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 bool isSaved() = 0;
virtual QString reportName() = 0; virtual QString reportName() = 0;
virtual bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange) = 0; virtual bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange) = 0;
@ -139,8 +138,7 @@ public:
bool loadFromString(const QString& report, const QString& name = ""); bool loadFromString(const QString& report, const QString& name = "");
QString reportFileName(){return m_fileName;} QString reportFileName(){return m_fileName;}
void setReportFileName(const QString& reportFileName){ m_fileName = reportFileName;} void setReportFileName(const QString& reportFileName){ m_fileName = reportFileName;}
bool saveToFile(); bool saveToFile(const QString& fileName = "");
bool saveToFile(const QString& fileName);
QByteArray saveToByteArray(); QByteArray saveToByteArray();
QString saveToString(); QString saveToString();
bool isNeedToSave(); bool isNeedToSave();