mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
bool setDefaultExportDir(const QString& dirname) has been added
This commit is contained in:
parent
570aaa734f
commit
3de208b589
@ -177,6 +177,7 @@ public:
|
||||
QString saveToString();
|
||||
QString lastError();
|
||||
void setCurrentReportsDir(const QString& dirName);
|
||||
bool setDefaultExportDir(const QString& dirName);
|
||||
void setReportName(const QString& name);
|
||||
QString reportName();
|
||||
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||
|
@ -125,7 +125,7 @@ bool PreviewReportWidget::exportReport(QString exporterName, const QMap<QString,
|
||||
if (ExportersFactory::instance().map().contains(exporterName)){
|
||||
|
||||
ReportExporterInterface* e = ExportersFactory::instance().objectCreator(exporterName)(d_ptr->m_report);
|
||||
QString defaultFileName = d_ptr->m_report->reportName().split(".")[0];
|
||||
QString defaultFileName = d_ptr->m_report->defaultExportDir() + d_ptr->m_report->reportName().split(".")[0];
|
||||
QString filter = QString("%1 (*.%2)").arg(e->exporterName()).arg(e->exporterFileExt());
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("%1 file name").arg(e->exporterName()), defaultFileName, filter);
|
||||
if (!fileName.isEmpty()){
|
||||
@ -286,7 +286,7 @@ void PreviewReportWidget::saveToFile()
|
||||
PreparedPages pagesManager = PreparedPages(&d_ptr->m_reportPages);
|
||||
emit onSave(saved, &pagesManager);
|
||||
if (!saved){
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Report file name"));
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Report file name"), d_ptr->m_report->defaultExportDir());
|
||||
if (!fileName.isEmpty()){
|
||||
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
||||
foreach (PageItemDesignIntf::Ptr page, d_ptr->m_reportPages){
|
||||
|
@ -474,7 +474,8 @@ bool ReportEnginePrivate::exportReport(QString exporterName, const QString &file
|
||||
QFileInfo fi(fn);
|
||||
if (fi.suffix().isEmpty())
|
||||
fn += QString(".%1").arg(e->exporterFileExt());
|
||||
|
||||
if (fi.absolutePath().compare(QDir::currentPath())==0)
|
||||
fn = defaultExportDir() + fn;
|
||||
bool designTime = dataManager()->designTime();
|
||||
dataManager()->setDesignTime(false);
|
||||
ReportPages pages = renderToPages();
|
||||
@ -657,6 +658,15 @@ void ReportEnginePrivate::setCurrentReportsDir(const QString &dirName)
|
||||
m_reportsDir = dirName;
|
||||
}
|
||||
|
||||
bool ReportEnginePrivate::setDefaultExportDir(const QString &dirName)
|
||||
{
|
||||
if (QDir(dirName).exists()){
|
||||
m_exportDir = dirName;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ReportEnginePrivate::slotLoadFromFile(const QString &fileName)
|
||||
{
|
||||
EASY_BLOCK("ReportEnginePrivate::slotLoadFromFile")
|
||||
@ -1770,6 +1780,12 @@ void ReportEngine::setCurrentReportsDir(const QString &dirName)
|
||||
return d->setCurrentReportsDir(dirName);
|
||||
}
|
||||
|
||||
bool ReportEngine::setDefaultExportDir(const QString &dirName)
|
||||
{
|
||||
Q_D(ReportEngine);
|
||||
return d->setDefaultExportDir(dirName);
|
||||
}
|
||||
|
||||
void ReportEngine::setReportName(const QString &name)
|
||||
{
|
||||
Q_D(ReportEngine);
|
||||
|
@ -177,6 +177,7 @@ public:
|
||||
QString saveToString();
|
||||
QString lastError();
|
||||
void setCurrentReportsDir(const QString& dirName);
|
||||
bool setDefaultExportDir(const QString& dirName);
|
||||
void setReportName(const QString& name);
|
||||
QString reportName();
|
||||
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
||||
|
@ -103,6 +103,8 @@ public:
|
||||
virtual void previewReport(PreviewHints hints = PreviewBarsUserSetting) = 0;
|
||||
virtual void setCurrentReportsDir(const QString& dirName) = 0;
|
||||
virtual QString currentReportsDir() = 0;
|
||||
virtual bool setDefaultExportDir(const QString& dirName) = 0;
|
||||
virtual QString defaultExportDir() = 0;
|
||||
virtual bool suppressFieldAndVarError() const = 0;
|
||||
virtual void setSuppressFieldAndVarError(bool suppressFieldAndVarError) = 0;
|
||||
virtual void setStyleSheet(const QString& styleSheet) = 0;
|
||||
@ -210,6 +212,8 @@ public:
|
||||
bool isSaved();
|
||||
void setCurrentReportsDir(const QString& dirName);
|
||||
QString currentReportsDir(){ return m_reportsDir;}
|
||||
bool setDefaultExportDir(const QString& dirname);
|
||||
QString defaultExportDir(){ return m_exportDir;}
|
||||
void setReportName(const QString& reportName){ m_reportName=reportName;}
|
||||
QString reportName(){ return m_reportName;}
|
||||
bool hasActivePreview(){return m_activePreview;}
|
||||
@ -336,6 +340,7 @@ private:
|
||||
bool m_printerSelected;
|
||||
bool m_showProgressDialog;
|
||||
QString m_reportsDir;
|
||||
QString m_exportDir;
|
||||
QString m_reportName;
|
||||
QMainWindow* m_activePreview;
|
||||
QIcon m_previewWindowIcon;
|
||||
|
Loading…
Reference in New Issue
Block a user