Skip to content

Commit

Permalink
fix(cpn): update last used directory on save (#5629)
Browse files Browse the repository at this point in the history
  • Loading branch information
elecpower authored Oct 21, 2024
1 parent df1687a commit 60fe06a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions companion/src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -414,7 +410,7 @@ void MainWindow::openRecentFile()
QAction *action = qobject_cast<QAction *>(sender());
if (action) {
QString fileName = action->data().toString();
openFile(fileName, false);
openFile(fileName);
}
}

Expand Down
2 changes: 1 addition & 1 deletion companion/src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions companion/src/mdichild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -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;
Expand Down

0 comments on commit 60fe06a

Please sign in to comment.