summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 3cc8ed0c5..06267d590 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -365,6 +365,19 @@ void QMLManager::openLocalThenRemote(QString url)
updateAllGlobalLists();
}
+// Convenience function to accesss dive directly via its row.
+static struct dive *diveInRow(const QAbstractItemModel *model, int row)
+{
+ QModelIndex index = model->index(row, 0, QModelIndex());
+ return index.isValid() ? model->data(index, DiveTripModelBase::DIVE_ROLE).value<struct dive *>() : nullptr;
+}
+
+void QMLManager::selectRow(int row)
+{
+ dive *d = diveInRow(MobileListModel::instance(), row);
+ select_single_dive(d);
+}
+
void QMLManager::updateSiteList()
{
LocationInformationModel::instance()->update();