KDECore
ksystemtimezone.h
Go to the documentation of this file.
00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (c) 2005-2007,2009-2010 David Jarvie <djarvie@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 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 00094 class KDECORE_EXPORT KSystemTimeZones : public QObject 00095 { 00096 Q_OBJECT 00097 public: 00098 ~KSystemTimeZones(); 00099 00106 static KTimeZones *timeZones(); 00107 00113 static const KTimeZones::ZoneMap zones(); 00114 00126 static KTimeZone zone(const QString &name); 00127 00138 static KTimeZone readZone(const QString &name); 00139 00167 static KTimeZone local(); 00168 00187 static KTimeZone realLocalZone(); 00188 00208 static void setLocalZone(const KTimeZone& tz); 00209 00230 static bool isSimulated(); 00231 00237 static QString zoneinfoDir(); 00238 00244 static bool isTimeZoneDaemonAvailable(); 00245 00246 private Q_SLOTS: 00247 // Connected to D-Bus signals 00248 void configChanged(); 00249 void zonetabChanged(const QString &zonetab); 00250 void zoneDefinitionChanged(const QString &zone); 00251 00252 private: 00253 KSystemTimeZones(); 00254 00255 KSystemTimeZonesPrivate * const d; 00256 friend class KSystemTimeZonesPrivate; 00257 }; 00258 00281 class KDECORE_EXPORT KSystemTimeZone : public KTimeZone //krazy:exclude=dpointer (no d-pointer for KTimeZone derived classes) 00282 { 00283 public: 00284 00295 KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name, 00296 const QString &countryCode = QString(), float latitude = UNKNOWN, float longitude = UNKNOWN, 00297 const QString &comment = QString()); 00298 00299 ~KSystemTimeZone(); 00300 00301 private: 00302 // d-pointer is in KSystemTimeZoneBackend. 00303 // This is a requirement for classes inherited from KTimeZone. 00304 }; 00305 00306 00320 class KDECORE_EXPORT KSystemTimeZoneBackend : public KTimeZoneBackend //krazy:exclude=dpointer (non-const d-pointer for KTimeZoneBackend-derived classes) 00321 { 00322 public: 00324 KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name, 00325 const QString &countryCode, float latitude, float longitude, const QString &comment); 00326 00327 ~KSystemTimeZoneBackend(); 00328 00334 virtual KTimeZoneBackend *clone() const; 00335 00341 virtual QByteArray type() const; 00342 00363 virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const; 00364 00381 virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const; 00382 00396 virtual int offset(const KTimeZone *caller, time_t t) const; 00397 00411 virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const; 00412 00423 virtual bool isDst(const KTimeZone *caller, time_t t) const; 00424 00425 private: 00426 KSystemTimeZonePrivate *d; // non-const 00427 }; 00428 00429 00440 class KDECORE_EXPORT KSystemTimeZoneSource : public KTimeZoneSource 00441 { 00442 public: 00446 KSystemTimeZoneSource(); 00447 virtual ~KSystemTimeZoneSource(); 00448 00458 virtual KTimeZoneData *parse(const KTimeZone &zone) const; 00459 00470 static void startParseBlock(); 00471 00475 static void endParseBlock(); 00476 00477 private: 00478 KSystemTimeZoneSourcePrivate * const d; 00479 }; 00480 00481 00491 class KSystemTimeZoneData : public KTimeZoneData 00492 { 00493 friend class KSystemTimeZoneSource; 00494 00495 public: 00496 KSystemTimeZoneData(); 00498 KSystemTimeZoneData(const KSystemTimeZoneData &); 00499 virtual ~KSystemTimeZoneData(); 00500 00502 KSystemTimeZoneData &operator=(const KSystemTimeZoneData &); 00503 00512 virtual KTimeZoneData *clone() const; 00513 00519 virtual QList<QByteArray> abbreviations() const; 00520 virtual QByteArray abbreviation(const QDateTime &utcDateTime) const; 00521 00529 virtual QList<int> utcOffsets() const; 00530 00531 private: 00532 KSystemTimeZoneDataPrivate * const d; 00533 }; 00534 00535 #endif
KDE 4.6 API Reference