aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-08-27 08:55:09 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-10-11 16:22:27 -0700
commit11e0b7ac0a6db1a6f2d96ca4cb1f035f42181634 (patch)
tree4bc3d5af8e5b626e0d7445ff9531a6a88192db90
parentf836b9ae97bc8109e1acdd1859bd41a5dc53f7f3 (diff)
downloadsubsurface-11e0b7ac0a6db1a6f2d96ca4cb1f035f42181634.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
-rw-r--r--desktop-widgets/command_divelist.cpp6
1 files changed, 6 insertions, 0 deletions
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