diff options
author | 2019-02-18 18:40:28 +0100 | |
---|---|---|
committer | 2019-04-04 14:53:24 -0700 | |
commit | a3a1a74d1febb8f25ca6cc30f8f996e2f68fa28b (patch) | |
tree | 30a54bd93807d90dfa50733fb1ef3bba36597b2b /desktop-widgets | |
parent | 736941870ae92ebd26e30b57276bb5c751bdfdf7 (diff) | |
download | subsurface-a3a1a74d1febb8f25ca6cc30f8f996e2f68fa28b.tar.gz |
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 <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index b61c9ab78..b02420c53 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -903,11 +903,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 != TRIP && current_dive->divetrip) { current_dive->divetrip->when = current_dive->when; |