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

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets
From:       Davide Bettio <davbet () aliceposta ! it>
Date:       2008-07-15 20:47:28
Message-ID: 1216154848.541509.24774.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 832941 by bettio:

ClockApplet calls changeEngineTimezone when the user request to change timezone.


 M  +12 -0     analog-clock/clock.cpp  
 M  +1 -0      analog-clock/clock.h  
 M  +10 -3     digital-clock/clock.cpp  
 M  +1 -0      digital-clock/clock.h  
 M  +8 -3      libplasmaclock/clockapplet.cpp  
 M  +1 -0      libplasmaclock/clockapplet.h  


--- trunk/KDE/kdebase/workspace/plasma/applets/analog-clock/clock.cpp #832940:832941
@@ -157,6 +157,7 @@
     cg.writeEntry("showSecondHand", m_showSecondHand);
     update();
 
+    dataEngine("time")->disconnectSource(currentTimezone(), this);
     connectToEngine();
 
     //TODO: why we don't call updateConstraints()?
@@ -164,6 +165,17 @@
     emit configNeedsSaving();
 }
 
+void Clock::changeEngineTimezone(QString oldTimezone, QString newTimezone)
+{
+    dataEngine("time")->disconnectSource(oldTimezone, this);
+    Plasma::DataEngine* timeEngine = dataEngine("time");
+    if (m_showSecondHand) {
+        timeEngine->connectSource(newTimezone, this, 500);
+    } else {
+        timeEngine->connectSource(newTimezone, this, 6000, Plasma::AlignToMinute);
+    }
+}
+
 void Clock::moveSecondHand()
 {
     //kDebug() << "moving second hand";
--- trunk/KDE/kdebase/workspace/plasma/applets/analog-clock/clock.h #832940:832941
@@ -65,6 +65,7 @@
 
     protected:
         void createClockConfigurationInterface(KConfigDialog *parent);
+        void changeEngineTimezone(QString oldTimezone, QString newTimezone);
 
     protected slots:
         void clockConfigAccepted();
--- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clock.cpp #832940:832941
@@ -63,6 +63,10 @@
     resize(150, 75);
 }
 
+Clock::~Clock()
+{
+}
+
 void Clock::init()
 {
     KConfigGroup cg = config();
@@ -185,10 +189,11 @@
     if (m_showSeconds != ui.secondsCheckbox->isChecked()) {
         m_showSeconds = !m_showSeconds;
         cg.writeEntry("showSeconds", m_showSeconds);
+
+        dataEngine("time")->disconnectSource(currentTimezone(), this);
+        dataEngine("time")->connectSource(currentTimezone(), this, updateInterval(), \
intervalAlignment());  }
 
-    dataEngine("time")->connectSource(currentTimezone(), this, updateInterval(), \
                intervalAlignment());
-
     m_showDate = ui.showDate->checkState() == Qt::Checked;
     cg.writeEntry("showDate", m_showDate);
     m_showYear = ui.showYear->checkState() == Qt::Checked;
@@ -217,8 +222,10 @@
     emit configNeedsSaving();
 }
 
-Clock::~Clock()
+void Clock::changeEngineTimezone(QString oldTimezone, QString newTimezone)
 {
+    dataEngine("time")->disconnectSource(oldTimezone, this);
+    dataEngine("time")->connectSource(newTimezone, this, updateInterval(), \
intervalAlignment());  }
 
 void Clock::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, \
                const QRect &contentsRect)
--- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clock.h #832940:832941
@@ -53,6 +53,7 @@
 
     protected:
         void createClockConfigurationInterface(KConfigDialog *parent);
+        void changeEngineTimezone(QString oldTimezone, QString newTimezone);
 
     private:
         void updateToolTipContent();
--- trunk/KDE/kdebase/workspace/plasma/applets/libplasmaclock/clockapplet.cpp \
#832940:832941 @@ -42,8 +42,6 @@
 #include <plasma/dialog.h>
 #include <plasma/theme.h>
 
-#include <plasma/dataengine.h>
-
 #include "ui_timezonesConfig.h"
 
 class ClockApplet::Private
@@ -130,13 +128,14 @@
     d->m_timeZones = d->ui.timeZones->selection();
     cg.writeEntry("timeZones", d->m_timeZones);
 
-    dataEngine("time")->disconnectSource(currentTimezone(), this);
     QString newTimezone = localTimezone();
 
     if (!d->ui.localTimeZone->isChecked() && !d->m_timeZones.isEmpty()) {
         newTimezone = d->m_timeZones.at(0);
     }
 
+    changeEngineTimezone(currentTimezone(), newTimezone);
+
     setCurrentTimezone(newTimezone);
     cg.writeEntry("currentTimezone", newTimezone);
 
@@ -147,6 +146,12 @@
     emit configNeedsSaving();
 }
 
+void ClockApplet::changeEngineTimezone(QString oldTimezone, QString newTimezone)
+{
+    Q_UNUSED(oldTimezone);
+    Q_UNUSED(newTimezone);
+}
+
 void ClockApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     if (event->buttons() == Qt::LeftButton) {
--- trunk/KDE/kdebase/workspace/plasma/applets/libplasmaclock/clockapplet.h \
#832940:832941 @@ -57,6 +57,7 @@
         void createConfigurationInterface(KConfigDialog *parent);
         virtual void createClockConfigurationInterface(KConfigDialog *parent);
         virtual void clockConfigAccepted();
+        virtual void changeEngineTimezone(QString oldTimezone, QString newTimezone);
 
     protected Q_SLOTS:
         void setCurrentTimezone(const QString &tz);


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

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