[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-workspace] applets/digital-clock/package/contents/ui: make sure allTimezones is set
From:       Marco Martin <notmart () gmail ! com>
Date:       2016-10-06 8:05:29
Message-ID: E1bs3gH-0005WM-It () code ! kde ! org
[Download RAW message or body]

Git commit e88b52a18ff9c7ed43a9bed4e4ba270a8ee18355 by Marco Martin.
Committed on 06/10/2016 at 08:05.
Pushed by mart into branch 'master'.

make sure allTimezones is set

Summary:
on Qt 5.6/5.7 changed signal was emitted at startup as well,
triggering plasmoid.configuration.onSelectedTimeZonesChanged
in Qt 5.8 this doesn't happen, giving an empty clock at startup
this makes sure allTimezones gets built

Test Plan: with Qt 5.8 the clock is shown correctly

Reviewers: #plasma, broulik

Reviewed By: #plasma, broulik

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D2946

M  +10   -8    applets/digital-clock/package/contents/ui/main.qml

http://commits.kde.org/plasma-workspace/e88b52a18ff9c7ed43a9bed4e4ba270a8ee18355

diff --git a/applets/digital-clock/package/contents/ui/main.qml \
b/applets/digital-clock/package/contents/ui/main.qml index f117ea4..66e8420 100644
--- a/applets/digital-clock/package/contents/ui/main.qml
+++ b/applets/digital-clock/package/contents/ui/main.qml
@@ -41,6 +41,14 @@ Item {
         return new Date(msUTC + \
(dataSource.data[plasmoid.configuration.lastSelectedTimezone]["Offset"] * 1000));  }
 
+    function initTimezones() {
+        var tz  = Array()
+        if (plasmoid.configuration.selectedTimeZones.indexOf("Local") === -1) {
+            tz.push("Local");
+        }
+        root.allTimezones = tz.concat(plasmoid.configuration.selectedTimeZones);
+    }
+
     Plasmoid.preferredRepresentation: Plasmoid.compactRepresentation
     Plasmoid.compactRepresentation: DigitalClock { }
     Plasmoid.fullRepresentation: CalendarView { }
@@ -61,14 +69,7 @@ Item {
     property var allTimezones
     Connections {
         target: plasmoid.configuration
-        onSelectedTimeZonesChanged: {
-            var tz  = Array()
-            if (plasmoid.configuration.selectedTimeZones.indexOf("Local") === -1) {
-                tz.push("Local");
-            }
-            root.allTimezones = tz.concat(plasmoid.configuration.selectedTimeZones);
-
-        }
+        onSelectedTimeZonesChanged: root.initTimezones();
     }
 
     PlasmaCore.DataSource {
@@ -98,6 +99,7 @@ Item {
     }
 
     Component.onCompleted: {
+        root.initTimezones();
         if (KCMShell.authorize("clock.desktop").length > 0) {
             plasmoid.setAction("clockkcm", i18n("Adjust Date and Time..."), \
"preferences-system-time");  }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic