Changeset View
Changeset View
Standalone View
Standalone View
kcms/dateandtime/main.h
Show All 16 Lines | |||||
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | #ifndef main_included | 21 | #ifndef main_included | ||
22 | #define main_included | 22 | #define main_included | ||
23 | 23 | | |||
24 | #include <kcmodule.h> | 24 | #include <kcmodule.h> | ||
25 | #include <KQuickAddons/ConfigModule> | ||||
26 | #include <QTime> | ||||
27 | #include <QDate> | ||||
25 | 28 | | |||
26 | class Dtime; | 29 | class Dtime; | ||
27 | class QTabWidget; | 30 | class QTabWidget; | ||
28 | 31 | | |||
29 | 32 | class KClockModule : public KQuickAddons::ConfigModule | |||
30 | class KclockModule : public KCModule | | |||
31 | { | 33 | { | ||
32 | Q_OBJECT | 34 | Q_OBJECT | ||
35 | Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged) | ||||
36 | Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged) | ||||
37 | Q_PROPERTY(bool ntpEnabled READ ntpEnabled WRITE setNtpEnabled NOTIFY ntpEnabledChanged) | ||||
38 | Q_PROPERTY(bool hasTimedated READ hasTimedated WRITE setHasTimedated NOTIFY hasTimedated) | ||||
39 | Q_PROPERTY(QStringList ntpServers READ ntpServers WRITE setNtpServers NOTIFY ntpServersChanged) | ||||
40 | Q_PROPERTY(QString localTimeZone READ localTimeZone WRITE setLocalTimeZone NOTIFY localTimeZoneChanged) | ||||
41 | Q_PROPERTY(QString localTimeZoneAbreviation READ localTimeZoneAbreviation WRITE setLocalTimeZoneAbreviation NOTIFY localTimeZoneAbreviationChanged) | ||||
42 | Q_PROPERTY(QString selectedTimeZone READ selectedTimeZone WRITE setSelectedTimeZone NOTIFY selectedTimeZoneChanged) | ||||
43 | Q_PROPERTY(QString errorMessage READ errorMessage WRITE setErrorMessage NOTIFY errorMessageChanged) | ||||
33 | 44 | | |||
34 | public: | 45 | public: | ||
35 | explicit KclockModule(QWidget *parent, const QVariantList &); | 46 | explicit KClockModule(QObject *parent, const QVariantList &args); | ||
36 | | ||||
37 | void save() override; | 47 | void save() override; | ||
38 | void load() override; | 48 | void load() override; | ||
39 | 49 | | |||
50 | QTime time() const; | ||||
51 | QDate date() const; | ||||
52 | bool ntpEnabled() const; | ||||
53 | bool hasTimedated() const; | ||||
54 | QStringList ntpServers() const; | ||||
55 | QString localTimeZone() const; | ||||
56 | QString localTimeZoneAbreviation() const; | ||||
57 | QString selectedTimeZone() const; | ||||
58 | QString errorMessage() const; | ||||
59 | | ||||
60 | void setTime(const QTime& value); | ||||
61 | void setDate(const QDate& value); | ||||
62 | void setNtpEnabled(bool value); | ||||
63 | void setHasTimedated(bool value); | ||||
64 | void setNtpServers(const QStringList& value); | ||||
65 | void setLocalTimeZone(const QString& value); | ||||
66 | void setLocalTimeZoneAbreviation(const QString& value); | ||||
67 | void setSelectedTimeZone(const QString& value); | ||||
68 | void setErrorMessage(const QString& value); | ||||
69 | QDateTime userTime() const; | ||||
70 | | ||||
71 | Q_SIGNALS: | ||||
72 | void timeChanged(); | ||||
73 | void dateChanged(); | ||||
74 | void ntpEnabledChanged(); | ||||
75 | void hasTimedatedChanged(); | ||||
76 | void ntpServersChanged(); | ||||
77 | void localTimeZoneChanged(); | ||||
78 | void localTimeZoneAbreviationChanged(); | ||||
79 | void selectedTimeZoneChanged(); | ||||
80 | void errorMessageChanged(); | ||||
81 | | ||||
40 | private: | 82 | private: | ||
41 | bool kauthSave(); | 83 | bool kauthSave(); | ||
42 | bool timedatedSave(); | 84 | bool timedatedSave(); | ||
85 | void findNTPutility(); | ||||
43 | 86 | | |||
44 | QTabWidget *tab; | 87 | bool m_hasTimedated; | ||
45 | Dtime *dtime; | 88 | bool m_ntpEnabled; | ||
46 | 89 | | |||
47 | bool m_haveTimedated = false; | 90 | QStringList m_ntpServers; | ||
91 | QTime m_time; | ||||
92 | QDate m_date; | ||||
93 | QString m_ntpUtility; | ||||
94 | QString m_localTimeZone; | ||||
95 | QString m_localTimeZoneAbreviation; | ||||
96 | QString m_selectedTimeZone; | ||||
97 | QString m_errorMessage; | ||||
48 | }; | 98 | }; | ||
49 | 99 | | |||
50 | #endif // main_included | 100 | #endif // main_included |