From 64704d6e5a0865c5acb6ce40cc32ba929f41ba00 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Wed, 22 Nov 2017 16:19:44 +0100 Subject: mobile: autocomplete location names Add the capability to select the location name from a list, constructed from the known dive sites in the logbook. Fixes: #546 Signed-off-by: Jan Mulder --- core/subsurface-qt/DiveObjectHelper.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'core/subsurface-qt/DiveObjectHelper.cpp') diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index 8e5890b4c..7a3767409 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -426,6 +426,23 @@ QStringList DiveObjectHelper::suitList() const return suits; } +QStringList DiveObjectHelper::locationList() const +{ + QStringList locations; + struct dive *d; + struct dive_site *ds; + int i = 0; + for_each_dive (i, d) { + ds = get_dive_site_by_uuid(d->dive_site_uuid); + QString temp = ds->name; + if (!temp.isEmpty()) + locations << temp; + } + locations.removeDuplicates(); + locations.sort(); + return locations; +} + QStringList DiveObjectHelper::buddyList() const { QStringList buddies; -- cgit v1.2.3-70-g09d2