[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 2:14:28
Message-ID: 1216088068.469803.11554.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 832598 by bettio:

now both analog-clock and digital-clock uses shared time zone config code.


 M  +3 -19     analog-clock/clock.cpp  
 M  +2 -2      analog-clock/clock.h  
 M  +27 -119   analog-clock/clockConfig.ui  
 M  +3 -22     digital-clock/clock.cpp  
 M  +2 -2      digital-clock/clock.h  
 M  +0 -91     digital-clock/clockConfig.ui  
 M  +49 -6     libplasmaclock/clockapplet.cpp  
 M  +2 -0      libplasmaclock/clockapplet.h  


--- trunk/KDE/kdebase/workspace/plasma/applets/analog-clock/clock.cpp #832597:832598
@@ -136,24 +136,18 @@
     update();
 }
 
-void Clock::createConfigurationInterface(KConfigDialog *parent)
+void Clock::createClockConfigurationInterface(KConfigDialog *parent)
 {
     //TODO: Make the size settable
     QWidget *widget = new QWidget();
     ui.setupUi(widget);
-    parent->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
-    connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
-    connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
     parent->addPage(widget, parent->windowTitle(), icon());
 
-    ui.localTimeZone->setChecked(isLocalTimezone());
-    ui.timeZones->setSelected(currentTimezone(), true);
-    ui.timeZones->setEnabled(!isLocalTimezone());
     ui.showTimeStringCheckBox->setChecked(m_showTimeString);
     ui.showSecondHandCheckBox->setChecked(m_showSecondHand);
 }
 
-void Clock::configAccepted()
+void Clock::clockConfigAccepted()
 {
     KConfigGroup cg = config();
     m_showTimeString = ui.showTimeStringCheckBox->isChecked();
@@ -162,19 +156,9 @@
     cg.writeEntry("showTimeString", m_showTimeString);
     cg.writeEntry("showSecondHand", m_showSecondHand);
     update();
-    QStringList tzs = ui.timeZones->selection();
 
-    dataEngine("time")->disconnectSource(currentTimezone(), this);
-    QString newTimezone = localTimezone();
-    if (!ui.localTimeZone->isChecked() && !tzs.isEmpty()) {
-        //TODO: support multiple timezones
-        newTimezone = tzs.at(0);
-    }
-
-    setCurrentTimezone(newTimezone);
-    cg.writeEntry("timezone", currentTimezone());
-
     connectToEngine();
+
     //TODO: why we don't call updateConstraints()?
     constraintsEvent(Plasma::AllConstraints);
     emit configNeedsSaving();
--- trunk/KDE/kdebase/workspace/plasma/applets/analog-clock/clock.h #832597:832598
@@ -64,10 +64,10 @@
         void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
 
     protected:
-        void createConfigurationInterface(KConfigDialog *parent);
+        void createClockConfigurationInterface(KConfigDialog *parent);
 
     protected slots:
-        void configAccepted();
+        void clockConfigAccepted();
         void moveSecondHand();
 
     private:
--- trunk/KDE/kdebase/workspace/plasma/applets/analog-clock/clockConfig.ui #832597:832598
@@ -5,7 +5,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>400</width>
+    <width>449</width>
     <height>300</height>
    </rect>
   </property>
@@ -15,127 +15,35 @@
     <height>300</height>
    </size>
   </property>
-  <layout class="QVBoxLayout" >
+  <layout class="QVBoxLayout" name="verticalLayout" >
    <item>
-    <layout class="QVBoxLayout" >
-     <item>
-      <widget class="QGroupBox" name="groupBox" >
-       <property name="title" >
-        <string>Appearance</string>
-       </property>
-       <property name="flat" >
-        <bool>true</bool>
-       </property>
-       <layout class="QVBoxLayout" >
-        <item>
-         <layout class="QVBoxLayout" >
-          <item>
-           <widget class="QCheckBox" name="showSecondHandCheckBox" >
-            <property name="toolTip" >
-             <string>Show the seconds</string>
-            </property>
-            <property name="whatsThis" >
-             <string>Check this if you want to show the seconds.</string>
-            </property>
-            <property name="text" >
-             <string>Show &amp;seconds</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="QCheckBox" name="showTimeStringCheckBox" >
-            <property name="toolTip" >
-             <string>Show the time in text</string>
-            </property>
-            <property name="whatsThis" >
-             <string>Check this if you want to display the time as text within the clock.</string>
-            </property>
-            <property name="text" >
-             <string>Also show the time as text</string>
-            </property>
-           </widget>
-          </item>
-         </layout>
-        </item>
-       </layout>
-      </widget>
-     </item>
-     <item>
-      <widget class="QGroupBox" name="groupBox_2" >
-       <property name="title" >
-        <string>Timezones</string>
-       </property>
-       <property name="flat" >
-        <bool>true</bool>
-       </property>
-       <layout class="QVBoxLayout" >
-        <item>
-         <layout class="QVBoxLayout" >
-          <item>
-           <widget class="QCheckBox" name="localTimeZone" >
-            <property name="text" >
-             <string>Use &amp;local timezone</string>
-            </property>
-           </widget>
-          </item>
-          <item>
-           <widget class="KTimeZoneWidget" name="timeZones" >
-            <property name="minimumSize" >
-             <size>
-              <width>300</width>
-              <height>150</height>
-             </size>
-            </property>
-            <column>
-             <property name="text" >
-              <string>Area</string>
-             </property>
-            </column>
-            <column>
-             <property name="text" >
-              <string>Region</string>
-             </property>
-            </column>
-            <column>
-             <property name="text" >
-              <string>Comment</string>
-             </property>
-            </column>
-           </widget>
-          </item>
-         </layout>
-        </item>
-       </layout>
-      </widget>
-     </item>
-    </layout>
+    <widget class="QCheckBox" name="showSecondHandCheckBox" >
+     <property name="toolTip" >
+      <string>Show the seconds</string>
+     </property>
+     <property name="whatsThis" >
+      <string>Check this if you want to show the seconds.</string>
+     </property>
+     <property name="text" >
+      <string>Show &amp;seconds</string>
+     </property>
+    </widget>
    </item>
+   <item>
+    <widget class="QCheckBox" name="showTimeStringCheckBox" >
+     <property name="toolTip" >
+      <string>Show the time in text</string>
+     </property>
+     <property name="whatsThis" >
+      <string>Check this if you want to display the time as text within the clock.</string>
+     </property>
+     <property name="text" >
+      <string>Also show the time as text</string>
+     </property>
+    </widget>
+   </item>
   </layout>
  </widget>
- <customwidgets>
-  <customwidget>
-   <class>KTimeZoneWidget</class>
-   <extends>QTreeWidget</extends>
-   <header>ktimezonewidget.h</header>
-  </customwidget>
- </customwidgets>
  <resources/>
- <connections>
-  <connection>
-   <sender>localTimeZone</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>timeZones</receiver>
-   <slot>setDisabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>20</x>
-     <y>20</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>20</x>
-     <y>20</y>
-    </hint>
-   </hints>
-  </connection>
- </connections>
+ <connections/>
 </ui>
--- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clock.cpp #832597:832598
@@ -150,15 +150,13 @@
     }
 }
 
-void Clock::createConfigurationInterface(KConfigDialog *parent)
+void Clock::createClockConfigurationInterface(KConfigDialog *parent)
 {
     //TODO: Make the size settable
     QWidget *widget = new QWidget();
     ui.setupUi(widget);
     parent->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
     parent->addPage(widget, parent->windowTitle(), icon());
-    connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
-    connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
 
     ui.showDate->setChecked(m_showDate);
     ui.showYear->setChecked(m_showYear);
@@ -170,14 +168,9 @@
     ui.plainClockFont->setCurrentFont(m_plainClockFont);
     ui.useCustomColor->setChecked(m_useCustomColor);
     ui.plainClockColor->setColor(m_plainClockColor);
-    ui.localTimeZone->setChecked(isLocalTimezone());
-    ui.timeZones->setEnabled(!isLocalTimezone());
-    foreach (const QString &str, m_timeZones) {
-        ui.timeZones->setSelected(str, true);
-    }
 }
 
-void Clock::configAccepted()
+void Clock::clockConfigAccepted()
 {
     KConfigGroup cg = config();
 
@@ -192,20 +185,8 @@
         cg.writeEntry("showSeconds", m_showSeconds);
     }
 
-    m_timeZones = ui.timeZones->selection();
-    cg.writeEntry("timeZones", m_timeZones);
+    dataEngine("time")->connectSource(currentTimezone(), this, updateInterval(), intervalAlignment());
 
-    dataEngine("time")->disconnectSource(currentTimezone(), this);
-    QString newTimezone = localTimezone();
-
-    if (!ui.localTimeZone->isChecked() && !m_timeZones.isEmpty()) {
-        newTimezone = m_timeZones.at(0);
-    }
-
-    setCurrentTimezone(newTimezone);
-    dataEngine("time")->connectSource(newTimezone, this, updateInterval(), intervalAlignment());
-    cg.writeEntry("currentTimezone", newTimezone);
-
     m_showDate = ui.showDate->checkState() == Qt::Checked;
     cg.writeEntry("showDate", m_showDate);
     m_showYear = ui.showYear->checkState() == Qt::Checked;
--- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clock.h #832597:832598
@@ -48,11 +48,11 @@
         void updateColors();
 
     protected slots:
-        void configAccepted();
+        void clockConfigAccepted();
         void constraintsEvent(Plasma::Constraints constraints);
 
     protected:
-        void createConfigurationInterface(KConfigDialog *parent);
+        void createClockConfigurationInterface(KConfigDialog *parent);
 
     private:
         void updateToolTipContent();
--- trunk/KDE/kdebase/workspace/plasma/applets/digital-clock/clockConfig.ui #832597:832598
@@ -1,33 +1,6 @@
 <ui version="4.0" >
  <class>clockConfig</class>
  <widget class="QWidget" name="clockConfig" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>400</width>
-    <height>300</height>
-   </rect>
-  </property>
-  <property name="minimumSize" >
-   <size>
-    <width>400</width>
-    <height>300</height>
-   </size>
-  </property>
-  <layout class="QGridLayout" >
-   <item row="0" column="0" >
-    <widget class="QTabWidget" name="ClockTab" >
-     <property name="sizePolicy" >
-      <sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="currentIndex" >
-      <number>0</number>
-     </property>
-     <widget class="QWidget" name="AppearanceTab" >
       <attribute name="title" >
        <string>Appearance</string>
       </attribute>
@@ -131,49 +104,6 @@
         </spacer>
        </item>
       </layout>
-     </widget>
-     <widget class="QWidget" name="TimezonesTab" >
-      <attribute name="title" >
-       <string>Ti&amp;mezones</string>
-      </attribute>
-      <layout class="QVBoxLayout" >
-       <item>
-        <widget class="QCheckBox" name="localTimeZone" >
-         <property name="text" >
-          <string>Use &amp;local timezone</string>
-         </property>
-        </widget>
-       </item>
-       <item>
-        <widget class="KTimeZoneWidget" name="timeZones" >
-         <property name="minimumSize" >
-          <size>
-           <width>300</width>
-           <height>150</height>
-          </size>
-         </property>
-         <column>
-          <property name="text" >
-           <string>Area</string>
-          </property>
-         </column>
-         <column>
-          <property name="text" >
-           <string>Region</string>
-          </property>
-         </column>
-         <column>
-          <property name="text" >
-           <string>Comment</string>
-          </property>
-         </column>
-        </widget>
-       </item>
-      </layout>
-     </widget>
-    </widget>
-   </item>
-  </layout>
  </widget>
  <customwidgets>
   <customwidget>
@@ -181,11 +111,6 @@
    <extends>QComboBox</extends>
    <header>kcolorcombo.h</header>
   </customwidget>
-  <customwidget>
-   <class>KTimeZoneWidget</class>
-   <extends>QTreeWidget</extends>
-   <header>ktimezonewidget.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections>
@@ -227,21 +152,5 @@
     </hint>
    </hints>
   </connection>
-  <connection>
-   <sender>localTimeZone</sender>
-   <signal>toggled(bool)</signal>
-   <receiver>timeZones</receiver>
-   <slot>setDisabled(bool)</slot>
-   <hints>
-    <hint type="sourcelabel" >
-     <x>209</x>
-     <y>53</y>
-    </hint>
-    <hint type="destinationlabel" >
-     <x>209</x>
-     <y>239</y>
-    </hint>
-   </hints>
-  </connection>
  </connections>
 </ui>
--- trunk/KDE/kdebase/workspace/plasma/applets/libplasmaclock/clockapplet.cpp #832597:832598
@@ -32,6 +32,7 @@
 
 #include <KColorScheme>
 #include <KConfigDialog>
+#include <KConfigGroup>
 #include <KDatePicker>
 #include <KDebug>
 #include <KDialog>
@@ -41,6 +42,8 @@
 #include <plasma/dialog.h>
 #include <plasma/theme.h>
 
+#include <plasma/dataengine.h>
+
 #include "ui_timezonesConfig.h"
 
 class ClockApplet::Private
@@ -56,6 +59,7 @@
     Plasma::Dialog *calendar;
     QString timezone;
     QPoint clicked;
+    QStringList m_timeZones;
 };
 
 ClockApplet::ClockApplet(QObject *parent, const QVariantList &args)
@@ -83,20 +87,30 @@
 
 void ClockApplet::createConfigurationInterface(KConfigDialog *parent)
 {
+    createClockConfigurationInterface(parent);
+
     QWidget *widget = new QWidget();
     d->ui.setupUi(widget);
 
-    parent->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
-    connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
-    connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
+    parent->addPage(widget, i18n("Time Zones"), icon());
 
-    parent->addPage(widget, parent->windowTitle(), icon());
-
     d->ui.localTimeZone->setChecked(isLocalTimezone());
     d->ui.timeZones->setSelected(currentTimezone(), true);
     d->ui.timeZones->setEnabled(!isLocalTimezone());
 
-    createClockConfigurationInterface(parent);
+    parent->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
+    connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
+    connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
+
+#if 0
+#ifdef CLOCK_APPLET_CONF
+    ui.localTimeZone->setChecked(isLocalTimezone());
+    ui.timeZones->setEnabled(!isLocalTimezone());
+    foreach (const QString &str, m_timeZones) {
+        ui.timeZones->setSelected(str, true);
+    }
+#endif
+#endif
 }
 
 void ClockApplet::createClockConfigurationInterface(KConfigDialog *parent)
@@ -104,6 +118,35 @@
 
 }
 
+void ClockApplet::clockConfigAccepted()
+{
+
+}
+
+void ClockApplet::configAccepted()
+{
+    KConfigGroup cg = config();
+
+    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);
+    }
+
+    setCurrentTimezone(newTimezone);
+    cg.writeEntry("currentTimezone", newTimezone);
+
+    clockConfigAccepted();
+
+    constraintsEvent(Plasma::SizeConstraint);
+    update();
+    emit configNeedsSaving();
+}
+
 void ClockApplet::mousePressEvent(QGraphicsSceneMouseEvent *event)
 {
     if (event->buttons() == Qt::LeftButton) {
--- trunk/KDE/kdebase/workspace/plasma/applets/libplasmaclock/clockapplet.h #832597:832598
@@ -56,10 +56,12 @@
         void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
         void createConfigurationInterface(KConfigDialog *parent);
         virtual void createClockConfigurationInterface(KConfigDialog *parent);
+        virtual void clockConfigAccepted();
 
     protected Q_SLOTS:
         void setCurrentTimezone(const QString &tz);
         void showCalendar(QGraphicsSceneMouseEvent *event);
+        void configAccepted();
 
     private:
         void updateToolTipContent();
[prev in list] [next in list] [prev in thread] [next in thread] 

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