From c58e822f15c27d2b1342d441b427e4eb27d3ecee Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Date: Sun, 7 Jun 2015 10:29:17 -0300
Subject: [PATCH 8/8] Select the correct dive in EditAddedDive mode

If we added two dives, and then tried to edit
the first added one, the current 'added dive'
set on main_tab would be the second one, so when
we got to the accept() part of the call, it would
reselect the last added_dive that we had.

Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
---
 qt-ui/maintab.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 68034fb..55b01a2 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -800,6 +800,7 @@ void MainTab::acceptChanges()
 			// preserve any changes to the profile
 			free(current_dive->dc.sample);
 			copy_samples(&displayed_dive.dc, &current_dive->dc);
+			addedId = displayed_dive.id;
 		}
 		struct dive *cd = current_dive;
 		// now check if something has changed and if yes, edit the selected dives that
-- 
2.3.2 (Apple Git-55)

