diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-27 11:50:04 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-27 11:50:04 -0800 |
commit | ec0fc9d70b679b854fb50d685a5dcfe6f1bf7093 (patch) | |
tree | 101061bc11e7b413da02b4a4370f0ed8cba99bef /qt-models/divelistmodel.cpp | |
parent | 6f953d51de0796bd584938d759b32eeffb849463 (diff) | |
download | subsurface-ec0fc9d70b679b854fb50d685a5dcfe6f1bf7093.tar.gz |
Change the api to update a single dive
Instead of searching for the dive in the list, just make sure we are given
the index.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-models/divelistmodel.cpp')
-rw-r--r-- | qt-models/divelistmodel.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp index 6e0804743..6706d9137 100644 --- a/qt-models/divelistmodel.cpp +++ b/qt-models/divelistmodel.cpp @@ -30,16 +30,11 @@ void DiveListModel::removeDive(int i) endRemoveRows(); } -void DiveListModel::updateDive(dive *d) +void DiveListModel::updateDive(int i, dive *d) { - for (int i = 0; i < m_dives.count(); i++) { - if (m_dives.at(i)->id() == d->id) { - DiveObjectHelper *newDive = new DiveObjectHelper(d); - removeDive(i); - insertDive(i, newDive); - break; - } - } + DiveObjectHelper *newDive = new DiveObjectHelper(d); + removeDive(i); + insertDive(i, newDive); } void DiveListModel::clear() |