Dive edit: when asked ti quit while editing, offer to discard current edit

This is equivalent behavior to what we do when planning a dive.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-03 18:17:32 -07:00
parent 37910751a0
commit a82411b67c

View file

@ -317,8 +317,10 @@ void MainWindow::on_actionPreferences_triggered()
void MainWindow::on_actionQuit_triggered()
{
if (ui.InfoWidget->isEditing()) {
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file."));
return;
ui.InfoWidget->rejectChanges();
if (ui.InfoWidget->isEditing())
// didn't discard the edits
return;
}
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) {
DivePlannerPointsModel::instance()->cancelPlan();