[kde-runtime/f18] ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)

Kevin Kofler kkofler at fedoraproject.org
Sat Feb 2 23:18:41 UTC 2013


commit a779c4a56063fadddffc53c54ddd3e5593e6dc01
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Sun Feb 3 00:17:37 2013 +0100

    ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)
    
    * Sat Feb 02 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.9.5-2
    - ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)

 kde-runtime-4.10.0-#906972.patch |   74 ++++++++++++++++++++++++++++++++++++++
 kde-runtime.spec                 |    9 ++++-
 2 files changed, 82 insertions(+), 1 deletions(-)
---
diff --git a/kde-runtime-4.10.0-#906972.patch b/kde-runtime-4.10.0-#906972.patch
new file mode 100644
index 0000000..c8e0ac2
--- /dev/null
+++ b/kde-runtime-4.10.0-#906972.patch
@@ -0,0 +1,74 @@
+From 99883ef781f4862b9e5fe2528a78b0fe5609643f Mon Sep 17 00:00:00 2001
+Message-Id: <99883ef781f4862b9e5fe2528a78b0fe5609643f.1359844887.git.kevin.kofler at chello.at>
+From: Kevin Kofler <kevin.kofler at chello.at>
+Date: Sat, 2 Feb 2013 08:13:27 +0100
+Subject: [PATCH] ktimezoned: Watch /etc/localtime if it doesn't exist yet.
+
+/etc/localtime legitimately might not exist. The default is then UTC.
+But the file can then be created later, so watch for its creation.
+
+If we don't do this, when setting the time zone for the first time using
+kcm_clock, the initially set time zone will fail to get reloaded and the
+dialog will unexpectedly jump back to UTC.
+---
+ ktimezoned/ktimezoned.cpp |   35 +++++++++++++++++++++--------------
+ 1 files changed, 21 insertions(+), 14 deletions(-)
+
+diff --git a/ktimezoned/ktimezoned.cpp b/ktimezoned/ktimezoned.cpp
+index 4eafa4e..9d52338 100644
+--- a/ktimezoned/ktimezoned.cpp
++++ b/ktimezoned/ktimezoned.cpp
+@@ -380,22 +380,25 @@ void KTimeZoned::findLocalZone()
+         checkDefaultInit();
+     }
+ 
+-    if (!mLocalZone.isEmpty())
++    if (mLocalZone.isEmpty())
+     {
+-        // The local time zone is defined by a file.
+-        // Watch for changes in the file so as to be notified of any change
+-        // in local time zone.
+-        mDirWatch = new KDirWatch(this);
+-        mDirWatch->addFile(mLocalIdFile);
+-        if (!mLocalIdFile2.isEmpty())
+-            mDirWatch->addFile(mLocalIdFile2);
+-        if (!mLocalZoneDataFile.isEmpty())
+-            mDirWatch->addFile(mLocalZoneDataFile);
+-        connect(mDirWatch, SIGNAL(dirty(const QString&)), SLOT(localChanged(const QString&)));
+-        connect(mDirWatch, SIGNAL(deleted(const QString&)), SLOT(localChanged(const QString&)));
+-        connect(mDirWatch, SIGNAL(created(const QString&)), SLOT(localChanged(const QString&)));
++        // The local time zone is not defined by a file.
++        // Watch for creation of /etc/localtime in case it gets created later.
++        mLocalIdFile = QLatin1String("/etc/localtime");
+     }
+-    else if (!mZoneinfoDir.isEmpty())
++    // Watch for changes in the file defining the local time zone so as to be
++    // notified of any change in it.
++    mDirWatch = new KDirWatch(this);
++    mDirWatch->addFile(mLocalIdFile);
++    if (!mLocalIdFile2.isEmpty())
++        mDirWatch->addFile(mLocalIdFile2);
++    if (!mLocalZoneDataFile.isEmpty())
++        mDirWatch->addFile(mLocalZoneDataFile);
++    connect(mDirWatch, SIGNAL(dirty(const QString&)), SLOT(localChanged(const QString&)));
++    connect(mDirWatch, SIGNAL(deleted(const QString&)), SLOT(localChanged(const QString&)));
++    connect(mDirWatch, SIGNAL(created(const QString&)), SLOT(localChanged(const QString&)));
++
++    if (mLocalZone.isEmpty() && !mZoneinfoDir.isEmpty())
+     {
+         // SOLUTION 7: HEURISTIC.
+         // None of the deterministic stuff above has worked: try a heuristic. We
+@@ -503,6 +506,10 @@ void KTimeZoned::localChanged(const QString& path)
+             // Fall through to LocaltimeLink
+         case LocaltimeLink:
+         case LocaltimeCopy:
++        // The fallback methods below also set a watch for /etc/localtime in
++        // case it gets created.
++        case TzName:
++        case Utc:
+             matchZoneFile(mLocalIdFile);
+             break;
+         case Timezone:
+-- 
+1.7.7.6
+
diff --git a/kde-runtime.spec b/kde-runtime.spec
index f3d27fa..a094ad9 100644
--- a/kde-runtime.spec
+++ b/kde-runtime.spec
@@ -5,7 +5,7 @@
 Name:    kde-runtime
 Summary: KDE Runtime
 Version: 4.9.5
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # http://techbase.kde.org/Policies/Licensing_Policy
 License: LGPLv2+ and GPLv2+
@@ -42,6 +42,9 @@ Patch50: kde-runtime-4.7.90-nepomuk_onlyshowin_kde.patch
 # increase some timeouts in an effort to see (some) errors before close
 Patch51: kde-runtime-4.9.0-installdbgsymbols.patch
 
+# ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)
+Patch52: kde-runtime-4.10.0-#906972.patch
+
 ## upstream patches
 
 # rhel patches
@@ -170,6 +173,7 @@ Requires: %{name} = %{version}-%{release}
 %patch9 -p1 -b .man-overrides
 %patch50 -p1 -b .nepomuk_onlyshowin_kde
 %patch51 -p1 -b .installdgbsymbols
+%patch52 -p1 -b .#906972
 
 %if 0%{?rhel}
 %patch300 -p1 -b .webkit
@@ -375,6 +379,9 @@ fi
 
 
 %changelog
+* Sat Feb 02 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.9.5-2
+- ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)
+
 * Sat Dec 29 2012 Rex Dieter <rdieter at fedoraproject.org> - 4.9.5-1
 - 4.9.5
 


More information about the scm-commits mailing list