Skip to content

Commit f8025fd

Browse files
author
g_j_m
committed
Remember the last directory used for the composer image select file
dialog box git-svn-id: http://svn.osgeo.org/qgis/trunk@5579 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b7682ce commit f8025fd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/composer/qgscomposerpicture.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <QMessageBox>
2424
#include <QPainter>
2525
#include <QImageWriter>
26+
#include <QSettings>
2627

2728
#include <cmath>
2829
#include <iostream>
@@ -493,11 +494,21 @@ QString QgsComposerPicture::pictureDialog ( void )
493494
}
494495
filters += " )";
495496

497+
// Retrieve the last used directory
498+
QSettings settings;
499+
QString lastUsedDir = settings.readEntry("/UI/lastComposerPictureDir", ".");
500+
496501
QString file = QFileDialog::getOpenFileName(
497502
0,
498503
tr("Choose a file"),
499-
".",
504+
lastUsedDir,
500505
filters );
506+
if (file.length() != 0)
507+
{
508+
QFileInfo myFile(file);
509+
QString myPath = myFile.dirPath();
510+
settings.writeEntry("/UI/lastComposerPictureDir", myPath);
511+
}
501512

502513
return file;
503514
}

0 commit comments

Comments
 (0)