summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mobile-widgets/qml/DiveDetailsEdit.qml3
-rw-r--r--mobile-widgets/qmlmanager.cpp12
-rw-r--r--mobile-widgets/qmlmanager.h1
3 files changed, 16 insertions, 0 deletions
diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml
index 4c4f8e47c..e369e5ab3 100644
--- a/mobile-widgets/qml/DiveDetailsEdit.qml
+++ b/mobile-widgets/qml/DiveDetailsEdit.qml
@@ -112,6 +112,9 @@ Item {
diveDetailsListView.currentItem.modelData.dive.locationList : null
inputMethodHints: Qt.ImhNoPredictiveText
Layout.fillWidth: true
+ onEditingFinished: {
+ gpsText = manager.getGpsFromSiteName(text)
+ }
}
Controls.Label {
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 2c28ccf83..a3f1b5730 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -1536,6 +1536,18 @@ QString QMLManager::getVersion() const
return versionRe.cap(1);
}
+QString QMLManager::getGpsFromSiteName(const QString& siteName)
+{ uint32_t uuid;
+ struct dive_site *ds;
+
+ uuid = get_dive_site_uuid_by_name(qPrintable(siteName), NULL);
+ if (uuid) {
+ ds = get_dive_site_by_uuid(uuid);
+ return QString(printGPSCoords(ds->latitude.udeg, ds->longitude.udeg));
+ }
+ return "";
+}
+
QString QMLManager::notificationText() const
{
return m_notificationText;
diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h
index cde8b8dec..548f01921 100644
--- a/mobile-widgets/qmlmanager.h
+++ b/mobile-widgets/qmlmanager.h
@@ -184,6 +184,7 @@ public slots:
QString getNumber(const QString& diveId);
QString getDate(const QString& diveId);
QString getCurrentPosition();
+ QString getGpsFromSiteName(const QString& siteName);
QString getVersion() const;
void deleteGpsFix(quint64 when);
void revertToNoCloudIfNeeded();