From 60fe06ae407ac7d6411b30a99e6a0cf584038a9a Mon Sep 17 00:00:00 2001 From: Neil Horne <15316949+elecpower@users.noreply.github.com> Date: Mon, 21 Oct 2024 11:06:11 +1100 Subject: [PATCH] fix(cpn): update last used directory on save (#5629) --- companion/src/mainwindow.cpp | 8 ++------ companion/src/mainwindow.h | 2 +- companion/src/mdichild.cpp | 4 ++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/companion/src/mainwindow.cpp b/companion/src/mainwindow.cpp index bd309147f87..991f6fec206 100644 --- a/companion/src/mainwindow.cpp +++ b/companion/src/mainwindow.cpp @@ -350,13 +350,9 @@ void MainWindow::openDocURL() QDesktopServices::openUrl(QUrl(link)); } -void MainWindow::openFile(const QString & fileName, bool updateLastUsedDir) +void MainWindow::openFile(const QString & fileName) { if (!fileName.isEmpty()) { - if (updateLastUsedDir) { - g.eepromDir(QFileInfo(fileName).dir().absolutePath()); - } - QMdiSubWindow *existing = findMdiChild(fileName); if (existing) { mdiArea->setActiveSubWindow(existing); @@ -414,7 +410,7 @@ void MainWindow::openRecentFile() QAction *action = qobject_cast(sender()); if (action) { QString fileName = action->data().toString(); - openFile(fileName, false); + openFile(fileName); } } diff --git a/companion/src/mainwindow.h b/companion/src/mainwindow.h index 0fc9b17a5eb..6014fe7594c 100644 --- a/companion/src/mainwindow.h +++ b/companion/src/mainwindow.h @@ -116,7 +116,7 @@ class MainWindow : public QMainWindow void downloads(); void doUpdates(bool check, bool interactive = true); - void openFile(const QString & fileName, bool updateLastUsedDir = false); + void openFile(const QString & fileName); private: QAction * addAct(const QString & icon, const char * slot = NULL, const QKeySequence & shortcut = 0, QObject * slotObj = NULL, const char * signal = NULL); diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index a077f433ff0..c7a8f14163a 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -1327,8 +1327,6 @@ bool MdiChild::saveAs(bool isNew) } while (QFileInfo(fileName).suffix().toLower() != "etx"); - g.eepromDir(QFileInfo(fileName).dir().absolutePath()); - return saveFile(fileName, true); } @@ -1341,6 +1339,8 @@ bool MdiChild::saveFile(const QString & filename, bool setCurrent) return false; } + g.eepromDir(QFileInfo(filename).dir().absolutePath()); + for (int i = 0; i < (int)radioData.models.size(); i++) { if (!radioData.models[i].isEmpty()) radioData.models[i].modelUpdated = false;