summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmanager.cpp
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-28 10:26:45 +0100
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-31 14:48:14 +0100
commit572fc470718e4a11d5df60b37e7a2a91639285c7 (patch)
tree012052da9ce773463550741c33e33a00626c3434 /mobile-widgets/qmlmanager.cpp
parentfed2c5b6a1c71649bcb310c0bd118cb1abcf9ea0 (diff)
downloadsubsurface-572fc470718e4a11d5df60b37e7a2a91639285c7.tar.gz
mobile cleanup: unduplicate code and do not loop over dives (2)
See e6e1473e6. Exact same commit but here for the list of buddies. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'mobile-widgets/qmlmanager.cpp')
-rw-r--r--mobile-widgets/qmlmanager.cpp22
1 files changed, 3 insertions, 19 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index 4846dcdec..36f7768e5 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -273,7 +273,7 @@ void QMLManager::openLocalThenRemote(QString url)
appendTextToLog(QStringLiteral("have cloud credentials, trying to connect"));
tryRetrieveDataFromBackend();
}
- buddyModel.updateModel();
+ buddyModel.updateModel(); emit buddyListChanged();
suitModel.updateModel(); emit suitListChanged();
}
@@ -1556,25 +1556,9 @@ QStringList QMLManager::suitList() const
return suitModel.stringList();
}
-QStringList QMLManager::buddyInit() const
+QStringList QMLManager::buddyList() const
{
- QStringList buddies;
- struct dive *d;
- int i = 0;
- for_each_dive (i, d) {
- QString temp = d->buddy;
- if (!temp.isEmpty() && !temp.contains(",")){
- buddies << d->buddy;
- }
- else if (!temp.isEmpty()){
- QRegExp sep("(,\\s)");
- QStringList tempList = temp.split(sep);
- buddies << tempList;
- }
- }
- buddies.removeDuplicates();
- buddies.sort();
- return buddies;
+ return buddyModel.stringList();
}
QStringList QMLManager::divemasterInit() const