mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
e7063b6b08
commit
9afea37e15
4 changed files with 46 additions and 3 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue