• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDECore

  • kdecore
  • date
ksystemtimezone.h
Go to the documentation of this file.
1/*
2 This file is part of the KDE libraries
3 Copyright (c) 2005-2007,2009-2012 David Jarvie <djarvie@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
26
27#ifndef _KSYSTEMTIMEZONE_H
28#define _KSYSTEMTIMEZONE_H
29
30#include <kdecore_export.h>
31#include "ktimezone.h"
32
33#include <QtCore/QObject>
34#include <QtCore/QDateTime>
35#include <QtCore/QList>
36#include <QtCore/QString>
37#include <QtCore/QByteArray>
38
39class KSystemTimeZoneSource;
40class KSystemTimeZonePrivate;
41class KSystemTimeZonesPrivate;
42class KSystemTimeZoneSourcePrivate;
43class KSystemTimeZoneDataPrivate;
44
94class KDECORE_EXPORT KSystemTimeZones : public QObject
95{
96 Q_OBJECT
97public:
98 ~KSystemTimeZones();
99
106 static KTimeZones *timeZones();
107
113 static const KTimeZones::ZoneMap zones();
114
126 static KTimeZone zone(const QString &name);
127
138 static KTimeZone readZone(const QString &name);
139
167 static KTimeZone local();
168
187 static KTimeZone realLocalZone();
188
208 static void setLocalZone(const KTimeZone& tz);
209
230 static bool isSimulated();
231
237 static QString zoneinfoDir();
238
245 static bool isTimeZoneDaemonAvailable();
246
247private Q_SLOTS:
248 // Connected to D-Bus signals
249 void configChanged();
250 void zonetabChanged(const QString &zonetab);
251 void zoneDefinitionChanged(const QString &zone);
252
253private:
254 KSystemTimeZones();
255
256 KSystemTimeZonesPrivate * const d;
257 friend class KSystemTimeZonesPrivate;
258};
259
282class KDECORE_EXPORT KSystemTimeZone : public KTimeZone //krazy:exclude=dpointer (no d-pointer for KTimeZone derived classes)
283{
284public:
285
296 KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name,
297 const QString &countryCode = QString(), float latitude = UNKNOWN, float longitude = UNKNOWN,
298 const QString &comment = QString());
299
300 ~KSystemTimeZone();
301
302private:
303 // d-pointer is in KSystemTimeZoneBackend.
304 // This is a requirement for classes inherited from KTimeZone.
305};
306
307
321class KDECORE_EXPORT KSystemTimeZoneBackend : public KTimeZoneBackend //krazy:exclude=dpointer (non-const d-pointer for KTimeZoneBackend-derived classes)
322{
323public:
325 KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name,
326 const QString &countryCode, float latitude, float longitude, const QString &comment);
327
328 ~KSystemTimeZoneBackend();
329
335 virtual KTimeZoneBackend *clone() const;
336
342 virtual QByteArray type() const;
343
364 virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const;
365
382 virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
383
397 virtual int offset(const KTimeZone *caller, time_t t) const;
398
412 virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const;
413
424 virtual bool isDst(const KTimeZone *caller, time_t t) const;
425
426private:
427 KSystemTimeZonePrivate *d; // non-const
428};
429
430
441class KDECORE_EXPORT KSystemTimeZoneSource : public KTimeZoneSource
442{
443public:
447 KSystemTimeZoneSource();
448 virtual ~KSystemTimeZoneSource();
449
459 virtual KTimeZoneData *parse(const KTimeZone &zone) const;
460
471 static void startParseBlock();
472
476 static void endParseBlock();
477
478private:
479 KSystemTimeZoneSourcePrivate * const d;
480};
481
482
492class KSystemTimeZoneData : public KTimeZoneData
493{
494 friend class KSystemTimeZoneSource;
495
496public:
497 KSystemTimeZoneData();
499 KSystemTimeZoneData(const KSystemTimeZoneData &);
500 virtual ~KSystemTimeZoneData();
501
503 KSystemTimeZoneData &operator=(const KSystemTimeZoneData &);
504
513 virtual KTimeZoneData *clone() const;
514
520 virtual QList<QByteArray> abbreviations() const;
521 virtual QByteArray abbreviation(const QDateTime &utcDateTime) const;
522
530 virtual QList<int> utcOffsets() const;
531
532private:
533 KSystemTimeZoneDataPrivate * const d;
534};
535
536#endif
KSystemTimeZoneBackend::isDstAtUtc
virtual bool isDstAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const
Implements KSystemTimeZone::isDstAtUtc().
Definition ksystemtimezone.cpp:668
KSystemTimeZoneBackend::clone
virtual KTimeZoneBackend * clone() const
Creates a copy of this instance.
Definition ksystemtimezone.cpp:554
KSystemTimeZoneBackend::offsetAtUtc
virtual int offsetAtUtc(const KTimeZone *caller, const QDateTime &utcDateTime) const
Implements KSystemTimeZone::offsetAtUtc().
Definition ksystemtimezone.cpp:633
KSystemTimeZoneBackend::offsetAtZoneTime
virtual int offsetAtZoneTime(const KTimeZone *caller, const QDateTime &zoneDateTime, int *secondOffset) const
Implements KSystemTimeZone::offsetAtZoneTime().
Definition ksystemtimezone.cpp:564
KSystemTimeZoneBackend::isDst
virtual bool isDst(const KTimeZone *caller, time_t t) const
Implements KSystemTimeZone::isDst().
Definition ksystemtimezone.cpp:673
KSystemTimeZoneBackend::offset
virtual int offset(const KTimeZone *caller, time_t t) const
Implements KSystemTimeZone::offset().
Definition ksystemtimezone.cpp:638
KSystemTimeZoneBackend::type
virtual QByteArray type() const
Returns the class name of the data represented by this instance.
Definition ksystemtimezone.cpp:559
KSystemTimeZoneBackend::KSystemTimeZoneBackend
KSystemTimeZoneBackend(KSystemTimeZoneSource *source, const QString &name, const QString &countryCode, float latitude, float longitude, const QString &comment)
Implements KSystemTimeZone::KSystemTimeZone().
Definition ksystemtimezone.cpp:546
KSystemTimeZoneData::operator=
KSystemTimeZoneData & operator=(const KSystemTimeZoneData &)
Assignment; no special ownership assumed.
Definition ksystemtimezone.cpp:835
KSystemTimeZoneData::clone
virtual KTimeZoneData * clone() const
Creates a new copy of this object.
Definition ksystemtimezone.cpp:842
KSystemTimeZoneData::abbreviations
virtual QList< QByteArray > abbreviations() const
Returns the complete list of time zone abbreviations.
Definition ksystemtimezone.cpp:847
KSystemTimeZoneData::KSystemTimeZoneData
KSystemTimeZoneData()
Definition ksystemtimezone.cpp:819
KSystemTimeZoneData::utcOffsets
virtual QList< int > utcOffsets() const
Returns the complete list of UTC offsets for the time zone.
Definition ksystemtimezone.cpp:888
KSystemTimeZoneData::~KSystemTimeZoneData
virtual ~KSystemTimeZoneData()
Definition ksystemtimezone.cpp:830
KSystemTimeZoneData::abbreviation
virtual QByteArray abbreviation(const QDateTime &utcDateTime) const
Returns the time zone abbreviation current at a specified time.
Definition ksystemtimezone.cpp:852
KSystemTimeZoneData::KSystemTimeZoneSource
friend class KSystemTimeZoneSource
Definition ksystemtimezone.h:494
KSystemTimeZoneSource
A class to read and parse system time zone data.
Definition ksystemtimezone.h:442
KSystemTimeZoneSource::startParseBlock
static void startParseBlock()
Use in conjunction with endParseBlock() to improve efficiency when calling parse() for a group of KSy...
Definition ksystemtimezone.cpp:762
KSystemTimeZoneSource::KSystemTimeZoneSource
KSystemTimeZoneSource()
Constructs a system time zone source.
Definition ksystemtimezone.cpp:733
KSystemTimeZoneSource::endParseBlock
static void endParseBlock()
Definition ksystemtimezone.cpp:768
KSystemTimeZone::KSystemTimeZone
KSystemTimeZone(KSystemTimeZoneSource *source, const QString &name, const QString &countryCode=QString(), float latitude=UNKNOWN, float longitude=UNKNOWN, const QString &comment=QString())
Creates a time zone.
Definition ksystemtimezone.cpp:694
KSystemTimeZones::readZone
static KTimeZone readZone(const QString &name)
Returns the time zone with the given name, containing the full time zone definition read directly fro...
Definition ksystemtimezone.cpp:245
KSystemTimeZones::local
static KTimeZone local()
Returns the current local system time zone.
Definition ksystemtimezone.cpp:195
KSystemTimeZones::setLocalZone
static void setLocalZone(const KTimeZone &tz)
Set or clear the simulated local system time zone.
Definition ksystemtimezone.cpp:211
KSystemTimeZones::KSystemTimeZonesPrivate
friend class KSystemTimeZonesPrivate
Definition ksystemtimezone.h:257
KSystemTimeZones::zoneinfoDir
static QString zoneinfoDir()
Returns the location of the system time zone zoneinfo database.
Definition ksystemtimezone.cpp:228
KSystemTimeZones::isSimulated
static bool isSimulated()
Check whether there is a simulated local system time zone.
Definition ksystemtimezone.cpp:219
KSystemTimeZones::realLocalZone
static KTimeZone realLocalZone()
Return the real (not simulated) local system time zone.
Definition ksystemtimezone.cpp:205
KSystemTimeZones::zones
static const KTimeZones::ZoneMap zones()
Returns all the time zones defined in this collection.
Definition ksystemtimezone.cpp:250
KSystemTimeZones::zone
static KTimeZone zone(const QString &name)
Returns the time zone with the given name.
Definition ksystemtimezone.cpp:255
KSystemTimeZones::isTimeZoneDaemonAvailable
static bool isTimeZoneDaemonAvailable()
Return whether the KDE time zone daemon, ktimezoned, appears to be available and working.
Definition ksystemtimezone.cpp:234
KSystemTimeZones::timeZones
static KTimeZones * timeZones()
Returns the unique KTimeZones instance containing the system time zones collection.
Definition ksystemtimezone.cpp:240
KTimeZoneBackend::KTimeZone
friend class KTimeZone
Definition ktimezone.h:1208
KTimeZoneBackend::KTimeZoneBackend
KTimeZoneBackend()
Implements KTimeZone::KTimeZone().
Definition ktimezone.cpp:417
KTimeZoneData
Base class for the parsed data returned by a KTimeZoneSource class.
Definition ktimezone.h:1303
KTimeZoneData::KTimeZoneData
KTimeZoneData()
Definition ktimezone.cpp:1144
KTimeZoneSource::KTimeZoneSource
KTimeZoneSource()
Definition ktimezone.cpp:959
KTimeZone
Base class representing a time zone.
Definition ktimezone.h:417
KTimeZone::source
KTimeZoneSource * source() const
Returns the source reader/parser for the time zone's source database.
Definition ktimezone.cpp:749
KTimeZone::name
QString name() const
Returns the name of the time zone.
Definition ktimezone.cpp:669
KTimeZone::countryCode
QString countryCode() const
Returns the two-letter country code of the time zone.
Definition ktimezone.cpp:649
KTimeZone::longitude
float longitude() const
Returns the latitude of the time zone.
Definition ktimezone.cpp:659
KTimeZone::KTimeZone
KTimeZone()
Constructs a null time zone.
Definition ktimezone.cpp:600
KTimeZone::comment
QString comment() const
Returns any comment for the time zone.
Definition ktimezone.cpp:664
KTimeZone::latitude
float latitude() const
Returns the latitude of the time zone.
Definition ktimezone.cpp:654
KTimeZone::UNKNOWN
static const float UNKNOWN
A representation for unknown locations; this is a float that does not represent a real latitude or lo...
Definition ktimezone.h:1083
KTimeZones
The KTimeZones class represents a time zone database which consists of a collection of individual tim...
Definition ktimezone.h:309
KTimeZones::ZoneMap
QMap< QString, KTimeZone > ZoneMap
Map of KTimeZone instances, indexed by time zone name.
Definition ktimezone.h:323
QDateTime
QList
Definition kaboutdata.h:33
QObject
QString
kdecore_export.h
ktimezone.h
Time zone functions.
parse
QList< Action > parse(QSettings &ini)
Definition policy-gen.cpp:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 2025 00:00:00 by doxygen 1.14.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

Skip menu "KDECore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal