Skip to content
Permalink
Browse files

[bookmark] remember last used directory on import/export

  • Loading branch information
slarosa authored and nyalldawson committed Feb 24, 2015
1 parent ce28762 commit c2c55039d22365586abbea42ec03c8b21f2be598
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/app/qgsbookmarks.cpp
@@ -265,7 +265,10 @@ void QgsBookmarks::zoomToBookmark()

void QgsBookmarks::importFromXML()
{
QString fileName = QFileDialog::getOpenFileName( this, tr( "Import Bookmarks" ), ".",
QSettings settings;

QString lastUsedDir = settings.value( "/Bookmark/LastUsedDirectory", QVariant() ).toString();
QString fileName = QFileDialog::getOpenFileName( this, tr( "Import Bookmarks" ), lastUsedDir,
tr( "XML files (*.xml *XML)" ) );
if ( fileName.isEmpty() )
{
@@ -338,7 +341,10 @@ void QgsBookmarks::importFromXML()

void QgsBookmarks::exportToXML()
{
QString fileName = QFileDialog::getSaveFileName( this, tr( "Export bookmarks" ), ".",
QSettings settings;

QString lastUsedDir = settings.value( "/Bookmark/LastUsedDirectory", QVariant() ).toString();
QString fileName = QFileDialog::getSaveFileName( this, tr( "Export bookmarks" ), lastUsedDir,
tr( "XML files( *.xml *.XML )" ) );
if ( fileName.isEmpty() )
{
@@ -388,4 +394,6 @@ void QgsBookmarks::exportToXML()
out.setCodec( "UTF - 8" );
doc.save( out, 2 );
f.close();

settings.setValue( "/Bookmark/LastUsedDirectory", QFileInfo( fileName ).path() );
}

0 comments on commit c2c5503

Please sign in to comment.
You can’t perform that action at this time.