~attente/ubuntu-system-settings/1342326

« back to all changes in this revision

Viewing changes to plugins/time-date/timedate.cpp

  • Committer: CI bot
  • Author(s): Iain Lane
  • Date: 2014-07-11 08:55:31 UTC
  • mfrom: (774.1.3 timedated-activation)
  • Revision ID: ps-jenkins@lists.canonical.com-20140711085531-2ix6n0o0takjf3mz
[time-date] Ask for properties over D-Bus even when the object is not considered valued (due to the service timing out), to cause it to be activated. 
Approved by: Sebastien Bacher, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
             this,
45
45
             SLOT (slotNameOwnerChanged (QString, QString, QString)));
46
46
 
47
 
    if (m_timeDateInterface.isValid()) {
48
 
        setUpInterface();
49
 
    }
50
 
 
 
47
    setUpInterface();
51
48
}
52
49
 
53
50
void TimeDate::setUpInterface()
59
56
        "PropertiesChanged",
60
57
        this,
61
58
        SLOT(slotChanged(QString, QVariantMap, QStringList)));
62
 
    }
 
59
}
63
60
 
64
61
QString TimeDate::timeZone()
65
62
{
71
68
 
72
69
QString TimeDate::getTimeZone()
73
70
{
 
71
    QVariant tz(m_timeDateInterface.property("Timezone"));
74
72
 
75
 
    if (m_timeDateInterface.isValid()) {
76
 
        return m_timeDateInterface.property("Timezone").toString();
77
 
    }
 
73
    if (tz.isValid())
 
74
        return tz.toString();
78
75
 
79
76
    return QString();
80
77
}
81
78
 
82
79
bool TimeDate::getUseNTP()
83
80
{
84
 
    if (m_timeDateInterface.isValid()) {
85
 
        return m_timeDateInterface.property("NTP").toBool();
86
 
    }
 
81
    QVariant useNTP(m_timeDateInterface.property("NTP"));
 
82
 
 
83
    if (useNTP.isValid())
 
84
        return useNTP.toBool();
87
85
 
88
86
    // Default to false
89
87
    return false;
91
89
 
92
90
void TimeDate::setUseNTP(bool enabled)
93
91
{
94
 
    if (m_timeDateInterface.isValid()) {
95
 
        m_timeDateInterface.call("SetNTP", enabled, false);
96
 
    }
 
92
    m_timeDateInterface.call("SetNTP", enabled, false);
97
93
}
98
94
 
99
95
void TimeDate::slotChanged(QString interface,
122
118
{
123
119
    Q_UNUSED (oldOwner);
124
120
    Q_UNUSED (newOwner);
 
121
 
125
122
    if (name != "org.freedesktop.timedate1")
126
123
        return;
127
124
 
128
 
    setUpInterface();
129
 
    // Tell QML so that it refreshes its view of the property
130
 
    Q_EMIT timeZoneChanged();
131
 
    Q_EMIT useNTPChanged();
 
125
    if (m_timeDateInterface.isValid())
 
126
        setUpInterface();
132
127
}
133
128
 
134
129
void TimeDate::setTimeZone(QString &time_zone)