[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdecore/date
From: David Jarvie <djarvie () kde ! org>
Date: 2010-09-26 13:52:16
Message-ID: 20100926135216.5A9C0AC857 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1179912 by djarvie:
Add ktimezonedOk() method to allow applications to diagnose problems
M +16 -3 ksystemtimezone.cpp
M +15 -3 ksystemtimezone.h
--- trunk/KDE/kdelibs/kdecore/date/ksystemtimezone.cpp #1179911:1179912
@@ -1,6 +1,6 @@
/*
This file is part of the KDE libraries
- Copyright (c) 2005-2009 David Jarvie <djarvie@kde.org>
+ Copyright (c) 2005-2010 David Jarvie <djarvie@kde.org>
Copyright (c) 2005 S.R.Haque <srhaque@iee.org>.
This library is free software; you can redistribute it and/or
@@ -134,6 +134,7 @@
static QString m_zoneinfoDir;
static QString m_zonetab;
static KSystemTimeZoneSource *m_source;
+ static bool m_ktimezonedError;
private:
KSystemTimeZonesPrivate() {}
@@ -154,6 +155,7 @@
QString KSystemTimeZonesPrivate::m_zoneinfoDir;
QString KSystemTimeZonesPrivate::m_zonetab;
KSystemTimeZoneSource *KSystemTimeZonesPrivate::m_source = 0;
+bool KSystemTimeZonesPrivate::m_ktimezonedError = true;
KTzfileTimeZoneSource *KSystemTimeZonesPrivate::m_tzfileSource = 0;
KSystemTimeZones *KSystemTimeZonesPrivate::m_parent = 0;
KSystemTimeZonesPrivate *KSystemTimeZonesPrivate::m_instance = 0;
@@ -227,6 +229,12 @@
return KSystemTimeZonesPrivate::m_zoneinfoDir;
}
+bool KSystemTimeZones::ktimezonedOk()
+{
+ KSystemTimeZonesPrivate::instance();
+ return !KSystemTimeZonesPrivate::m_ktimezonedError;
+}
+
KTimeZones *KSystemTimeZones::timeZones()
{
return KSystemTimeZonesPrivate::instance();
@@ -250,6 +258,7 @@
void KSystemTimeZones::configChanged()
{
kDebug(161) << "KSystemTimeZones::configChanged()";
+ KSystemTimeZonesPrivate::m_ktimezonedError = false;
KSystemTimeZonesPrivate::readConfig(false);
}
@@ -258,6 +267,7 @@
Q_UNUSED(zonetab)
#ifndef Q_OS_WIN
kDebug(161) << "KSystemTimeZones::zonetabChanged()";
+ KSystemTimeZonesPrivate::m_ktimezonedError = false;
// Re-read zone.tab and update our collection, removing any deleted
// zones and adding any new zones.
KSystemTimeZonesPrivate::updateZonetab();
@@ -271,6 +281,7 @@
// will always be accessed by the system library calls to fetch
// local zone information.
Q_UNUSED(zone)
+ KSystemTimeZonesPrivate::m_ktimezonedError = false;
}
// Perform initialization, create the unique KSystemTimeZones instance,
@@ -289,7 +300,8 @@
KToolInvocation::klauncher(); // this calls startKdeinit, and blocks \
until it returns
QDBusInterface *ktimezoned = new QDBusInterface("org.kde.kded", \
"/modules/ktimezoned", KTIMEZONED_DBUS_IFACE); QDBusReply<void> reply = \
ktimezoned->call("initialize", false);
- if (!reply.isValid())
+ m_ktimezonedError = !reply.isValid();
+ if (m_ktimezonedError)
kError(161) << "KSystemTimeZones: ktimezoned initialize() D-Bus call \
failed: " << reply.error().message() << endl; kDebug(161)<<"instance(): ... \
initialised"; delete ktimezoned;
@@ -383,7 +395,8 @@
if (!m_source)
m_source = new KSystemTimeZoneSourceWindows;
QStringList newZones;
- Q_FOREACH( const QString & tz, KSystemTimeZoneWindows::listTimeZones() ) {
+ Q_FOREACH(const QString & tz, KSystemTimeZoneWindows::listTimeZones())
+ {
// const std::wstring wstr = tz.toStdWString();
// const KTimeZone info = make_time_zone( wstr.c_str() );
KSystemTimeZoneWindows stz(m_source, tz);
--- trunk/KDE/kdelibs/kdecore/date/ksystemtimezone.h #1179911:1179912
@@ -1,6 +1,6 @@
/*
This file is part of the KDE libraries
- Copyright (c) 2005-2007,2009 David Jarvie <djarvie@kde.org>
+ Copyright (c) 2005-2007,2009-2010 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
@@ -48,9 +48,15 @@
* Each individual time zone is defined in a KSystemTimeZone instance. Additional
* time zones (of any class derived from KTimeZone) may be added if desired.
*
- * At initialisation, KSystemTimeZones reads the zone.tab file to obtain the list
- * of system time zones, and creates a KSystemTimeZone instance for each one.
+ * At initialisation, KSystemTimeZones on UNIX systems reads the zone.tab file
+ * to obtain the list of system time zones, and creates a KSystemTimeZone
+ * instance for each one.
*
+ * @note KSystemTimeZones gets the system's time zone configuration, including
+ * the current local system time zone and the location of zone.tab, from the KDE
+ * time zone daemon, ktimezoned. If ktimezoned cannot be started, KSystemTimeZones
+ * will only know about the UTC time zone.
+ *
* Note that KSystemTimeZones is not derived from KTimeZones, but instead contains
* a KTimeZones instance which holds the system time zone database. Convenience
* static methods are defined to access its data, or alternatively you can access
@@ -227,6 +233,12 @@
*/
static QString zoneinfoDir();
+ /**
+ * Return whether the KDE time zone daemon, ktimezoned, is available. If
+ * not, UTC will be the only recognized time zone.
+ */
+ static bool ktimezonedOk();
+
private Q_SLOTS:
// Connected to D-Bus signals
void configChanged();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic