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

Kevin Kofler kkofler at fedoraproject.org
Sat Feb 2 22:51:54 UTC 2013


commit 76235bcd8895455a55e8b4dd797ea61e2687ed26
Author: Kevin Kofler <Kevin at tigcc.ticalc.org>
Date:   Sat Feb 2 23:51:40 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.10.0-2
    - ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)

 kde-runtime-4.10.0-#906972.patch |   74 ++++++++++++++++++++++++++++++++++++++
 kde-runtime.spec                 |   24 ++++++++----
 2 files changed, 90 insertions(+), 8 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 c280e5d..c301cb3 100644
--- a/kde-runtime.spec
+++ b/kde-runtime.spec
@@ -5,7 +5,7 @@
 Name:    kde-runtime
 Summary: KDE Runtime
 Version: 4.10.0
-Release: 1%{?dist}
+Release: 2%{?dist}
 
 # http://techbase.kde.org/Policies/Licensing_Policy
 License: LGPLv2+ and GPLv2+
@@ -34,6 +34,12 @@ Patch8: kdebase-runtime-4.5.95-compiz.patch
 # add overrides in default manpath
 Patch9: kdebase-runtime-4.3.4-man-overrides.patch
 
+# https://bugs.kde.org/show_bug.cgi?id=310486
+# revert the main part of:
+# http://commits.kde.org/kde-runtime/deee161a42efda74965ca4aab7d79fb7fb375352
+# (Upstream doesn't like this workaround.)
+Patch10: kde-runtime-4.9.98-kde#310486.patch
+
 ## upstreamable patches
 # make nepomuk menu items (with oxygen-only icons atm) OnlyShowIn=KDE;
 Patch50: kde-runtime-4.7.90-nepomuk_onlyshowin_kde.patch
@@ -42,10 +48,8 @@ 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
 
-# https://bugs.kde.org/show_bug.cgi?id=310486
-# revert the main part of:
-# http://commits.kde.org/kde-runtime/deee161a42efda74965ca4aab7d79fb7fb375352
-Patch52:  kde-runtime-4.9.98-kde#310486.patch
+# ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)
+Patch52: kde-runtime-4.10.0-#906972.patch
 
 ## upstream patches
 
@@ -174,11 +178,12 @@ Requires: %{name} = %{version}-%{release}
 %patch7 -p1 -b .htsearch
 %patch8 -p1 -b .config
 %patch9 -p1 -b .man-overrides
-%patch50 -p1 -b .nepomuk_onlyshowin_kde
-%patch51 -p1 -b .installdgbsymbols
 %if 0%{?fedora} && 0%{?fedora} < 19
-%patch52 -p1 -b .kde310486
+%patch10 -p1 -b .kde310486
 %endif
+%patch50 -p1 -b .nepomuk_onlyshowin_kde
+%patch51 -p1 -b .installdgbsymbols
+%patch52 -p1 -b .#906972
 
 %if 0%{?rhel}
 %patch300 -p1 -b .webkit
@@ -384,6 +389,9 @@ fi
 
 
 %changelog
+* Sat Feb 02 2013 Kevin Kofler <Kevin at tigcc.ticalc.org> - 4.10.0-2
+- ktimezoned: watch /etc/localtime if it doesn't exist yet (#906972)
+
 * Thu Jan 31 2013 Rex Dieter <rdieter at fedoraproject.org> - 4.10.0-1
 - 4.10.0
 


More information about the scm-commits mailing list