Don't quit while dive is edited

If the user edits a dive and then quits we try to ask them to finish
editing, first. If the user did this by either clicking the little 'x'
in the window decoration or by hitting Alt-F4 (or similar), we didn't
have that question (only the 'save changes' question in case the dive list
had already been modified.

Fixes #374

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-12-16 16:37:44 -08:00
parent 397898434e
commit fe88a2a476

View file

@ -700,6 +700,13 @@ void MainWindow::writeSettings()
void MainWindow::closeEvent(QCloseEvent *event)
{
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
ui.InfoWidget->isEditing()) {
QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file."));
event->ignore();
return;
}
if (helpView && helpView->isVisible()){
helpView->close();
helpView->deleteLater();