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: {
|
onTriggered: {
|
||||||
contextDrawer.close()
|
contextDrawer.close()
|
||||||
var deletedId = diveDetailsListView.currentItem.modelData.dive.id
|
var deletedId = diveDetailsListView.currentItem.modelData.dive.id
|
||||||
|
var deletedIndex = diveDetailsListView.currentIndex
|
||||||
manager.deleteDive(deletedId)
|
manager.deleteDive(deletedId)
|
||||||
stackView.pop()
|
stackView.pop()
|
||||||
showPassiveNotification("Dive deleted", 3000, "Undo",
|
showPassiveNotification("Dive deleted", 3000, "Undo",
|
||||||
function() {
|
function() {
|
||||||
manager.undoDelete(deletedId)
|
diveDetailsListView.currentIndex = manager.undoDelete(deletedId) ? deletedIndex : diveDetailsListView.currentIndex
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -816,11 +816,11 @@ void QMLManager::saveChangesCloud(bool forceRemoteSync)
|
||||||
alreadySaving = false;
|
alreadySaving = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::undoDelete(int id)
|
bool QMLManager::undoDelete(int id)
|
||||||
{
|
{
|
||||||
if (!deletedDive || deletedDive->id != id) {
|
if (!deletedDive || deletedDive->id != id) {
|
||||||
qDebug() << "can't find the deleted dive";
|
qDebug() << "can't find the deleted dive";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (deletedTrip)
|
if (deletedTrip)
|
||||||
insert_trip(&deletedTrip);
|
insert_trip(&deletedTrip);
|
||||||
|
@ -840,6 +840,7 @@ void QMLManager::undoDelete(int id)
|
||||||
changesNeedSaving();
|
changesNeedSaving();
|
||||||
deletedDive = NULL;
|
deletedDive = NULL;
|
||||||
deletedTrip = NULL;
|
deletedTrip = NULL;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMLManager::deleteDive(int id)
|
void QMLManager::deleteDive(int id)
|
||||||
|
|
|
@ -103,7 +103,7 @@ public slots:
|
||||||
void saveChangesLocal();
|
void saveChangesLocal();
|
||||||
void saveChangesCloud(bool forceRemoteSync);
|
void saveChangesCloud(bool forceRemoteSync);
|
||||||
void deleteDive(int id);
|
void deleteDive(int id);
|
||||||
void undoDelete(int id);
|
bool undoDelete(int id);
|
||||||
QString addDive();
|
QString addDive();
|
||||||
void addDiveAborted(int id);
|
void addDiveAborted(int id);
|
||||||
void applyGpsData();
|
void applyGpsData();
|
||||||
|
|
Loading…
Add table
Reference in a new issue