aboutsummaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
Diffstat (limited to 'commands')
-rw-r--r--commands/command_divelist.cpp8
1 files changed, 7 insertions, 1 deletions
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<dive *> &divesToRemove)
+RemoveDivesFromTrip::RemoveDivesFromTrip(const QVector<dive *> &divesToRemoveIn)
{
+ // Filter out dives outside of trip. Note: This is in a separate loop to get the command-description right.
+ QVector<dive *> 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) {