summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divelistview.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-11-24 20:17:27 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-12 15:52:40 -0800
commit16f86f2f65e73935496e3324bb16f9b8cd4d7953 (patch)
treeb7add43d1197fc782d9901a7bbf79e4e99f793ec /desktop-widgets/divelistview.cpp
parent369c5b0dc656cbf4da2c8185debc355af4243cc5 (diff)
downloadsubsurface-16f86f2f65e73935496e3324bb16f9b8cd4d7953.tar.gz
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/divelistview.cpp')
-rw-r--r--desktop-widgets/divelistview.cpp19
1 files changed, 2 insertions, 17 deletions
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index 14973cf0a..3d5974c53 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -679,15 +679,7 @@ void DiveListView::mergeTripBelow()
void DiveListView::removeFromTrip()
{
- //TODO: move this to C-code.
- int i;
- struct dive *d;
- QVector<dive *> divesToRemove;
- for_each_dive (i, d) {
- if (d->selected && d->divetrip)
- divesToRemove.append(d);
- }
- Command::removeDivesFromTrip(divesToRemove);
+ Command::removeDivesFromTrip(stdToQt(getDiveSelection()));
}
void DiveListView::newTripAbove()
@@ -695,14 +687,7 @@ void DiveListView::newTripAbove()
struct dive *d = contextMenuIndex.data(DiveTripModelBase::DIVE_ROLE).value<struct dive *>();
if (!d) // shouldn't happen as we only are setting up this action if this is a dive
return;
- //TODO: port to c-code.
- int idx;
- QVector<dive *> dives;
- for_each_dive (idx, d) {
- if (d->selected)
- dives.append(d);
- }
- Command::createTrip(dives);
+ Command::createTrip(stdToQt(getDiveSelection()));
}
void DiveListView::addToTripBelow()