mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Planner: Offer to discard the plan when Quit is triggered in planner.
Upon pressing Ctrl-Q or the window close button a modal dialog was shown to remind the user that the planned dive is not saved. This patch triggers the "cancel plan" action before trying to quit. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e3ef1b7a1e
commit
543f226db0
1 changed files with 8 additions and 2 deletions
|
@ -352,11 +352,17 @@ void MainWindow::on_actionPreferences_triggered()
|
|||
|
||||
void MainWindow::on_actionQuit_triggered()
|
||||
{
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
if (ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file."));
|
||||
return;
|
||||
}
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
|
||||
DivePlannerPointsModel::instance()->cancelPlan();
|
||||
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING)
|
||||
// The planned dive was not discarded
|
||||
return;
|
||||
}
|
||||
|
||||
if (unsaved_changes() && (askSaveChanges() == false))
|
||||
return;
|
||||
writeSettings();
|
||||
|
|
Loading…
Reference in a new issue