mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Selects the dive before the deleted ones.
This patch makes a selection just after the dives that got deleted, or nothing if the list is empty. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
73cd8f3e56
commit
8476ea5ea8
1 changed files with 7 additions and 0 deletions
|
@ -473,12 +473,14 @@ void DiveListView::deleteDive()
|
|||
// after a dive is deleted the ones following it move forward in the dive_table
|
||||
// so instead of using the for_each_dive macro I'm using an explicit for loop
|
||||
// to make this easier to understand
|
||||
int lastDiveNr = -1;
|
||||
for (i = 0; i < dive_table.nr; i++) {
|
||||
d = get_dive(i);
|
||||
if (!d->selected)
|
||||
continue;
|
||||
delete_single_dive(i);
|
||||
i--; // so the next dive isn't skipped... it's now #i
|
||||
lastDiveNr = i;
|
||||
}
|
||||
if (amount_selected == 0) {
|
||||
if (i > 0)
|
||||
|
@ -488,6 +490,11 @@ void DiveListView::deleteDive()
|
|||
}
|
||||
mark_divelist_changed(TRUE);
|
||||
mainWindow()->refreshDisplay();
|
||||
if(lastDiveNr != -1){
|
||||
clearSelection();
|
||||
selectDive(lastDiveNr);
|
||||
rememberSelection();
|
||||
}
|
||||
}
|
||||
|
||||
void DiveListView::testSlot()
|
||||
|
|
Loading…
Reference in a new issue