mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Change Location Management to make Linus Happy
Do not overwrite a dive site if the name is the same as any other dive site, create a new one and duplicate the information. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1a68e7985b
commit
49ab30ae8b
1 changed files with 9 additions and 2 deletions
|
@ -841,8 +841,15 @@ void MainTab::updateDisplayedDiveSite()
|
|||
displayed_dive.dive_site_uuid = new_uuid;
|
||||
copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site);
|
||||
} else if (new_name.count() && orig_name != new_name) {
|
||||
displayed_dive.dive_site_uuid = find_or_create_dive_site_with_name(qPrintable(new_name));
|
||||
copy_dive_site(get_dive_site_by_uuid(displayed_dive.dive_site_uuid), &displayed_dive_site);
|
||||
// As per linus request.: If I enter the name of a dive site,
|
||||
// do not select a new one, but "clone" the old one and copy
|
||||
// the information of it, just changing it's name.
|
||||
uint32_t new_ds_uuid = create_dive_site(NULL);
|
||||
struct dive_site *new_ds = get_dive_site_by_uuid(new_ds_uuid);
|
||||
copy_dive_site(&displayed_dive_site, new_ds);
|
||||
new_ds->name = copy_string(qPrintable(new_name));
|
||||
displayed_dive.dive_site_uuid = new_ds->uuid;
|
||||
copy_dive_site(new_ds, &displayed_dive_site);
|
||||
} else {
|
||||
qDebug() << "Current divesite is the same as informed";
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue