Remember last open file path.

--HG--
branch : develop
This commit is contained in:
dismine 2014-05-27 13:08:16 +03:00
parent f99b571c6e
commit 1501eb77eb

View File

@ -1234,14 +1234,19 @@ void MainWindow::Open()
if (MaybeSave()) if (MaybeSave())
{ {
QString filter(tr("Pattern files (*.val)")); QString filter(tr("Pattern files (*.val)"));
//Get list last open files
QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(),
QApplication::applicationName());
QStringList files = settings.value("recentFileList").toStringList();
QString dir; QString dir;
if (curFile.isEmpty()) if (files.isEmpty())
{ {
dir = QDir::homePath(); dir = QDir::homePath();
} }
else else
{ {
dir = QFileInfo(curFile).absolutePath(); //Absolute path to last open file
dir = QFileInfo(files.first()).absolutePath();
} }
QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter); QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), dir, filter);
if (fileName.isEmpty() == false) if (fileName.isEmpty() == false)