Undo: update filter flag when dives change

The filter code is strange: it actually only checks the
dive->hidden_by_filter flag. Thus, before propagating the dive
changed signal, this flag has to be updated. Do this in the
DiveTripModel. Ultimately, this should be refactored.

Moreover, if the filter-flag changed notify the frontend
of a changed trip so that the trip is hidden / unhidden.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-03-22 20:55:05 +01:00 committed by Dirk Hohndel
parent e7063b6b08
commit 9afea37e15
4 changed files with 46 additions and 3 deletions

View file

@ -249,6 +249,18 @@ void MultiFilterSortModel::myInvalidate()
#endif
}
bool MultiFilterSortModel::updateDive(struct dive *d)
{
bool oldStatus = !d->hidden_by_filter;
bool newStatus = showDive(d);
bool changed = oldStatus != newStatus;
if (changed) {
filter_dive(d, newStatus);
divesDisplayed += newStatus - oldStatus;
}
return changed;
}
void MultiFilterSortModel::clearFilter()
{
myInvalidate();