Commit 7eb7b5b8 authored by Bea Lam's avatar Bea Lam

[nemo-qml-plugin-systemsettings] Add DateTimeSettings::ready property. Contributes to JB#33755

This property indicates when the initial timed signal has been
received and the other property values have been initialized.
parent 9828130c
......@@ -79,6 +79,11 @@ void DateTimeSettings::onGetWallClockInfoFinished(QDBusPendingCallWatcher *watch
watcher->deleteLater();
}
bool DateTimeSettings::ready() const
{
return m_timedInfoValid;
}
void DateTimeSettings::setTime(int hour, int minute)
{
QDate currentDate = QDate::currentDate();
......@@ -195,6 +200,8 @@ bool DateTimeSettings::setTime(time_t time)
void DateTimeSettings::onTimedSignal(const Maemo::Timed::WallClock::Info &info, bool time_changed)
{
const bool prevReady = ready();
m_timedInfo = info;
m_timedInfoValid = true;
......@@ -219,4 +226,8 @@ void DateTimeSettings::onTimedSignal(const Maemo::Timed::WallClock::Info &info,
m_timezone = newTimezone;
emit timezoneChanged();
}
if (prevReady != ready()) {
emit readyChanged();
}
}
......@@ -45,6 +45,7 @@ class SYSTEMSETTINGS_EXPORT DateTimeSettings: public QObject
Q_OBJECT
Q_ENUMS(HourMode)
Q_PROPERTY(bool ready READ ready NOTIFY readyChanged)
Q_PROPERTY(bool automaticTimeUpdate READ automaticTimeUpdate WRITE setAutomaticTimeUpdate NOTIFY automaticTimeUpdateChanged)
Q_PROPERTY(bool automaticTimezoneUpdate READ automaticTimezoneUpdate WRITE setAutomaticTimezoneUpdate NOTIFY automaticTimezoneUpdateChanged)
Q_PROPERTY(QString timezone READ timezone WRITE setTimezone NOTIFY timezoneChanged)
......@@ -61,6 +62,8 @@ public:
Q_INVOKABLE void setTime(int hour, int minute);
Q_INVOKABLE void setDate(const QDate &date);
bool ready() const;
bool automaticTimeUpdate();
void setAutomaticTimeUpdate(bool enable);
......@@ -73,6 +76,7 @@ public:
Q_INVOKABLE void setHourMode(HourMode mode);
signals:
void readyChanged();
void timeChanged();
void automaticTimeUpdateChanged();
void automaticTimezoneUpdateChanged();
......
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