mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly edit dive date/time when editing manually entered dives
While the existing code worked fine for editing that start date or time of dives downloaded from a dive computer or imported from some other source, for manually entered dives this did not work and the date or time was always reset to the original time once the changes were saved. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4de44e6c9f
commit
e1db94ea0c
1 changed files with 4 additions and 4 deletions
|
@ -973,22 +973,22 @@ void MainTab::on_dateEdit_dateChanged(const QDate &date)
|
|||
{
|
||||
if (editMode == IGNORE)
|
||||
return;
|
||||
markChangedWidget(ui.dateEdit);
|
||||
QDateTime dateTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
|
||||
dateTime.setTimeSpec(Qt::UTC);
|
||||
dateTime.setDate(date);
|
||||
displayed_dive.when = dateTime.toTime_t();
|
||||
markChangedWidget(ui.dateEdit);
|
||||
DivePlannerPointsModel::instance()->getDiveplan().when = displayed_dive.when = dateTime.toTime_t();
|
||||
}
|
||||
|
||||
void MainTab::on_timeEdit_timeChanged(const QTime &time)
|
||||
{
|
||||
if (editMode == IGNORE)
|
||||
return;
|
||||
markChangedWidget(ui.timeEdit);
|
||||
QDateTime dateTime = QDateTime::fromTime_t(displayed_dive.when - gettimezoneoffset(displayed_dive.when));
|
||||
dateTime.setTimeSpec(Qt::UTC);
|
||||
dateTime.setTime(time);
|
||||
displayed_dive.when = dateTime.toTime_t();
|
||||
markChangedWidget(ui.timeEdit);
|
||||
DivePlannerPointsModel::instance()->getDiveplan().when = displayed_dive.when = dateTime.toTime_t();
|
||||
}
|
||||
|
||||
// changing the tags on multiple dives is semantically strange - what's the right thing to do?
|
||||
|
|
Loading…
Add table
Reference in a new issue