diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-02-18 18:40:28 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-02-18 12:57:13 -0800 |
commit | 68b5493c14978b01e8cb29c1244aea0ce3a79833 (patch) | |
tree | bd5f71fba8e64485d6f3151d6038245e5ffc5416 /desktop-widgets/tab-widgets | |
parent | 9d582c5512c261bbea5d6257375c291a06721950 (diff) | |
download | subsurface-68b5493c14978b01e8cb29c1244aea0ce3a79833.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/tab-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 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 |