Commit 2ae9a7d0 authored by David Jarvie's avatar David Jarvie
Browse files

Make session restore correctly reinstate times which use offset from UTC

parent e81d1943
......@@ -928,12 +928,19 @@ void MessageWin::saveProperties(KConfigGroup& config)
config.writeEntry("ConfirmAck", mConfirmAck);
if (mDateTime.isValid())
{
//TODO: Write KADateTime when it becomes possible
config.writeEntry("Time", mDateTime.effectiveDateTime());
config.writeEntry("DateOnly", mDateTime.isDateOnly());
QByteArray zone;
if (mDateTime.isUtc())
zone = "UTC";
else if (mDateTime.isOffsetFromUtc())
{
int offset = mDateTime.utcOffset();
if (offset >= 0)
zone = '+' + QByteArray::number(offset);
else
zone = QByteArray::number(offset);
}
else if (mDateTime.timeType() == KADateTime::TimeZone)
{
const QTimeZone tz = mDateTime.timeZone();
......@@ -994,6 +1001,8 @@ void MessageWin::readProperties(const KConfigGroup& config)
timeSpec = KADateTime::LocalZone;
else if (zoneId == "UTC")
timeSpec = KADateTime::UTC;
else if (zoneId.startsWith('+') || zoneId.startsWith('-'))
timeSpec.setType(KADateTime::OffsetFromUTC, zoneId.toInt());
else
timeSpec = QTimeZone(zoneId);
mDateTime = KADateTime(dt.date(), dt.time(), timeSpec);
......
......@@ -101,9 +101,6 @@ ResourceSelector::ResourceSelector(QWidget* parent)
connect(mEditButton, &QPushButton::clicked, this, &ResourceSelector::editResource);
connect(mDeleteButton, &QPushButton::clicked, this, &ResourceSelector::removeResource);
connect(Resources::instance(), &Resources::resourceRemoved,
this, &ResourceSelector::selectionChanged);
connect(mAlarmType, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &ResourceSelector::alarmTypeSelected);
QTimer::singleShot(0, this, SLOT(alarmTypeSelected()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment