mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive list: more consistent handling of "add to trip"
When multiple dives are selected, we need to be smarter about when to show "add to trip immediately above" or "... below". This code is quite readable, I think, and does the trick. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
bc047238d4
commit
032ea24191
1 changed files with 13 additions and 2 deletions
|
@ -750,9 +750,20 @@ void DiveListView::contextMenuEvent(QContextMenuEvent *event)
|
|||
popup.addAction(tr("remove dive(s) from trip"), this, SLOT(removeFromTrip()));
|
||||
popup.addAction(tr("create new trip above"), this, SLOT(newTripAbove()));
|
||||
if (!d->divetrip) {
|
||||
if (is_trip_before_after(d, (currentOrder == Qt::AscendingOrder)))
|
||||
struct dive *top = d;
|
||||
struct dive *bottom = d;
|
||||
if (d->selected) {
|
||||
if (currentOrder == Qt::AscendingOrder) {
|
||||
top = first_selected_dive();
|
||||
bottom = last_selected_dive();
|
||||
} else {
|
||||
top = last_selected_dive();
|
||||
bottom = first_selected_dive();
|
||||
}
|
||||
}
|
||||
if (is_trip_before_after(top, (currentOrder == Qt::AscendingOrder)))
|
||||
popup.addAction(tr("add dive(s) to trip immediately above"), this, SLOT(addToTripAbove()));
|
||||
if (is_trip_before_after(d, (currentOrder == Qt::DescendingOrder)))
|
||||
if (is_trip_before_after(bottom, (currentOrder == Qt::DescendingOrder)))
|
||||
popup.addAction(tr("add dive(s) to trip immediately below"), this, SLOT(addToTripBelow()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue