diff -r 2c54b51f39c4 -r bb2d3e476f29 clock/clockmw/clocktimezone/inc/timezoneclient.h --- a/clock/clockmw/clocktimezone/inc/timezoneclient.h Mon Jul 26 13:54:38 2010 +0530 +++ b/clock/clockmw/clocktimezone/inc/timezoneclient.h Mon Aug 09 18:30:52 2010 +0530 @@ -27,7 +27,6 @@ #include #include -#include // User includes #include "clockdatatypes.h" @@ -38,72 +37,56 @@ #define TIMEZONECLIENT_EXPORT Q_DECL_IMPORT #endif -class CEnvironmentChangeNotifier; +//class CEnvironmentChangeNotifier; class QStandardItemModel; class CTzLocalizer; class XQSettingsManager; class XQSettingsKey; +class EnvironmentChangeNotifier; -const int KInitialEvent = ( - EChangesLocale | - EChangesMidnightCrossover | - EChangesThreadDeath | - EChangesPowerStatus | - EChangesSystemTime | - EChangesFreeMemory | - EChangesOutOfMemory); - -class TIMEZONECLIENT_EXPORT TimezoneClient : public QObject, public CBase +class TimezoneClient : public QObject { Q_OBJECT public: - /*TIMEZONECLIENT_EXPORT*/ static TimezoneClient* getInstance(); - /*TIMEZONECLIENT_EXPORT*/ void deleteInstance(); - /*TIMEZONECLIENT_EXPORT*/ bool isNull(); - -private: - TimezoneClient(); - ~TimezoneClient(); - -private: - -private: - static TimezoneClient *mTimezoneClient; - static bool mReferenceCount; - -// TODO: still refatoring -public: - /*TIMEZONECLIENT_EXPORT*/ QList &getLocations(); - /*TIMEZONECLIENT_EXPORT*/ LocationInfo getCurrentZoneInfoL(); - /*TIMEZONECLIENT_EXPORT*/ void setAsCurrentLocationL(LocationInfo &location); - /*TIMEZONECLIENT_EXPORT*/ bool isDSTOnL(int timezoneId); - /*TIMEZONECLIENT_EXPORT*/ int getStandardOffset(int timezoneId); - QList getSavedLocations(); - void saveLocations(const QList &locationList); - void getCountries(QMap& countries); - bool dstOn(int tzId); - void setDateTime(QDateTime dateTime); - void setTimeUpdateOn(bool timeUpdate = true); - bool timeUpdateOn(); - QStandardItemModel *locationSelectorModel(); - void createWorldClockModel(); - bool checkForDstChange(AlarmInfo& alarmInfo); - QList getAllTimeZoneIds(); - QList getAllTimeZoneOffsets(); - QList getCountriesForUTCOffset(int utcOffset); - LocationInfo addCity(int timeZoneId, QString &cityName, int cityGroupId); + TIMEZONECLIENT_EXPORT static TimezoneClient* getInstance(); + TIMEZONECLIENT_EXPORT void deleteInstance(); + TIMEZONECLIENT_EXPORT bool isNull(); public: - static int environmentCallback(TAny* obj); + TIMEZONECLIENT_EXPORT QList &getLocations(); + TIMEZONECLIENT_EXPORT LocationInfo getCurrentZoneInfoL(); + TIMEZONECLIENT_EXPORT void setAsCurrentLocationL(LocationInfo &location); + TIMEZONECLIENT_EXPORT bool isDSTOnL(int timezoneId); + TIMEZONECLIENT_EXPORT int getStandardOffset(int timezoneId); + TIMEZONECLIENT_EXPORT bool timeUpdateOn(); + TIMEZONECLIENT_EXPORT void setTimeUpdateOn(bool timeUpdate = true); + TIMEZONECLIENT_EXPORT void setDateTime(QDateTime dateTime); + TIMEZONECLIENT_EXPORT QList getAllTimeZoneOffsets(); + TIMEZONECLIENT_EXPORT QList getCountriesForUTCOffset( + int utcOffset); + TIMEZONECLIENT_EXPORT LocationInfo addCity( + int timeZoneId, QString &cityName, int cityGroupId); + TIMEZONECLIENT_EXPORT bool checkForDstChange(AlarmInfo& alarmInfo); + TIMEZONECLIENT_EXPORT QList getSavedLocations(); + TIMEZONECLIENT_EXPORT void saveLocations( + const QList &locationList); + + void notifyTimeChange(); signals: void timechanged(); void listUpdated(); void autoTimeUpdateChanged(int value); void cityUpdated(); + +private: + TimezoneClient(); + ~TimezoneClient(); private: + bool dstOn(int tzId); + QList getAllTimeZoneIds(); int getDstZoneOffset(int tzId); TMonth intToMonth(int month); bool getUtcDstOffsetL(int &dstOffset, const CTzId &tzId); @@ -120,20 +103,21 @@ void populateCities(); void eventMonitor(const XQSettingsKey& key, const QVariant& value); -public: - CEnvironmentChangeNotifier *mNotifier; - private: + static TimezoneClient *mTimezoneClient; + static bool mReferenceCount; + +private: + EnvironmentChangeNotifier *mNotifier; CTzLocalizer *mTzLocalizer; QMap mAllCountries; QList mAllLocations; - QStandardItemModel *mWorldClockModel; + QPointer mWorldClockModel; XQSettingsManager *mSettingsManager; XQSettingsKey *mAutoTimeUpdateKey; QList mTimeZoneIds; -// bool mTimeUpdateOn; int mCountryCount; int mAutoTimeUpdateValue; };