From 11e0b7ac0a6db1a6f2d96ca4cb1f035f42181634 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 27 Aug 2018 08:55:09 +0200 Subject: Dive commands: set filter flag when adding dives When adding dives to the list, set the filter flag accordingly. Thus, dives that are hidden by the filter are not shown on redo/undo. Signed-off-by: Berthold Stoeger --- desktop-widgets/command_divelist.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp index 7fbda35dc..057e852c0 100644 --- a/desktop-widgets/command_divelist.cpp +++ b/desktop-widgets/command_divelist.cpp @@ -6,6 +6,7 @@ #include "core/divelist.h" #include "core/display.h" // for amount_selected #include "core/subsurface-qt/DiveListNotifier.h" +#include "qt-models/filtermodels.h" namespace Command { @@ -85,6 +86,11 @@ dive *DiveListBase::addDive(DiveToAdd &d) if (d.trip) add_dive_to_trip(d.dive.get(), d.trip); dive *res = d.dive.release(); // Give up ownership of dive + + // Set the filter flag according to current filter settings + bool show = MultiFilterSortModel::instance()->showDive(res); + res->hidden_by_filter = !show; + add_single_dive(d.idx, res); // Return ownership to backend // If the dive to be removed is selected, we will inform the frontend -- cgit v1.2.3-70-g09d2