KDECore
ksystemtimezone.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00027 #ifndef _KSYSTEMTIMEZONE_H
00028 #define _KSYSTEMTIMEZONE_H
00029
00030 #include <kdecore_export.h>
00031 #include "ktimezone.h"
00032
00033 #include <QtCore/QObject>
00034 #include <QtCore/QDateTime>
00035 #include <QtCore/QList>
00036 #include <QtCore/QString>
00037 #include <QtCore/QByteArray>
00038
00039 class KSystemTimeZoneSource;
00040 class KSystemTimeZonePrivate;
00041 class KSystemTimeZonesPrivate;
00042 class KSystemTimeZoneSourcePrivate;
00043 class KSystemTimeZoneDataPrivate;
00044
00088 class KDECORE_EXPORT KSystemTimeZones : public QObject
00089 {
00090 Q_OBJECT
00091 public:
00092 ~KSystemTimeZones();
00093
00100 static KTimeZones *timeZones();
00101
00107 static const KTimeZones::ZoneMap zones();
00108
00120 static KTimeZone zone(const QString &name);
00121
00132 static KTimeZone readZone(const QString &name);
00133
00161 static KTimeZone local();
00162
00180 static KTimeZone realLocalZone();
00181
00200 static void setLocalZone(const KTimeZone& tz);
00201
00221 static bool isSimulated();
00222
00228 static QString zoneinfoDir();
00229
00230 private Q_SLOTS:
00231
00232 void configChanged();
00233 void zonetabChanged(const QString &zonetab);
00234 void zoneDefinitionChanged(const QString &zone);
00235
00236 private:
00237 KSystemTimeZones();
00238
00239 KSystemTimeZonesPrivate * const d;
00240 friend class KSystemTimeZonesPrivate;
00241 };
00242
00265 class KDECORE_EXPORT KSystemTimeZone : public KTimeZone
00266 {
00267 public:
00268
00279 KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name,
00280 const QString &countryCode = QString(), float latitude = UNKNOWN, float longitude = UNKNOWN,
00281 const QString &comment = QString());
00282
00283 ~KSystemTimeZone();
00284
00285 private:
00286
00287
00288 };
00289
00290
00304 class KDECORE_EXPORT KSystemTimeZoneBackend : public KTimeZoneBackend
00305 {
00306 public:
00308 KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name,
00309 const QString &countryCode, float latitude, float longitude, const QString &comment);
00310
00311 ~KSystemTimeZoneBackend();
00312
00318 virtual KTimeZoneBackend *clone() const;
00319
00325 virtual QByteArray type() const;
00326
00347 virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const;
00348
00365 virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
00366
00380 virtual int offset(const KTimeZone *caller, time_t t) const;
00381
00395 virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
00396
00407 virtual bool isDst(const KTimeZone *caller, time_t t) const;
00408
00409 private:
00410 KSystemTimeZonePrivate *d;
00411 };
00412
00413
00424 class KDECORE_EXPORT KSystemTimeZoneSource : public KTimeZoneSource
00425 {
00426 public:
00430 KSystemTimeZoneSource();
00431 virtual ~KSystemTimeZoneSource();
00432
00442 virtual KTimeZoneData *parse(const KTimeZone &zone) const;
00443
00454 static void startParseBlock();
00455
00459 static void endParseBlock();
00460
00461 private:
00462 KSystemTimeZoneSourcePrivate * const d;
00463 };
00464
00465
00475 class KSystemTimeZoneData : public KTimeZoneData
00476 {
00477 friend class KSystemTimeZoneSource;
00478
00479 public:
00480 KSystemTimeZoneData();
00482 KSystemTimeZoneData(const KSystemTimeZoneData &);
00483 virtual ~KSystemTimeZoneData();
00484
00486 KSystemTimeZoneData &operator=(const KSystemTimeZoneData &);
00487
00496 virtual KTimeZoneData *clone() const;
00497
00503 virtual QList<QByteArray> abbreviations() const;
00504 virtual QByteArray abbreviation(const QDateTime &utcDateTime) const;
00505
00513 virtual QList<int> utcOffsets() const;
00514
00515 private:
00516 KSystemTimeZoneDataPrivate * const d;
00517 };
00518
00519 #endif