mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
desktop: ask user when quitting application while planning
We used to cancel a plan (or profile edit) when the user quit the application while planning. This is inconsistent with respect to closing or opening a different log, where the user was asked for confirmation. Thus, for consistency and to avoid loss of a planned dive, use the okToClose() function in on_actionClose_triggered() of MainWindow. As an added bonus, this saves a few SLOC. Fixes #1078 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
2a31203221
commit
8f8457ebe4
1 changed files with 2 additions and 14 deletions
|
@ -741,21 +741,9 @@ void MainWindow::on_actionPreferences_triggered()
|
|||
|
||||
void MainWindow::on_actionQuit_triggered()
|
||||
{
|
||||
if (mainTab->isEditing()) {
|
||||
mainTab->rejectChanges();
|
||||
if (mainTab->isEditing())
|
||||
// didn't discard the edits
|
||||
return;
|
||||
}
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
|
||||
DivePlannerPointsModel::instance()->cancelPlan();
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING)
|
||||
// The planned dive was not discarded
|
||||
return;
|
||||
}
|
||||
|
||||
if (unsavedChanges() && (askSaveChanges() == false))
|
||||
if (!okToClose(tr("Please save or cancel the current dive edit before quiting the application.")))
|
||||
return;
|
||||
|
||||
writeSettings();
|
||||
QApplication::quit();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue