summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-28 11:28:01 +0100
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-31 14:48:14 +0100
commit83259008e763d3cc120c826f58f91a0ff62b6b92 (patch)
treec78b2d3cd2e390858a38787c97a130d55f5c9458 /mobile-widgets/qmlmanager.cpp
parent572fc470718e4a11d5df60b37e7a2a91639285c7 (diff)
downloadsubsurface-83259008e763d3cc120c826f58f91a0ff62b6b92.tar.gz
mobile cleanup: unduplicate code and do not loop over dives (3)
See e6e1473e6. Exact same commit but here for the list of divemaster. The careful reader will spot a small addition to the clearDetailsEdit() QML function. Two more field are cleared. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp15
1 files changed, 3 insertions, 12 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 36f7768e5..57cacba74 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -275,6 +275,7 @@ void QMLManager::openLocalThenRemote(QString url)
}
buddyModel.updateModel(); emit buddyListChanged();
suitModel.updateModel(); emit suitListChanged();
+ divemasterModel.updateModel(); emit divemasterListChanged();
}
void QMLManager::mergeLocalRepo()
@@ -1561,19 +1562,9 @@ QStringList QMLManager::buddyList() const
return buddyModel.stringList();
}
-QStringList QMLManager::divemasterInit() const
+QStringList QMLManager::divemasterList() const
{
- QStringList divemasters;
- struct dive *d;
- int i = 0;
- for_each_dive (i, d) {
- QString temp = d->divemaster;
- if (!temp.isEmpty())
- divemasters << d->divemaster;
- }
- divemasters.removeDuplicates();
- divemasters.sort();
- return divemasters;
+ return divemasterModel.stringList();
}
QStringList QMLManager::cylinderInit() const