summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-06-26 15:26:40 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-26 18:50:22 -0700
commit78293f50786e31f7f3d020660eeee2b183148b61 (patch)
tree783dbb50534ee22bc798922ae451bd4e59883b98 /qt-ui/maintab.cpp
parent50bd467723a7da0b75a014a916701ba7811be58e (diff)
downloadsubsurface-78293f50786e31f7f3d020660eeee2b183148b61.tar.gz
Dive site rewrite: create a dive site if string doesn't exist
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.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 53c4d6d61..239286053 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1313,7 +1313,15 @@ void MainTab::on_location_editingFinished()
);
if (list.isEmpty()) {
- qDebug() << "TODO: add this string on the location management.";
+ uint32_t uuid = create_dive_site(qPrintable(ui.location->text()));
+ displayed_dive.dive_site_uuid = uuid;
+ copy_dive_site(get_dive_site_by_uuid(uuid), &displayed_dive_site);
+ markChangedWidget(ui.location);
+
+ LocationInformationModel::instance()->update();
+ LocationCompletionModel *m = qobject_cast<LocationCompletionModel*>(ui.location->completer()->model());
+ m->updateModel();
+ emit diveSiteChanged(uuid);
return;
}
@@ -1328,8 +1336,7 @@ void MainTab::on_location_editingFinished()
return;
ds_from_dive = get_dive_site(idx);
displayed_dive.dive_site_uuid = ds_from_dive->uuid;
-
-
+ copy_dive_site(get_dive_site_by_uuid(ds_from_dive->uuid), &displayed_dive_site);
markChangedWidget(ui.location);
emit diveSiteChanged(ds_from_dive->uuid);
}