diff -r 96907930389d -r 12af337248b1 clock/clockmw/clocktimezone/inc/timezoneclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clock/clockmw/clocktimezone/inc/timezoneclient.h Tue Aug 31 15:13:43 2010 +0300 @@ -0,0 +1,127 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// timezoneclient.h +#ifndef __TIMEZONECLIENT_H__ +#define __TIMEZONECLIENT_H__ + +// System includes +#include +#include +#include +#include +#include + +#include + +// User includes +#include "clockdatatypes.h" + +#ifdef TIMEZONECLIENT_LIBRARY +#define TIMEZONECLIENT_EXPORT Q_DECL_EXPORT +#else +#define TIMEZONECLIENT_EXPORT Q_DECL_IMPORT +#endif + +//class CEnvironmentChangeNotifier; +class QStandardItemModel; +class CTzLocalizer; +class XQSettingsManager; +class XQSettingsKey; +class EnvironmentChangeNotifier; + +class TimezoneClient : public QObject +{ + Q_OBJECT + +public: + TIMEZONECLIENT_EXPORT static TimezoneClient* getInstance(); + TIMEZONECLIENT_EXPORT void deleteInstance(); + TIMEZONECLIENT_EXPORT bool isNull(); + +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); + 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); + void getDstRulesL( + QDateTime &startTime, QDateTime &endTime,int timezoneId); + void getCitiesForCountry( + int id, QMap& cities); + void getLocationInfo( + int groupId, int cityIndex, LocationInfo& cityInfo); + int getCityGroupIdByName(const QString& name); + int getCityOffsetByNameAndId(const QString& name, int tzId); + +private slots: + void populateCities(); + void eventMonitor(const XQSettingsKey& key, const QVariant& value); + +private: + static TimezoneClient *mTimezoneClient; + static bool mReferenceCount; + +private: + EnvironmentChangeNotifier *mNotifier; + CTzLocalizer *mTzLocalizer; + QMap mAllCountries; + QList mAllLocations; + QPointer mWorldClockModel; + XQSettingsManager *mSettingsManager; + XQSettingsKey *mAutoTimeUpdateKey; + + QList mTimeZoneIds; + + int mCountryCount; + int mAutoTimeUpdateValue; +}; + +#endif // __TIMEZONECLIENT_H__ + +// End of file