54 class TIMEZONECLIENT_EXPORT TimezoneClient : public QObject, public CBase |
56 class TIMEZONECLIENT_EXPORT TimezoneClient : public QObject, public CBase |
55 { |
57 { |
56 Q_OBJECT |
58 Q_OBJECT |
57 |
59 |
58 public: |
60 public: |
59 TimezoneClient(QObject* parent = 0); |
61 /*TIMEZONECLIENT_EXPORT*/ static TimezoneClient* getInstance(); |
|
62 /*TIMEZONECLIENT_EXPORT*/ void deleteInstance(); |
|
63 /*TIMEZONECLIENT_EXPORT*/ bool isNull(); |
|
64 |
|
65 private: |
|
66 TimezoneClient(); |
60 ~TimezoneClient(); |
67 ~TimezoneClient(); |
61 |
68 |
|
69 private: |
|
70 |
|
71 private: |
|
72 static TimezoneClient *mTimezoneClient; |
|
73 static bool mReferenceCount; |
|
74 |
|
75 // TODO: still refatoring |
62 public: |
76 public: |
63 QList<LocationInfo> getLocations(); |
77 /*TIMEZONECLIENT_EXPORT*/ QList<LocationInfo> &getLocations(); |
64 bool getUtcDstOffsetL(int &dstOffset, |
78 /*TIMEZONECLIENT_EXPORT*/ LocationInfo getCurrentZoneInfoL(); |
65 const CTzId &tzId); |
79 /*TIMEZONECLIENT_EXPORT*/ void setAsCurrentLocationL(LocationInfo &location); |
66 LocationInfo getCurrentZoneInfoL(); |
80 /*TIMEZONECLIENT_EXPORT*/ bool isDSTOnL(int timezoneId); |
67 void setAsCurrentLocationL(LocationInfo &location); |
81 /*TIMEZONECLIENT_EXPORT*/ int getStandardOffset(int timezoneId); |
68 bool isDSTOnL(int timezoneId); |
|
69 int getStandardOffset(int timezoneId); |
|
70 void getDstRulesL( |
|
71 QDateTime &startTime, QDateTime &endTime,int timezoneId); |
|
72 QList<LocationInfo> getSavedLocations(); |
82 QList<LocationInfo> getSavedLocations(); |
73 void saveLocations(const QList<LocationInfo> &locationList); |
83 void saveLocations(const QList<LocationInfo> &locationList); |
74 void getCountries(QMap<QString, int>& countries); |
84 void getCountries(QMap<QString, int>& countries); |
75 void getCitiesForCountry( |
|
76 int id, QMap<QString, int>& cities); |
|
77 void getLocationInfo( |
|
78 int groupId, int cityIndex, LocationInfo& cityInfo); |
|
79 bool dstOn(int tzId); |
85 bool dstOn(int tzId); |
80 int getCityGroupIdByName(const QString& name); |
|
81 int getCityOffsetByNameAndId(const QString& name, int tzId); |
|
82 void setDateTime(QDateTime dateTime); |
86 void setDateTime(QDateTime dateTime); |
83 void setTimeUpdateOn(bool timeUpdate = true); |
87 void setTimeUpdateOn(bool timeUpdate = true); |
84 bool timeUpdateOn(); |
88 bool timeUpdateOn(); |
85 QStandardItemModel *locationSelectorModel(); |
89 QStandardItemModel *locationSelectorModel(); |
86 void createWorldClockModel(); |
90 void createWorldClockModel(); |
94 static int environmentCallback(TAny* obj); |
98 static int environmentCallback(TAny* obj); |
95 |
99 |
96 signals: |
100 signals: |
97 void timechanged(); |
101 void timechanged(); |
98 void listUpdated(); |
102 void listUpdated(); |
99 |
103 void autoTimeUpdateChanged(int value); |
|
104 void cityUpdated(); |
|
105 |
100 private: |
106 private: |
101 int getDstZoneOffset(int tzId); |
107 int getDstZoneOffset(int tzId); |
102 TMonth intToMonth(int month); |
108 TMonth intToMonth(int month); |
|
109 bool getUtcDstOffsetL(int &dstOffset, const CTzId &tzId); |
|
110 void getDstRulesL( |
|
111 QDateTime &startTime, QDateTime &endTime,int timezoneId); |
|
112 void getCitiesForCountry( |
|
113 int id, QMap<QString, int>& cities); |
|
114 void getLocationInfo( |
|
115 int groupId, int cityIndex, LocationInfo& cityInfo); |
|
116 int getCityGroupIdByName(const QString& name); |
|
117 int getCityOffsetByNameAndId(const QString& name, int tzId); |
103 |
118 |
104 private slots: |
119 private slots: |
105 void populateCities(); |
120 void populateCities(); |
|
121 void eventMonitor(const XQSettingsKey& key, const QVariant& value); |
106 |
122 |
107 public: |
123 public: |
108 CEnvironmentChangeNotifier *mNotifier; |
124 CEnvironmentChangeNotifier *mNotifier; |
109 |
125 |
110 private: |
126 private: |
111 CTzLocalizer *mTzLocalizer; |
127 CTzLocalizer *mTzLocalizer; |
112 QMap<QString, int> mAllCountries; |
128 QMap<QString, int> mAllCountries; |
113 QList<LocationInfo> mAllLocations; |
129 QList<LocationInfo> mAllLocations; |
114 QStandardItemModel *mWorldClockModel; |
130 QStandardItemModel *mWorldClockModel; |
|
131 XQSettingsManager *mSettingsManager; |
|
132 XQSettingsKey *mAutoTimeUpdateKey; |
115 |
133 |
116 QList<int> mTimeZoneIds; |
134 QList<int> mTimeZoneIds; |
117 |
135 |
118 bool mTimeUpdateOn; |
136 // bool mTimeUpdateOn; |
119 int mFetchCount; |
|
120 int mCountryCount; |
137 int mCountryCount; |
|
138 int mAutoTimeUpdateValue; |
121 }; |
139 }; |
122 |
140 |
123 #endif // __TIMEZONECLIENT_H__ |
141 #endif // __TIMEZONECLIENT_H__ |
124 |
142 |
125 // End of file |
143 // End of file |