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 00245 static bool isTimeZoneDaemonAvailable(); 00246 00247 private Q_SLOTS: 00248 // Connected to D-Bus signals 00249 void configChanged(); 00250 void zonetabChanged(const QString &zonetab); 00251 void zoneDefinitionChanged(const QString &zone); 00252 00253 private: 00254 KSystemTimeZones(); 00255 00256 KSystemTimeZonesPrivate * const d; 00257 friend class KSystemTimeZonesPrivate; 00258 }; 00259 00282 class KDECORE_EXPORT KSystemTimeZone : public KTimeZone //krazy:exclude=dpointer (no d-pointer for KTimeZone derived classes) 00283 { 00284 public: 00285 00296 KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name, 00297 const QString &countryCode = QString(), float latitude = UNKNOWN, float longitude = UNKNOWN, 00298 const QString &comment = QString()); 00299 00300 ~KSystemTimeZone(); 00301 00302 private: 00303 // d-pointer is in KSystemTimeZoneBackend. 00304 // This is a requirement for classes inherited from KTimeZone. 00305 }; 00306 00307 00321 class KDECORE_EXPORT KSystemTimeZoneBackend : public KTimeZoneBackend //krazy:exclude=dpointer (non-const d-pointer for KTimeZoneBackend-derived classes) 00322 { 00323 public: 00325 KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name, 00326 const QString &countryCode, float latitude, float longitude, const QString &comment); 00327 00328 ~KSystemTimeZoneBackend(); 00329 00335 virtual KTimeZoneBackend *clone() const; 00336 00342 virtual QByteArray type() const; 00343 00364 virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const; 00365 00382 virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const; 00383 00397 virtual int offset(const KTimeZone *caller, time_t t) const; 00398 00412 virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const; 00413 00424 virtual bool isDst(const KTimeZone *caller, time_t t) const; 00425 00426 private: 00427 KSystemTimeZonePrivate *d; // non-const 00428 }; 00429 00430 00441 class KDECORE_EXPORT KSystemTimeZoneSource : public KTimeZoneSource 00442 { 00443 public: 00447 KSystemTimeZoneSource(); 00448 virtual ~KSystemTimeZoneSource(); 00449 00459 virtual KTimeZoneData *parse(const KTimeZone &zone) const; 00460 00471 static void startParseBlock(); 00472 00476 static void endParseBlock(); 00477 00478 private: 00479 KSystemTimeZoneSourcePrivate * const d; 00480 }; 00481 00482 00492 class KSystemTimeZoneData : public KTimeZoneData 00493 { 00494 friend class KSystemTimeZoneSource; 00495 00496 public: 00497 KSystemTimeZoneData(); 00499 KSystemTimeZoneData(const KSystemTimeZoneData &); 00500 virtual ~KSystemTimeZoneData(); 00501 00503 KSystemTimeZoneData &operator=(const KSystemTimeZoneData &); 00504 00513 virtual KTimeZoneData *clone() const; 00514 00520 virtual QList<QByteArray> abbreviations() const; 00521 virtual QByteArray abbreviation(const QDateTime &utcDateTime) const; 00522 00530 virtual QList<int> utcOffsets() const; 00531 00532 private: 00533 KSystemTimeZoneDataPrivate * const d; 00534 }; 00535 00536 #endif
KDE 4.7 API Reference