From 68b5493c14978b01e8cb29c1244aea0ce3a79833 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 18 Feb 2019 18:40:28 +0100 Subject: Edit: use correct offset when changing dive times The undo-work reversed the direction of the offset. This was apparently only fixed when using the menu entry, but not when editing dives directly. Invert the offset to get the correct time. While doing so, remove a redundant if: First it checked whether the dates are the same, then whether the offset is non-zero. Fixes #1975. Signed-off-by: Berthold Stoeger --- desktop-widgets/tab-widgets/maintab.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 7882573ba..11ad99d50 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -892,11 +892,9 @@ void MainTab::acceptChanges() } } - if (displayed_dive.when != cd->when) { - timestamp_t offset = cd->when - displayed_dive.when; - if (offset) - Command::shiftTime(selectedDives, (int)offset); - } + timestamp_t offset = displayed_dive.when - cd->when; + if (offset) + Command::shiftTime(selectedDives, (int)offset); } if (editMode == MANUALLY_ADDED_DIVE) { // we just added or edited the dive, let fixup_dive() make -- cgit v1.2.3-70-g09d2