mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Handles Dive Selection gracefully
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ffae64ded7
commit
7426f18a96
1 changed files with 8 additions and 2 deletions
|
@ -868,13 +868,19 @@ void MainTab::updateDiveSite(int divenr)
|
|||
uint32_t pickedUuid = ui.location->currDiveSiteUuid();
|
||||
const uint32_t origUuid = cd->dive_site_uuid;
|
||||
struct dive_site *origDs = get_dive_site_by_uuid(origUuid);
|
||||
struct dive_site *newDs = NULL;
|
||||
|
||||
if (pickedUuid == origUuid) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pickedUuid == RECENTLY_ADDED_DIVESITE) {
|
||||
pickedUuid = create_dive_site(ui.location->text().isEmpty() ? qPrintable(tr("New dive site")) : qPrintable(ui.location->text()), displayed_dive.when);
|
||||
struct dive_site *newDs = get_dive_site_by_uuid(pickedUuid);
|
||||
copy_dive_site(newDs, &displayed_dive_site);
|
||||
}
|
||||
|
||||
newDs = get_dive_site_by_uuid(pickedUuid);
|
||||
copy_dive_site(newDs, &displayed_dive_site);
|
||||
|
||||
if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) {
|
||||
// this is a special case - let's remove the original dive site if this was the only user
|
||||
if (!is_dive_site_used(origDs->uuid, false)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue