desktop: make time shift dialog show correct times

This got broken in commit 7417f865cd ("cleanup: un-singletonize
ShiftTimesDialog") and no one ever noticed.

We need to intitialize the when variable and set up the initial texts in
order for the time shift dialog to show the correct information. Doing
this in the ButtonClicked member (right before the dialog is destroyed)
makes absolutely no sense.

Fixes #3535

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2022-10-17 10:20:35 -07:00
parent c88d22462d
commit 7b5381b6de
2 changed files with 7 additions and 11 deletions

View file

@ -1,7 +1,4 @@
mobile: implement paging through dive computers
mobile: send log files as attachments for support emails on iOS
mobile: allow cloud account deletion (Apple app store requirement)
mobile: fix listing of local cloud cache directories
desktop: fix dive time display in time shift dialog
---
* Always add new entries at the very top of this file above other existing entries and this note.

View file

@ -89,13 +89,6 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button)
if (amount != 0)
Command::shiftTime(getDiveSelection(), amount);
}
ui.timeEdit->setTime(QTime(0, 0, 0, 0));
dive *d = first_selected_dive();
if (d) {
ui.currentTime->setText(get_dive_date_string(d->when));
ui.shiftedTime->setText(get_dive_date_string(d->when));
}
}
void ShiftTimesDialog::changeTime()
@ -120,6 +113,12 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent),
connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
dive *d = first_selected_dive();
if (d) {
when = d->when;
ui.currentTime->setText(get_dive_date_string(when));
ui.shiftedTime->setText(get_dive_date_string(when));
}
}
void ShiftImageTimesDialog::syncCameraClicked()