mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Upon undoing a dive deletion select that dive
Before it had the next dive still selected. Fixes #1053 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e1af20728e
commit
7bca367c57
3 changed files with 6 additions and 4 deletions
|
@ -54,11 +54,12 @@ Kirigami.Page {
|
|||
onTriggered: {
|
||||
contextDrawer.close()
|
||||
var deletedId = diveDetailsListView.currentItem.modelData.dive.id
|
||||
var deletedIndex = diveDetailsListView.currentIndex
|
||||
manager.deleteDive(deletedId)
|
||||
stackView.pop()
|
||||
showPassiveNotification("Dive deleted", 3000, "Undo",
|
||||
function() {
|
||||
manager.undoDelete(deletedId)
|
||||
diveDetailsListView.currentIndex = manager.undoDelete(deletedId) ? deletedIndex : diveDetailsListView.currentIndex
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -816,11 +816,11 @@ void QMLManager::saveChangesCloud(bool forceRemoteSync)
|
|||
alreadySaving = false;
|
||||
}
|
||||
|
||||
void QMLManager::undoDelete(int id)
|
||||
bool QMLManager::undoDelete(int id)
|
||||
{
|
||||
if (!deletedDive || deletedDive->id != id) {
|
||||
qDebug() << "can't find the deleted dive";
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (deletedTrip)
|
||||
insert_trip(&deletedTrip);
|
||||
|
@ -840,6 +840,7 @@ void QMLManager::undoDelete(int id)
|
|||
changesNeedSaving();
|
||||
deletedDive = NULL;
|
||||
deletedTrip = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void QMLManager::deleteDive(int id)
|
||||
|
|
|
@ -103,7 +103,7 @@ public slots:
|
|||
void saveChangesLocal();
|
||||
void saveChangesCloud(bool forceRemoteSync);
|
||||
void deleteDive(int id);
|
||||
void undoDelete(int id);
|
||||
bool undoDelete(int id);
|
||||
QString addDive();
|
||||
void addDiveAborted(int id);
|
||||
void applyGpsData();
|
||||
|
|
Loading…
Add table
Reference in a new issue