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

List:       kde-commits
Subject:    [kde-workspace] /: propagate changes from the Date/Time control module (kcmclock)
From:       Lukas Tinkl <lukas () kde ! org>
Date:       2012-09-21 15:48:00
Message-ID: 20120921154800.04A9CA6094 () git ! kde ! org
[Download RAW message or body]

Git commit 45bd3bfb9db950dde7cd09e5707629224275b199 by Lukas Tinkl.
Committed on 21/09/2012 at 14:50.
Pushed by lukas into branch 'master'.

propagate changes from the Date/Time control module (kcmclock)

by sending a DBUS signal "clockUpdated" which interested parties
can react to.

Fix the "time" dataengine to react to that signal.

Also tweak the analog/digital clocks so that they react
on updated data (I made sure no unnecessary repaints are made).

Fix the analog clock to update every minute at most (60000 milliseconds,
not 6000 ;)

M  +1    -6    kcontrol/dateandtime/dtime.cpp
M  +5    -11   kcontrol/dateandtime/main.cpp
M  +1    -3    kcontrol/dateandtime/main.h
M  +3    -12   plasma/generic/applets/analog-clock/clock.cpp
M  +7    -12   plasma/generic/applets/digital-clock/clock.cpp
M  +1    -0    plasma/generic/dataengines/time/timeengine.cpp

http://commits.kde.org/kde-workspace/45bd3bfb9db950dde7cd09e5707629224275b199

diff --git a/kcontrol/dateandtime/dtime.cpp b/kcontrol/dateandtime/dtime.cpp
index 7d8aa40..11c7a46 100644
--- a/kcontrol/dateandtime/dtime.cpp
+++ b/kcontrol/dateandtime/dtime.cpp
@@ -122,14 +122,9 @@ Dtime::Dtime(QWidget * parent)
 
 void Dtime::currentZone()
 {
-    QByteArray result(100, '\0');
-
-    time_t now = ::time(0);
-    tzset();
-    strftime(result.data(), result.size(), "%Z", localtime(&now));
     m_local->setText(i18n("Current local time zone: %1 (%2)",
                           KTimeZoneWidget::displayName(KSystemTimeZones::local()),
-                          QLatin1String(result)));
+                          \
QString::fromUtf8(KSystemTimeZones::local().abbreviations().first())));  }
 
 void Dtime::serverTimeCheck() {
diff --git a/kcontrol/dateandtime/main.cpp b/kcontrol/dateandtime/main.cpp
index 62fedc4..2fa0f3e 100644
--- a/kcontrol/dateandtime/main.cpp
+++ b/kcontrol/dateandtime/main.cpp
@@ -100,6 +100,10 @@ void KclockModule::save()
         dtime->processHelperErrors(reply.errorCode());
     }
   }
+  else {
+      QDBusMessage msg = QDBusMessage::createSignal("/org/kde/kcmshell_clock", \
"org.kde.kcmshell_clock", "clockUpdated"); +      \
QDBusConnection::sessionBus().send(msg); +  }
 
   // NOTE: super nasty hack #1
   // Try to work around time mismatch between KSystemTimeZones' update of local
@@ -108,19 +112,9 @@ void KclockModule::save()
   // local timezone was found.
   QTimer::singleShot(5000, this, SLOT(load()));
 
-  // setDisable(false) happens in load(), since QTimer::singleShot is non-blocking
+  // setDisabled(false) happens in load(), since QTimer::singleShot is non-blocking
 }
 
-void KclockModule::slotDateTimeHelperFinished(int exitCode)
-{
-    dtime->processHelperErrors( exitCode );
-#if 0
-  // Tell the clock applet about the change so that it can update its timezone
-  QDBusInterface clock("org.kde.kicker", "/Applets/Clock", \
                "org.kde.kicker.ClockApplet");
-  clock.call("reconfigure");
-#endif
-
-}
 void KclockModule::load()
 {
   dtime->load();
diff --git a/kcontrol/dateandtime/main.h b/kcontrol/dateandtime/main.h
index 11a4190..c1e5234 100644
--- a/kcontrol/dateandtime/main.h
+++ b/kcontrol/dateandtime/main.h
@@ -34,11 +34,9 @@ class KclockModule : public KCModule
 
 public:
   KclockModule(QWidget *parent, const QVariantList &);
-  
+
   void	save();
   void	load();
-private Q_SLOTS:
-  void slotDateTimeHelperFinished(int exitCode);
 
 private:
   QTabWidget   *tab;
diff --git a/plasma/generic/applets/analog-clock/clock.cpp \
b/plasma/generic/applets/analog-clock/clock.cpp index 799bb83..8cb5b6a 100644
--- a/plasma/generic/applets/analog-clock/clock.cpp
+++ b/plasma/generic/applets/analog-clock/clock.cpp
@@ -94,7 +94,7 @@ void Clock::connectToEngine()
     if (m_showSecondHand) {
         timeEngine->connectSource(currentTimezone(), this, 500);
     } else {
-        timeEngine->connectSource(currentTimezone(), this, 6000, \
Plasma::AlignToMinute); +        timeEngine->connectSource(currentTimezone(), this, \
60000, Plasma::AlignToMinute);  }
 }
 
@@ -152,16 +152,7 @@ void Clock::dataUpdated(const QString& source, const \
Plasma::DataEngine::Data &d  {
     Q_UNUSED(source);
     m_time = data["Time"].toTime();
-
-    if (m_time.minute() == lastTimeSeen().minute() &&
-        (!m_showSecondHand || m_time.second() == lastTimeSeen().second())) {
-        // avoid unnecessary repaints
-        return;
-    }
-
-    if (m_time.minute() != lastTimeSeen().minute() && m_repaintCache == RepaintNone) \
                {
-        m_repaintCache = RepaintHands;
-    }
+    m_repaintCache = RepaintHands;
 
     if (Plasma::ToolTipManager::self()->isVisible(this)) {
         updateTipContent();
@@ -224,7 +215,7 @@ void Clock::changeEngineTimezone(const QString &oldTimezone, \
const QString &newT  if (m_showSecondHand) {
         timeEngine->connectSource(newTimezone, this, 500);
     } else {
-        timeEngine->connectSource(newTimezone, this, 6000, Plasma::AlignToMinute);
+        timeEngine->connectSource(newTimezone, this, 60000, Plasma::AlignToMinute);
     }
 
     if (m_showingTimezone != (m_showTimezoneString || shouldDisplayTimezone())) {
diff --git a/plasma/generic/applets/digital-clock/clock.cpp \
b/plasma/generic/applets/digital-clock/clock.cpp index 1331776..708cb1e 100644
--- a/plasma/generic/applets/digital-clock/clock.cpp
+++ b/plasma/generic/applets/digital-clock/clock.cpp
@@ -246,18 +246,13 @@ void Clock::dataUpdated(const QString &source, const \
Plasma::DataEngine::Data &d  m_time = data["Time"].toTime();
     m_date = data["Date"].toDate();
 
-    // avoid unnecessary repaints
-    if ((m_showSeconds && m_time.second() != lastTimeSeen().second()) ||
-        m_time.minute() != lastTimeSeen().minute()) {
-
-        if (Plasma::ToolTipManager::self()->isVisible(this)) {
-            updateTipContent();
-        }
-
-        updateClockApplet(data);
-        generatePixmap();
-        update();
+    if (Plasma::ToolTipManager::self()->isVisible(this)) {
+        updateTipContent();
     }
+
+    updateClockApplet(data);
+    generatePixmap();
+    update();
 }
 
 void Clock::createClockConfigurationInterface(KConfigDialog *parent)
@@ -309,7 +304,7 @@ void Clock::createClockConfigurationInterface(KConfigDialog \
*parent)  parent, SLOT(settingsModified()));
     connect(ui.useCustomShadowColor, SIGNAL(stateChanged(int)),
             parent, SLOT(settingsModified()));
-    connect(ui.plainClockShadowColor, SIGNAL(changed(QColor)), 
+    connect(ui.plainClockShadowColor, SIGNAL(changed(QColor)),
             parent, SLOT(settingsModified()));
     connect(ui.showTimeZone, SIGNAL(stateChanged(int)),
             parent, SLOT(settingsModified()));
diff --git a/plasma/generic/dataengines/time/timeengine.cpp \
b/plasma/generic/dataengines/time/timeengine.cpp index c05c923..2f69e8f 100644
--- a/plasma/generic/dataengines/time/timeengine.cpp
+++ b/plasma/generic/dataengines/time/timeengine.cpp
@@ -57,6 +57,7 @@ void TimeEngine::init()
     QDBusConnection dbus = QDBusConnection::sessionBus();
     dbus.connect(QString(), QString(), "org.kde.KTimeZoned", "configChanged", this, \
SLOT(tzConfigChanged()));  dbus.connect("org.kde.Solid.PowerManagement", \
"/org/kde/Solid/PowerManagement", "org.kde.Solid.PowerManagement", \
"resumingFromSuspend", this, SLOT(clockSkewed())); +    dbus.connect(QString(), \
"/org/kde/kcmshell_clock", "org.kde.kcmshell_clock", "clockUpdated", this, \
SLOT(clockSkewed()));  }
 
 void TimeEngine::clockSkewed()


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

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