Skip to content

Commit

Permalink
Remember last used path for style item export
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 10, 2021
1 parent 6c9f0e6 commit b5f898f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/symbology/qgsstyleexportimportdialog.cpp
Expand Up @@ -151,12 +151,15 @@ void QgsStyleExportImportDialog::doExportImport()

if ( mDialogMode == Export )
{
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Styles" ), QDir::homePath(),
QgsSettings settings;
const QString lastUsedDir = settings.value( QStringLiteral( "StyleManager/lastExportDir" ), QDir::homePath(), QgsSettings::Gui ).toString();
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save Styles" ), lastUsedDir,
tr( "XML files (*.xml *.XML)" ) );
if ( fileName.isEmpty() )
{
return;
}
settings.setValue( QStringLiteral( "StyleManager/lastExportDir" ), QFileInfo( fileName ).absolutePath(), QgsSettings::Gui );

// ensure the user never omitted the extension from the file name
if ( !fileName.endsWith( QLatin1String( ".xml" ), Qt::CaseInsensitive ) )
Expand Down

0 comments on commit b5f898f

Please sign in to comment.