From 7b5381b6de5549463c6180c58fbde2cdbc8df7e6 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 17 Oct 2022 10:20:35 -0700 Subject: [PATCH] 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 --- CHANGELOG.md | 5 +---- desktop-widgets/simplewidgets.cpp | 13 ++++++------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f10fb8f3..040ea7990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index cc1a1ed2c..a2d055a46 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -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()