File tree 3 files changed +21
-0
lines changed
3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ Time::Time(QObject *parent)
32
32
OrgFreedesktopTimedate1Interface iface (QStringLiteral (" org.freedesktop.timedate1" ),
33
33
QStringLiteral (" /org/freedesktop/timedate1" ),
34
34
QDBusConnection::systemBus ());
35
+
36
+ m_canNTP = iface.canNTP ();
35
37
m_useNtp = iface.nTP ();
36
38
}
37
39
@@ -40,6 +42,11 @@ bool Time::useNtp() const
40
42
return m_useNtp;
41
43
}
42
44
45
+ bool Time::canNTP () const
46
+ {
47
+ return m_canNTP;
48
+ }
49
+
43
50
void Time::setUseNtp (bool enabled)
44
51
{
45
52
if (m_useNtp != enabled) {
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ class Time : public QObject
29
29
{
30
30
Q_OBJECT
31
31
Q_PROPERTY (bool useNtp READ useNtp WRITE setUseNtp NOTIFY useNtpChanged)
32
+ Q_PROPERTY (bool canNTP READ canNTP CONSTANT)
32
33
Q_PROPERTY (QTime currentTime READ currentTime WRITE setCurrentTime NOTIFY currentTimeChanged)
33
34
Q_PROPERTY (QDate currentDate READ currentDate WRITE setCurrentDate NOTIFY currentDateChanged)
34
35
Q_PROPERTY (bool twentyFour READ twentyFour WRITE setTwentyFour NOTIFY twentyFourChanged)
@@ -37,6 +38,7 @@ class Time : public QObject
37
38
explicit Time (QObject *parent = nullptr );
38
39
39
40
bool useNtp () const ;
41
+ bool canNTP () const ;
40
42
void setUseNtp (bool enabled);
41
43
42
44
Q_INVOKABLE void save ();
@@ -57,6 +59,7 @@ class Time : public QObject
57
59
void twentyFourChanged ();
58
60
59
61
private:
62
+ bool m_canNTP;
60
63
bool m_useNtp;
61
64
bool m_twentyFour;
62
65
QTime m_currentTime;
Original file line number Diff line number Diff line change @@ -64,11 +64,22 @@ ItemPage {
64
64
Layout .fillHeight : true
65
65
rightPadding: 0
66
66
rightInset: 0
67
+ checkable: time .canNTP
67
68
checked: time .useNtp
68
69
onCheckedChanged: time .useNtp = checked
69
70
}
70
71
}
71
72
73
+ Label {
74
+ text: qsTr (" Unable to use Auto Sync. Please ensure your NTP service is installed." )
75
+ color: FishUI .Theme .disabledTextColor
76
+ visible: ! time .canNTP
77
+ }
78
+ }
79
+
80
+ RoundedItem {
81
+ spacing: FishUI .Units .largeSpacing * 1.5
82
+
72
83
RowLayout {
73
84
Label {
74
85
text: qsTr (" 24-Hour Time" )
You can’t perform that action at this time.
0 commit comments