2014-11-15 04:16:00 +02:00
|
|
|
/*
|
|
|
|
This file is part of the KDE libraries
|
|
|
|
Copyright (c) 2007,2009 David Jarvie <djarvie@kde.org>
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public License
|
|
|
|
along with this library; see the file COPYING.LIB. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KTIMEZONED_H
|
|
|
|
#define KTIMEZONED_H
|
|
|
|
|
|
|
|
#include "ktimezonedbase.h"
|
|
|
|
|
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
2019-05-05 02:36:36 +00:00
|
|
|
#include <QFile>
|
2020-12-27 22:18:18 -08:00
|
|
|
#include <QTimer>
|
2014-11-15 04:16:00 +02:00
|
|
|
|
|
|
|
#include <kdedmodule.h>
|
|
|
|
#include <kdirwatch.h>
|
|
|
|
#include <ksystemtimezone.h>
|
|
|
|
|
|
|
|
|
|
|
|
class KTimeZoned : public KTimeZonedBase
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
KTimeZoned(QObject* parent, const QList<QVariant>&);
|
|
|
|
~KTimeZoned();
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void zonetab_Changed(const QString& path);
|
2020-12-27 22:18:18 -08:00
|
|
|
void localChanged();
|
2014-11-15 04:16:00 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
/** reimp */
|
|
|
|
void init(bool restart);
|
2014-12-06 20:23:17 +00:00
|
|
|
bool findZoneTab(QFile& f);
|
|
|
|
void readZoneTab(QFile& f);
|
2014-11-15 04:16:00 +02:00
|
|
|
void findLocalZone();
|
2014-12-06 20:23:17 +00:00
|
|
|
bool checkTZ(const char *envZone);
|
|
|
|
bool checkLocaltimeLink();
|
|
|
|
bool checkLocaltimeFile();
|
|
|
|
bool checkTimezone();
|
2014-11-15 04:16:00 +02:00
|
|
|
void updateLocalZone();
|
2014-12-06 20:23:17 +00:00
|
|
|
bool matchZoneFile(const QString &path);
|
|
|
|
bool setLocalZone(const QString &zoneName);
|
2014-11-15 04:16:00 +02:00
|
|
|
|
|
|
|
QString mZoneinfoDir; // path to zoneinfo directory
|
|
|
|
QString mZoneTab; // path to zone.tab file
|
2014-12-06 20:23:17 +00:00
|
|
|
QByteArray mSavedTZ; // last value of TZ if it's used to set local zone
|
2014-11-15 04:16:00 +02:00
|
|
|
KSystemTimeZoneSource *mSource;
|
|
|
|
KTimeZones mZones; // time zones collection
|
2014-12-06 20:23:17 +00:00
|
|
|
QString mLocalIdFile; // file containing pointer to local time zone definition
|
2014-11-15 04:16:00 +02:00
|
|
|
QString mLocalZoneDataFile; // zoneinfo file containing local time zone definition
|
|
|
|
KDirWatch *mZonetabWatch; // watch for zone.tab file changes
|
2020-12-27 22:18:18 -08:00
|
|
|
QTimer *mPollWatch; // watch for time zone definition file changes
|
2014-11-15 04:16:00 +02:00
|
|
|
bool mHaveCountryCodes; // true if zone.tab contains any country codes
|
2020-12-27 22:18:18 -08:00
|
|
|
QDateTime mLocalStamp; // mLocalIdFile modification time
|
2014-11-15 04:16:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|