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) ...@@ -928,12 +928,19 @@ void MessageWin::saveProperties(KConfigGroup& config)
config.writeEntry("ConfirmAck", mConfirmAck); config.writeEntry("ConfirmAck", mConfirmAck);
if (mDateTime.isValid()) if (mDateTime.isValid())
{ {
//TODO: Write KADateTime when it becomes possible
config.writeEntry("Time", mDateTime.effectiveDateTime()); config.writeEntry("Time", mDateTime.effectiveDateTime());
config.writeEntry("DateOnly", mDateTime.isDateOnly()); config.writeEntry("DateOnly", mDateTime.isDateOnly());
QByteArray zone; QByteArray zone;
if (mDateTime.isUtc()) if (mDateTime.isUtc())
zone = "UTC"; 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) else if (mDateTime.timeType() == KADateTime::TimeZone)
{ {
const QTimeZone tz = mDateTime.timeZone(); const QTimeZone tz = mDateTime.timeZone();
...@@ -994,6 +1001,8 @@ void MessageWin::readProperties(const KConfigGroup& config) ...@@ -994,6 +1001,8 @@ void MessageWin::readProperties(const KConfigGroup& config)
timeSpec = KADateTime::LocalZone; timeSpec = KADateTime::LocalZone;
else if (zoneId == "UTC") else if (zoneId == "UTC")
timeSpec = KADateTime::UTC; timeSpec = KADateTime::UTC;
else if (zoneId.startsWith('+') || zoneId.startsWith('-'))
timeSpec.setType(KADateTime::OffsetFromUTC, zoneId.toInt());
else else
timeSpec = QTimeZone(zoneId); timeSpec = QTimeZone(zoneId);
mDateTime = KADateTime(dt.date(), dt.time(), timeSpec); mDateTime = KADateTime(dt.date(), dt.time(), timeSpec);
......
...@@ -101,9 +101,6 @@ ResourceSelector::ResourceSelector(QWidget* parent) ...@@ -101,9 +101,6 @@ ResourceSelector::ResourceSelector(QWidget* parent)
connect(mEditButton, &QPushButton::clicked, this, &ResourceSelector::editResource); connect(mEditButton, &QPushButton::clicked, this, &ResourceSelector::editResource);
connect(mDeleteButton, &QPushButton::clicked, this, &ResourceSelector::removeResource); 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); connect(mAlarmType, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &ResourceSelector::alarmTypeSelected);
QTimer::singleShot(0, this, SLOT(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