From 16f86f2f65e73935496e3324bb16f9b8cd4d7953 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 24 Nov 2020 20:17:27 +0100 Subject: desktop: use getDiveSelection to access selected dives In the list view two functions were still manually collecting the selected dives. Use getDiveSelection() there as well. Careful: that means that the check for dives that are already outside of a trip now has to be done in the RemoveDivesFromTrip command. Signed-off-by: Berthold Stoeger --- commands/command_divelist.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'commands') diff --git a/commands/command_divelist.cpp b/commands/command_divelist.cpp index b19075581..262197214 100644 --- a/commands/command_divelist.cpp +++ b/commands/command_divelist.cpp @@ -740,8 +740,14 @@ void TripBase::undoit() redoit(); } -RemoveDivesFromTrip::RemoveDivesFromTrip(const QVector &divesToRemove) +RemoveDivesFromTrip::RemoveDivesFromTrip(const QVector &divesToRemoveIn) { + // Filter out dives outside of trip. Note: This is in a separate loop to get the command-description right. + QVector divesToRemove; + for (dive *d: divesToRemoveIn) { + if (d->divetrip) + divesToRemove.push_back(d); + } setText(QStringLiteral("%1 [%2]").arg(Command::Base::tr("remove %n dive(s) from trip", "", divesToRemove.size())).arg(getListOfDives(divesToRemove))); divesToMove.divesToMove.reserve(divesToRemove.size()); for (dive *d: divesToRemove) { -- cgit v1.2.3-70-g09d2