Show error messages for incorrect edit invocation

Planned dives must be replanned while manually added dives must be edited.
Show error messages to handle wrong user input.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2015-04-08 20:20:12 +02:00 committed by Dirk Hohndel
parent 12b276d15c
commit 54453abe49

View file

@ -592,7 +592,7 @@ void MainWindow::on_actionReplanDive_triggered()
if (!plannerStateClean() || !current_dive || !current_dive->dc.model)
return;
else if (strcmp(current_dive->dc.model, "planned dive")) {
qDebug() << "trying to replan a dive that's not a planned dive:" << current_dive->dc.model;
QMessageBox::warning(this, tr("Warning"), tr("trying to replan a dive that's not a planned dive."));
return;
}
// put us in PLAN mode
@ -668,6 +668,7 @@ void MainWindow::on_actionEditDive_triggered()
const bool isTripEdit = dive_list()->selectedTrips().count() >= 1;
if (!current_dive || isTripEdit || strcmp(current_dive->dc.model, "manually added dive")) {
QMessageBox::warning(this, tr("Warning"), tr("Trying to edit a dive that's not a manually added dive."));
return;
}