Fixed entering a dive stop before another dive stop.

Fixed entering a dive stop before another dive stop,
the correct way is to fix the position of them but
this is easyer - I'll update the correct one in
a couple of patches.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-08-26 16:55:30 -03:00
parent 9d90034109
commit 760c14ac0c

View file

@ -959,6 +959,14 @@ void DivePlannerPointsModel::setStartTime(const QTime& t)
int DivePlannerPointsModel::addStop(int meters, int minutes, const QString& gas, int ccpoint)
{
int row = divepoints.count();
// check if there's already a new stop before this one:
Q_FOREACH(const divedatapoint& dp, divepoints){
if (dp.time > minutes ){
return -1;
}
}
// add the new stop
beginInsertRows(QModelIndex(), row, row);
divedatapoint point;
point.depth = meters;