Set the Cylinders and Weigths to all selected dives after pressing 'Accept'

This bit of magic actually performs the save on the
dive list for the changed weigths and cylinders,
it will set the cylinders only if there's a change
on the cylinder model, and it will set the weight
only if there's a change in the weigth model.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
Tomaz Canabrava 2013-09-25 14:57:41 -03:00
parent 8ce5d91dfe
commit d9067582a9

View file

@ -431,8 +431,25 @@ void MainTab::acceptChanges()
mainWindow()->globe()->reload();
mainWindow()->globe()->centerOn(current_dive);
}
if (cylindersModel->changed || weightModel->changed)
if (cylindersModel->changed) {
mark_divelist_changed(TRUE);
Q_FOREACH(dive *d, notesBackup.keys()){
for(int i = 0; i < MAX_CYLINDERS; i++){
d->cylinder[i] = multiEditEquipmentPlaceholder.cylinder[i];
}
}
}
if (weightModel->changed) {
mark_divelist_changed(TRUE);
Q_FOREACH(dive *d, notesBackup.keys()){
for(int i = 0; i < MAX_CYLINDERS; i++){
d->cylinder[i] = multiEditEquipmentPlaceholder.cylinder[i];
}
}
}
}
if (editMode == ADD) {
// clean up the dive data (get duration, depth information from samples)