mobile: fix filter flag when editing dives

When editing dives, the undo-command sends a filte changed signal.
The models catch the signal and check whether the filter status
changed.

The mobile-version of the dive-edit command simply exchanged the
dives. This could lead to inconsistencies when the filter flag
was overwritten. Therefore, make sure that the filter flag
is not overwritten by the dive-exchange.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-03-27 23:06:07 +01:00 committed by Dirk Hohndel
parent fbf99c0105
commit 76cab71b7c

View file

@ -1242,6 +1242,12 @@ void EditDive::redo()
void EditDive::exchangeDives()
{
// Set the filter flag of the new dive to the old dive.
// Reason: When we send the dive-changed signal, the model will
// track the *change* of the filter flag, so we must not overwrite
// it by swapping the dive data.
newDive->hidden_by_filter = oldDive->hidden_by_filter;
// Bluntly exchange dive data by shallow copy
std::swap(*newDive, *oldDive);
invalidate_dive_cache(oldDive);