summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-25 14:57:41 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-09-25 14:57:41 -0300
commitd9067582a9135c69562132a8a3b6c272c71da7f5 (patch)
tree0f40f9908b8566ae6c1caca254feeb7a90522da9
parent8ce5d91dfed3e147dce03d6bbfa117b48f9170da (diff)
downloadsubsurface-d9067582a9135c69562132a8a3b6c272c71da7f5.tar.gz
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>
-rw-r--r--qt-ui/maintab.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index b0fd62041..f876e88e1 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -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)