1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Preserves open path between launches.

This commit is contained in:
Thomas Harte 2020-06-21 19:10:06 -04:00
parent c5d8d9127b
commit 782a62585e

View File

@ -74,8 +74,13 @@ void MainWindow::createActions() {
}
void MainWindow::open() {
QString fileName = QFileDialog::getOpenFileName(this);
Settings settings;
// Use the Settings to get a default open path; write it back afterwards.
QString fileName = QFileDialog::getOpenFileName(this, tr("Open..."), settings.value("openPath").toString());
if(!fileName.isEmpty()) {
settings.setValue("openPath", QFileInfo(fileName).absoluteDir().path());
// My understanding of SDI: if a file was opened for a 'vacant' window, launch it directly there;
// otherwise create a new window for it.
if(machine) {