summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-07-13 17:11:03 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-13 16:06:05 -0700
commit49ab30ae8b65c3ad443a5824ae5f9554e88c7a39 (patch)
tree09a55ae19eab78456e60ff3f32aa2d0eba55c3d3 /qt-ui/maintab.cpp
parent1a68e7985b1aad038b0a0d337ab5d606aa43f64c (diff)
downloadsubsurface-49ab30ae8b65c3ad443a5824ae5f9554e88c7a39.tar.gz
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>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 66e42e3c4..2efaa520c 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -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";
}