mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
remove zones caching (used on solaris, support removad)
This commit is contained in:
parent
5dc9e7d8a0
commit
9c25733a8a
2 changed files with 2 additions and 30 deletions
|
@ -58,7 +58,6 @@ const int MAX_ZONE_TAB_LINE_LENGTH = 2000;
|
||||||
// Config file entry names
|
// Config file entry names
|
||||||
const char ZONEINFO_DIR[] = "ZoneinfoDir"; // path to zoneinfo/ directory
|
const char ZONEINFO_DIR[] = "ZoneinfoDir"; // path to zoneinfo/ directory
|
||||||
const char ZONE_TAB[] = "Zonetab"; // path & name of zone.tab
|
const char ZONE_TAB[] = "Zonetab"; // path & name of zone.tab
|
||||||
const char ZONE_TAB_CACHE[] = "ZonetabCache"; // type of cached simulated zone.tab
|
|
||||||
const char LOCAL_ZONE[] = "LocalZone"; // name of local time zone
|
const char LOCAL_ZONE[] = "LocalZone"; // name of local time zone
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,8 +100,6 @@ void KTimeZoned::init(bool restart)
|
||||||
mZoneinfoDir = group.readEntry(ZONEINFO_DIR);
|
mZoneinfoDir = group.readEntry(ZONEINFO_DIR);
|
||||||
mZoneTab = group.readEntry(ZONE_TAB);
|
mZoneTab = group.readEntry(ZONE_TAB);
|
||||||
mConfigLocalZone = group.readEntry(LOCAL_ZONE);
|
mConfigLocalZone = group.readEntry(LOCAL_ZONE);
|
||||||
QString ztc = group.readEntry(ZONE_TAB_CACHE, QString());
|
|
||||||
mZoneTabCache = (ztc == "Solaris") ? Solaris : NoCache;
|
|
||||||
if (mZoneinfoDir.length() > 1 && mZoneinfoDir.endsWith('/'))
|
if (mZoneinfoDir.length() > 1 && mZoneinfoDir.endsWith('/'))
|
||||||
mZoneinfoDir.truncate(mZoneinfoDir.length() - 1); // strip trailing '/'
|
mZoneinfoDir.truncate(mZoneinfoDir.length() - 1); // strip trailing '/'
|
||||||
|
|
||||||
|
@ -110,21 +107,14 @@ void KTimeZoned::init(bool restart)
|
||||||
|
|
||||||
QString oldZoneinfoDir = mZoneinfoDir;
|
QString oldZoneinfoDir = mZoneinfoDir;
|
||||||
QString oldZoneTab = mZoneTab;
|
QString oldZoneTab = mZoneTab;
|
||||||
CacheType oldCacheType = mZoneTabCache;
|
|
||||||
|
|
||||||
// Open zone.tab if we already know where it is
|
// Open zone.tab if we already know where it is
|
||||||
QFile f;
|
QFile f;
|
||||||
if (!mZoneTab.isEmpty() && !mZoneinfoDir.isEmpty())
|
if (!mZoneTab.isEmpty() && !mZoneinfoDir.isEmpty())
|
||||||
{
|
{
|
||||||
f.setFileName(mZoneTab);
|
f.setFileName(mZoneTab);
|
||||||
if (!f.open(QIODevice::ReadOnly))
|
if (!f.open(QIODevice::ReadOnly)) {
|
||||||
mZoneTab.clear();
|
mZoneTab.clear();
|
||||||
else if (mZoneTabCache != NoCache)
|
|
||||||
{
|
|
||||||
// Check whether the cached zone.tab is still up to date
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#warning Implement checking whether Solaris cached zone.tab is up to date
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,19 +126,11 @@ void KTimeZoned::init(bool restart)
|
||||||
mZoneTab = f.fileName();
|
mZoneTab = f.fileName();
|
||||||
|
|
||||||
if (mZoneinfoDir != oldZoneinfoDir
|
if (mZoneinfoDir != oldZoneinfoDir
|
||||||
|| mZoneTab != oldZoneTab
|
|| mZoneTab != oldZoneTab)
|
||||||
|| mZoneTabCache != oldCacheType)
|
|
||||||
{
|
{
|
||||||
// Update config file and notify interested applications
|
// Update config file and notify interested applications
|
||||||
group.writeEntry(ZONEINFO_DIR, mZoneinfoDir);
|
group.writeEntry(ZONEINFO_DIR, mZoneinfoDir);
|
||||||
group.writeEntry(ZONE_TAB, mZoneTab);
|
group.writeEntry(ZONE_TAB, mZoneTab);
|
||||||
QString ztc;
|
|
||||||
switch (mZoneTabCache)
|
|
||||||
{
|
|
||||||
case Solaris: ztc = "Solaris"; break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
group.writeEntry(ZONE_TAB_CACHE, ztc);
|
|
||||||
group.sync();
|
group.sync();
|
||||||
QDBusMessage message = QDBusMessage::createSignal("/Daemon", "org.kde.KTimeZoned", "configChanged");
|
QDBusMessage message = QDBusMessage::createSignal("/Daemon", "org.kde.KTimeZoned", "configChanged");
|
||||||
QDBusConnection::sessionBus().send(message);
|
QDBusConnection::sessionBus().send(message);
|
||||||
|
@ -205,10 +187,7 @@ bool KTimeZoned::findZoneTab(QFile& f)
|
||||||
ZONE_INFO_DIR = "/usr/share/zoneinfo";
|
ZONE_INFO_DIR = "/usr/share/zoneinfo";
|
||||||
}
|
}
|
||||||
|
|
||||||
mZoneTabCache = NoCache;
|
|
||||||
|
|
||||||
// Find and open zone.tab - it's all easy except knowing where to look.
|
// Find and open zone.tab - it's all easy except knowing where to look.
|
||||||
// Try the LSB location first.
|
|
||||||
QDir dir;
|
QDir dir;
|
||||||
QString zoneinfoDir = ZONE_INFO_DIR;
|
QString zoneinfoDir = ZONE_INFO_DIR;
|
||||||
// make a note if the dir exists; whether it contains zone.tab or not
|
// make a note if the dir exists; whether it contains zone.tab or not
|
||||||
|
|
|
@ -64,12 +64,6 @@ class KTimeZoned : public KTimeZonedBase
|
||||||
LocaltimeCopy = Localtime | File,
|
LocaltimeCopy = Localtime | File,
|
||||||
LocaltimeLink = Localtime | Link
|
LocaltimeLink = Localtime | Link
|
||||||
};
|
};
|
||||||
// Type of zone.tab cache
|
|
||||||
enum CacheType
|
|
||||||
{
|
|
||||||
NoCache, // zone.tab is the real thing, not a cached version
|
|
||||||
Solaris // Solaris: compiled from files in /usr/share/lib/zoneinfo/src
|
|
||||||
};
|
|
||||||
typedef QMap<QString, QString> MD5Map; // zone name, checksum
|
typedef QMap<QString, QString> MD5Map; // zone name, checksum
|
||||||
|
|
||||||
/** reimp */
|
/** reimp */
|
||||||
|
@ -104,7 +98,6 @@ class KTimeZoned : public KTimeZonedBase
|
||||||
KDirWatch *mZonetabWatch; // watch for zone.tab file changes
|
KDirWatch *mZonetabWatch; // watch for zone.tab file changes
|
||||||
KDirWatch *mDirWatch; // watch for time zone definition file changes
|
KDirWatch *mDirWatch; // watch for time zone definition file changes
|
||||||
MD5Map mMd5Sums; // MD5 checksums of zoneinfo files
|
MD5Map mMd5Sums; // MD5 checksums of zoneinfo files
|
||||||
CacheType mZoneTabCache; // type of cached simulated zone.tab
|
|
||||||
bool mHaveCountryCodes; // true if zone.tab contains any country codes
|
bool mHaveCountryCodes; // true if zone.tab contains any country codes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue