summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-01-03 16:04:54 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-03-06 10:00:13 +0100
commitc495a49b1b044ab54ee60d4b0db14caa3f8e3de1 (patch)
treea32ec02598b1cc53690c72f7c783c25e8ce38096 /desktop-widgets/tab-widgets/maintab.cpp
parent62adc24d150b0566b9cc9ab449de4ed30ac2ab62 (diff)
downloadsubsurface-c495a49b1b044ab54ee60d4b0db14caa3f8e3de1.tar.gz
Cleanup: use getDiveSelection() for shifting time
There are two cases where dive-times are shifted: in an explicit dialog and when editing the date/time of a dive. In each of these cases, the selected dives were collected manually. Instead use the getDiveSelection() function. Since this returns a std::vector, change the argument of Command::ShiftTime() to such a std::vector. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tab-widgets/maintab.cpp')
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index b17b80633..85d64c66d 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -677,18 +677,10 @@ void MainTab::on_depth_editingFinished()
// all dives are shifted by an offset.
static void shiftTime(QDateTime &dateTime)
{
- QVector<dive *> dives;
- struct dive *d;
- int i;
- for_each_dive (i, d) {
- if (d->selected)
- dives.append(d);
- }
-
timestamp_t when = dateTime.toTime_t();
if (current_dive && current_dive->when != when) {
timestamp_t offset = when - current_dive->when;
- Command::shiftTime(dives, (int)offset);
+ Command::shiftTime(getDiveSelection(), (int)offset);
}
}