summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/command_divelist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets/command_divelist.cpp')
-rw-r--r--desktop-widgets/command_divelist.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp
index 057e852c0..1bc225086 100644
--- a/desktop-widgets/command_divelist.cpp
+++ b/desktop-widgets/command_divelist.cpp
@@ -109,6 +109,11 @@ std::vector<DiveToAdd> DiveListBase::removeDives(std::vector<dive *> &divesToDel
std::vector<DiveToAdd> res;
res.reserve(divesToDelete.size());
+ // First, tell the filters that dives are removed. This could
+ // be done later using the emitted signals, but we do this here
+ // for symmetry with addDives()
+ MultiFilterSortModel::instance()->divesDeleted(QVector<dive *>::fromStdVector(divesToDelete));
+
for (dive *d: divesToDelete)
res.push_back(removeDive(d));
divesToDelete.clear();
@@ -141,6 +146,15 @@ std::vector<dive *> DiveListBase::addDives(std::vector<DiveToAdd> &divesToAdd)
std::vector<dive *> res;
res.resize(divesToAdd.size());
+ // First, tell the filters that new dives are added. We do this here
+ // instead of later by signals, so that the filter can set the
+ // checkboxes of the new rows to its liking. The added dives will
+ // then appear in the correct shown/hidden state.
+ QVector<dive *> divesForFilter;
+ for (const DiveToAdd &entry: divesToAdd)
+ divesForFilter.push_back(entry.dive.get());
+ MultiFilterSortModel::instance()->divesAdded(divesForFilter);
+
// At the end of the function, to send the proper dives-added signals,
// we the the list of added trips. Create this list now.
std::vector<dive_trip *> addedTrips;