Skip to content

Commit b25c489

Browse files
committedDec 19, 2017
[layouts] Suggest export file names based on layout name (fix #9476)
1 parent c7bd7b3 commit b25c489

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎src/app/layout/qgslayoutdesignerdialog.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "qgslayoutitemregistry.h"
2020
#include "qgssettings.h"
2121
#include "qgisapp.h"
22+
#include "qgsfileutils.h"
2223
#include "qgslogger.h"
2324
#include "qgslayout.h"
2425
#include "qgslayoutappmenuprovider.h"
@@ -1476,7 +1477,7 @@ void QgsLayoutDesignerDialog::exportToRaster()
14761477
QgsAtlasComposition *atlasMap = &mComposition->atlasComposition();
14771478
#endif
14781479

1479-
QString outputFileName;
1480+
QString outputFileName = QgsFileUtils::stringToSafeFilename( mLayout->name() );
14801481
#if 0 //TODO
14811482
if ( atlasMap->enabled() && mComposition->atlasMode() == QgsComposition::PreviewAtlas )
14821483
{
@@ -1596,7 +1597,7 @@ void QgsLayoutDesignerDialog::exportToPdf()
15961597
else
15971598
{
15981599
#endif
1599-
outputFileName = file.path();
1600+
outputFileName = file.path() + '/' + QgsFileUtils::stringToSafeFilename( mLayout->name() ) + QStringLiteral( ".pdf" );
16001601
#if 0 //TODO
16011602
}
16021603
#endif
@@ -1685,7 +1686,7 @@ void QgsLayoutDesignerDialog::exportToSvg()
16851686
QgsSettings settings;
16861687
QString lastUsedFile = settings.value( QStringLiteral( "UI/lastSaveAsSvgFile" ), QStringLiteral( "qgis.svg" ) ).toString();
16871688
QFileInfo file( lastUsedFile );
1688-
QString outputFileName;
1689+
QString outputFileName = QgsFileUtils::stringToSafeFilename( mLayout->name() );
16891690

16901691
#if 0// TODO
16911692
if ( hasAnAtlas && !atlasOnASingleFile &&
@@ -1696,7 +1697,7 @@ void QgsLayoutDesignerDialog::exportToSvg()
16961697
else
16971698
{
16981699
#endif
1699-
outputFileName = file.path();
1700+
outputFileName = file.path() + '/' + QgsFileUtils::stringToSafeFilename( mLayout->name() ) + QStringLiteral( ".svg" );
17001701
#if 0 //TODO
17011702
}
17021703
#endif

0 commit comments

Comments
 (0)