Skip to content

Commit af5401c

Browse files
author
g_j_m
committed
Make the save as svg and save as image file selection dialogs remember
the last used directory in addition to the last used filename. git-svn-id: http://svn.osgeo.org/qgis/trunk@5647 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 05433ca commit af5401c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/composer/qgscomposer.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include <QDesktopWidget>
2727
#include <QFileDialog>
28+
#include <QFileInfo>
2829
#include <QMatrix>
2930
#include <QMessageBox>
3031
#include <QPainter>
@@ -542,6 +543,7 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
542543
QSettings myQSettings; // where we keep last used filter in persistant state
543544
QString myLastUsedFormat = myQSettings.readEntry("/UI/lastSaveAsImageFormat", "PNG" );
544545
QString myLastUsedFile = myQSettings.readEntry("/UI/lastSaveAsImageFile","qgis.png");
546+
QFileInfo file(myLastUsedFile);
545547

546548
// get a list of supported output image types
547549
int myCounterInt=0;
@@ -573,11 +575,11 @@ void QgsComposer::on_mActionExportAsImage_activated(void)
573575
new QFileDialog(
574576
this,
575577
tr("Choose a filename to save the map image as"),
576-
".",
578+
file.path(),
577579
myFilters
578580
)
579581
);
580-
myQFileDialog->selectFile( myLastUsedFile );
582+
myQFileDialog->selectFile( file.fileName() );
581583

582584
// allow for selection of more than one file
583585
myQFileDialog->setMode(QFileDialog::AnyFile);
@@ -633,11 +635,12 @@ void QgsComposer::on_mActionExportAsSVG_activated(void)
633635
{
634636
QSettings myQSettings;
635637
QString myLastUsedFile = myQSettings.readEntry("/UI/lastSaveAsSvgFile","qgis.svg");
638+
QFileInfo file(myLastUsedFile);
636639

637640
QFileDialog *myQFileDialog = new QFileDialog( this, tr("Choose a filename to save the map as"),
638-
".", "SVG Format (*.svg *SVG)" );
641+
file.path(), "SVG Format (*.svg *SVG)" );
639642

640-
myQFileDialog->selectFile( myLastUsedFile );
643+
myQFileDialog->selectFile( file.fileName() );
641644
myQFileDialog->setMode(QFileDialog::AnyFile);
642645
myQFileDialog->setAcceptMode(QFileDialog::AcceptSave);
643646

0 commit comments

Comments
 (0)