Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Correctly save last used style import/export path
  • Loading branch information
nyalldawson committed Oct 23, 2018
1 parent cb08cd2 commit 8e4d5d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/qgsvectorlayerloadstyledialog.cpp
Expand Up @@ -68,9 +68,13 @@ QgsVectorLayerLoadStyleDialog::QgsVectorLayerLoadStyleDialog( QgsVectorLayer *la
mFileWidget->setFilter( tr( "QGIS Layer Style File, SLD File" ) + QStringLiteral( " (*.qml *.sld)" ) );
mFileWidget->setStorageMode( QgsFileWidget::GetFile );
mFileWidget->setDefaultRoot( myLastUsedDir );
connect( mFileWidget, &QgsFileWidget::fileChanged, this, [ = ]( const QString & )
connect( mFileWidget, &QgsFileWidget::fileChanged, this, [ = ]( const QString & path )
{
mStyleCategoriesListView->setEnabled( currentStyleType() != QgsVectorLayerProperties::SLD );
QgsSettings settings;
QFileInfo tmplFileInfo( path );
settings.setValue( QStringLiteral( "style/lastStyleDir" ), tmplFileInfo.absolutePath() );

updateLoadButtonState();
} );

Expand Down
6 changes: 6 additions & 0 deletions src/app/qgsvectorlayersavestyledialog.cpp
Expand Up @@ -68,6 +68,12 @@ QgsVectorLayerSaveStyleDialog::QgsVectorLayerSaveStyleDialog( QgsVectorLayer *la
connect( mFileWidget, &QgsFileWidget::fileChanged, this, &QgsVectorLayerSaveStyleDialog::updateSaveButtonState );
mFileWidget->setStorageMode( QgsFileWidget::SaveFile );
mFileWidget->setDefaultRoot( myLastUsedDir );
connect( mFileWidget, &QgsFileWidget::fileChanged, this, [ = ]( const QString & path )
{
QgsSettings settings;
QFileInfo tmplFileInfo( path );
settings.setValue( QStringLiteral( "style/lastStyleDir" ), tmplFileInfo.absolutePath() );
} );

// fill style categories
mModel = new QgsMapLayerStyleCategoriesModel( this );
Expand Down

0 comments on commit 8e4d5d5

Please sign in to comment.