summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 02:04:20 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 11:19:27 -0800
commit5c4d2660604af8925b757025571a8dcc36da1cdc (patch)
treea041642ed58cac8e479fffc99e1ebe74c9c25792 /qt-ui/maintab.cpp
parentcd28e88bee085b1f12561764b87a9b8ffc0a8212 (diff)
downloadsubsurface-5c4d2660604af8925b757025571a8dcc36da1cdc.tar.gz
Make editing a location work with dive sites
Not sure if this is the final implementation, but at least for simple cases it works now. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp25
1 files changed, 6 insertions, 19 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index d2990b194..ab691a4b4 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1158,25 +1158,12 @@ void MainTab::on_location_textChanged(const QString &text)
// If we have GPS data for the location entered, add it.
void MainTab::on_location_editingFinished()
{
- // if we have a location and no GPS data, look up the GPS data;
- // but if the GPS data was intentionally cleared then don't
- if (!currentTrip &&
- !same_string(displayed_dive.location, "") &&
- ui.coordinates->text().trimmed().isEmpty() &&
- !(editMode == DIVE && dive_has_gps_location(current_dive))) {
- struct dive *dive;
- int i = 0;
- for_each_dive (i, dive) {
- if (same_string(displayed_dive.location, dive->location) &&
- (dive->latitude.udeg || dive->longitude.udeg)) {
- displayed_dive.latitude = dive->latitude;
- displayed_dive.longitude = dive->longitude;
- MainWindow::instance()->globe()->reload();
- updateGpsCoordinates();
- break;
- }
- }
- }
+ // find the dive site or create it
+ const char *name = ui.location->text().toUtf8().data();
+ uint32_t uuid = get_dive_site_uuid_by_name(name);
+ if (!uuid)
+ uuid = create_dive_site(name);
+ displayed_dive.dive_site_uuid = uuid;
}
void MainTab::on_suit_textChanged(const QString &text)