Skip to content

Commit

Permalink
Remember last style import path
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 31, 2018
1 parent fc8d90f commit 1f744bd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gui/symbology/qgsstyleexportimportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "qgslogger.h"
#include "qgsstylegroupselectiondialog.h"
#include "qgsguiutils.h"
#include "qgssettings.h"
#include "qgsgui.h"

#include <QInputDialog>
Expand Down Expand Up @@ -84,6 +85,9 @@ QgsStyleExportImportDialog::QgsStyleExportImportDialog( QgsStyle *style, QWidget
mImportFileWidget->setStorageMode( QgsFileWidget::GetFile );
mImportFileWidget->setDialogTitle( tr( "Load Styles" ) );
mImportFileWidget->setFilter( tr( "XML files (*.xml *.XML)" ) );

QgsSettings settings;
mImportFileWidget->setDefaultRoot( settings.value( QStringLiteral( "StyleManager/lastImportDir" ), QDir::homePath(), QgsSettings::Gui ).toString() );
connect( mImportFileWidget, &QgsFileWidget::fileChanged, this, &QgsStyleExportImportDialog::importFileChanged );

label->setText( tr( "Select items to import" ) );
Expand Down Expand Up @@ -525,7 +529,11 @@ void QgsStyleExportImportDialog::importFileChanged( const QString &path )
QString tag = pathInfo.fileName().remove( QStringLiteral( ".xml" ) );
mSymbolTags->setText( tag );
if ( QFileInfo::exists( mFileName ) )
{
populateStyles( mTempStyle );
QgsSettings settings;
settings.setValue( QStringLiteral( "StyleManager/lastImportDir" ), pathInfo.absolutePath(), QgsSettings::Gui );
}
}

void QgsStyleExportImportDialog::downloadStyleXml( const QUrl &url )
Expand Down

0 comments on commit 1f744bd

Please sign in to comment.