aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-26 20:02:23 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-12-26 20:02:23 -0800
commitce2b910cdbd79547ab78ad65fb95f10fa19ea9dd (patch)
treec5cdd0a3c09e17e652e4bf304847a3bb6b49960e /qt-mobile
parent763986b683324effd86157ddec8951e74406dac7 (diff)
downloadsubsurface-ce2b910cdbd79547ab78ad65fb95f10fa19ea9dd.tar.gz
Two more helper functions for the QML manager
I'm not sure this is the best way to do this - QML should be able to get to the model data directly (I hope?). But this seems to work and I need it to make Add Dive be semi-correct. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qmlmanager.cpp20
-rw-r--r--qt-mobile/qmlmanager.h2
2 files changed, 22 insertions, 0 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp
index 0897dcff8..e684255c3 100644
--- a/qt-mobile/qmlmanager.cpp
+++ b/qt-mobile/qmlmanager.cpp
@@ -477,3 +477,23 @@ void QMLManager::showMap(QString location)
QDesktopServices::openUrl(link);
}
}
+
+QString QMLManager::getNumber(QString diveId)
+{
+ int dive_id = diveId.toInt();
+ struct dive *d = get_dive_by_uniq_id(dive_id);
+ QString number;
+ if (d)
+ number = QString::number(d->number);
+ return number;
+}
+
+QString QMLManager::getDate(QString diveId)
+{
+ int dive_id = diveId.toInt();
+ struct dive *d = get_dive_by_uniq_id(dive_id);
+ QString datestring;
+ if (d)
+ datestring = get_dive_date_string(d->when);
+ return datestring;
+}
diff --git a/qt-mobile/qmlmanager.h b/qt-mobile/qmlmanager.h
index f6ed60aed..be37f5a74 100644
--- a/qt-mobile/qmlmanager.h
+++ b/qt-mobile/qmlmanager.h
@@ -79,6 +79,8 @@ public slots:
void clearGpsData();
void finishSetup();
void showMap(QString location);
+ QString getNumber(QString diveId);
+ QString getDate(QString diveId);
private:
QString m_cloudUserName;