From 1501eb77eb87696947aa445338327d2e003dfa7f Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 27 May 2014 13:08:16 +0300 Subject: [PATCH] Remember last open file path. --HG-- branch : develop --- src/app/mainwindow.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 5a37b66b5..f9ee3c4b8 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -1234,14 +1234,19 @@ void MainWindow::Open() if (MaybeSave()) { 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; - if (curFile.isEmpty()) + if (files.isEmpty()) { dir = QDir::homePath(); } 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); if (fileName.isEmpty() == false)