cleanup: remove strange recursive code in MainTab::enableEdition

When enableEdition() was called with mode == NONE and the dive
was a manually added dive, it would call into MainWindow::
editCurrentDive(), which would in turn call enableEdition(),
however with another mode. Since the only caller of
enableEdition() is now editCurrentDive() anyway, we can
remove that weird code.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-02-27 22:08:20 +01:00
parent ee64a85d2e
commit 6288b2a619

View file

@ -210,21 +210,6 @@ void MainTab::enableEdition(EditMode newEditMode)
{
if (((newEditMode == DIVE || newEditMode == NONE) && current_dive == NULL) || editMode != NONE)
return;
if ((newEditMode == DIVE || newEditMode == NONE) &&
current_dive->dc.model &&
strcmp(current_dive->dc.model, "manually added dive") == 0) {
// editCurrentDive will call enableEdition with newEditMode == MANUALLY_ADDED_DIVE
// so exit this function here after editCurrentDive() returns
// FIXME : can we get rid of this recursive crap?
MainWindow::instance()->editCurrentDive();
return;
}
ui.editDiveSiteButton->setEnabled(false);
MainWindow::instance()->diveList->setEnabled(false);