Skip to content

Commit ebabc63

Browse files
committed
Minor cleanups
1 parent 69f3581 commit ebabc63

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/NotepadNext/NotepadNextApplication.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -442,11 +442,13 @@ void NotepadNextApplication::saveSettings()
442442

443443
void NotepadNextApplication::saveSession()
444444
{
445+
// Iterate all the opened editors and add them to the recent file list
445446
for (const auto &editor : window->editors()) {
446447
if (editor->isFile()) {
447448
recentFilesListManager->addFile(editor->getFilePath());
448449
}
449450
}
451+
saveSettings();
450452

451453
getSessionManager()->saveSession(window);
452454
}
@@ -462,13 +464,14 @@ MainWindow *NotepadNextApplication::createNewWindow()
462464
LuaExtension::Instance().setEditor(editor);
463465
});
464466

465-
// Since these editors don't actually get "closed" go ahead and add them to the recent file list
467+
// TODO: this shouldn't be dependent on a MainWindow closing, but this works for now
468+
// since the assumption is MainWindow::aboutToClose() infers the application is shutting
469+
// down but the editors are still active.
466470
connect(window, &MainWindow::aboutToClose, this, &NotepadNextApplication::saveSession);
467471

468-
// Timer to autosave session each minute
472+
// Timer to autosave the session
469473
connect(&autoSaveTimer, &QTimer::timeout, this, &NotepadNextApplication::saveSession);
470-
autoSaveTimer.setInterval(60 * 1000);
471-
autoSaveTimer.start();
474+
autoSaveTimer.start(60 * 1000);
472475

473476
return window;
474477
}

0 commit comments

Comments
 (0)