mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Make 'Choose dive site' work as 'Rename'
But it will actually create a new dive site, not just rename the existing one. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
2794af4166
commit
0847447cda
1 changed files with 9 additions and 5 deletions
|
@ -885,13 +885,17 @@ void MainTab::updateDiveSite(int divenr)
|
|||
}
|
||||
|
||||
newDs = get_dive_site_by_uuid(pickedUuid);
|
||||
copy_dive_site(newDs, &displayed_dive_site);
|
||||
|
||||
// Copy everything from the displayed_dive_site, so we have the latitude, longitude, notes, etc.
|
||||
// The user *might* be using wrongly the 'choose dive site' just to edit the name of it, sigh.
|
||||
if(origDs) {
|
||||
copy_dive_site(origDs, newDs);
|
||||
free(newDs->name);
|
||||
newDs->name = copy_string(qPrintable(ui.location->text().constData()));
|
||||
newDs->uuid = pickedUuid;
|
||||
}
|
||||
|
||||
if (origDs && pickedUuid != origDs->uuid && same_string(origDs->notes, "SubsurfaceWebservice")) {
|
||||
// this is a special case - let's keep the GPS data and
|
||||
// remove the original dive site if this was the only user
|
||||
newDs->latitude.udeg = origDs->latitude.udeg;
|
||||
newDs->longitude.udeg = origDs->longitude.udeg;
|
||||
if (!is_dive_site_used(origDs->uuid, false)) {
|
||||
if (verbose)
|
||||
qDebug() << "delete the autogenerated dive site" << origDs->name;
|
||||
|
|
Loading…
Add table
Reference in a new issue