mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
369c5b0dc6
commit
16f86f2f65
2 changed files with 9 additions and 18 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue