summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-12 00:25:31 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commit59e602447b951cfdfabd8f0a067dfb8c804ee506 (patch)
tree0c36803d41b76951058999db481100f131198936 /desktop-widgets
parent84f7179367e4638a323f4bd14990711c84b56ffb (diff)
downloadsubsurface-59e602447b951cfdfabd8f0a067dfb8c804ee506.tar.gz
Dive site: inform model of dive site addition / deletion
Introduce two DiveListNotifier signals which are sent by the undo commands if dives are added to / removed from the core. The signal has the dive site and the index in the global dive site table as payload. Thus, the model has only to remove the appropriate rows. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/command_divelist.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/desktop-widgets/command_divelist.cpp b/desktop-widgets/command_divelist.cpp
index 59dec85c3..8da0fab46 100644
--- a/desktop-widgets/command_divelist.cpp
+++ b/desktop-widgets/command_divelist.cpp
@@ -133,8 +133,9 @@ DivesAndTripsToAdd DiveListBase::removeDives(DivesAndSitesToRemove &divesAndSite
divesAndSitesToDelete.dives.clear();
for (dive_site *ds: divesAndSitesToDelete.sites) {
- unregister_dive_site(ds);
+ int idx = unregister_dive_site(ds);
sitesToAdd.emplace_back(ds);
+ emit diveListNotifier.diveSiteDeleted(ds, idx);
}
divesAndSitesToDelete.sites.clear();
@@ -188,7 +189,8 @@ DivesAndSitesToRemove DiveListBase::addDives(DivesAndTripsToAdd &toAdd)
// Finally, add any necessary dive sites
for (OwningDiveSitePtr &ds: toAdd.sites) {
sites.push_back(ds.get());
- register_dive_site(ds.release()); // Return ownership to backend
+ int idx = register_dive_site(ds.release()); // Return ownership to backend
+ emit diveListNotifier.diveSiteAdded(sites.back(), idx);
}
toAdd.sites.clear();