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>
This commit is contained in:
Dirk Hohndel 2016-01-27 11:50:04 -08:00
parent 6f953d51de
commit ec0fc9d70b
2 changed files with 5 additions and 10 deletions

View file

@ -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()