From d9067582a9135c69562132a8a3b6c272c71da7f5 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 25 Sep 2013 14:57:41 -0300 Subject: 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 --- qt-ui/maintab.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'qt-ui') 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) -- cgit v1.2.3-70-g09d2