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

List:       kde-commits
Subject:    kdeutils/ksim
From:       Hans Petter Bieker <bieker () kde ! org>
Date:       2002-12-23 17:43:56
[Download RAW message or body]

CVS commit by bieker: 

There is no need to reinvent the wheel:
* replaced some code by KLocale::formatTime(time, true)
* removed check box for turning 24 h clock on/off


  M +0 -9      generalprefs.cpp   1.18
  M +0 -1      generalprefs.h   1.9
  M +7 -12     ksimsysinfo.cpp   1.43


--- kdeutils/ksim/generalprefs.cpp  #1.17:1.18
@@ -157,11 +157,4 @@ KSim::ClockPrefs::ClockPrefs(QWidget *pa
   m_timeCheck->setChecked(true);
 
-  m_24hourCheck = new QCheckBox(m_timeBox);
-  m_timeLayout->addWidget(m_24hourCheck);
-  m_24hourCheck->setText(i18n("Display 24 hour instead of 12 hour"));
-
-  connect(m_timeCheck, SIGNAL(toggled(bool)),
-     m_24hourCheck, SLOT(setEnabled(bool)));
-
   m_mainLayout->addWidget(m_timeBox);
 
@@ -191,5 +184,4 @@ void KSim::ClockPrefs::saveConfig(KSim::
 {
   config->setShowTime(m_timeCheck->isChecked());
-  config->setShow24hour(m_24hourCheck->isChecked());
   config->setShowDate(m_dateCheck->isChecked());
 }
@@ -198,5 +190,4 @@ void KSim::ClockPrefs::readConfig(KSim::
 {
   m_timeCheck->setChecked(config->showTime());
-  m_24hourCheck->setChecked(config->show24hour());
   m_dateCheck->setChecked(config->showDate());
 }

--- kdeutils/ksim/generalprefs.h  #1.8:1.9
@@ -84,5 +84,4 @@ namespace KSim
       QVBoxLayout *m_dateLayout;
       QCheckBox *m_timeCheck;
-      QCheckBox *m_24hourCheck;
       QCheckBox *m_dateCheck;
   };

--- kdeutils/ksim/ksimsysinfo.cpp  #1.42:1.43
@@ -28,4 +28,5 @@
 #include <klocale.h>
 #include <kapplication.h>
+#include <kglobal.h>
 
 #include "ksimsysinfo.h"
@@ -75,14 +76,9 @@ void KSim::Sysinfo::clockUptimeUpdate()
 
   if (m_config->showTime()) {
-    if (m_config->show24hour()) {
-      time = QTime::currentTime().toString("hh:mm:ss");
-      if (time == "00:00:00")
-        updateDate = true;
-    }
-    else {
-      time = QTime::currentTime().toString("hh:mm:ss ap");
-      if (time == "12:00:00 am")
+    QTime now = QTime::currentTime();
+    time = KGlobal::locale()->formatTime(now, true);
+    if ( now == QTime(0, 0) )
         updateDate = true;
-    }
+
     m_timeLabel->setText(time);
   }
@@ -91,6 +87,5 @@ void KSim::Sysinfo::clockUptimeUpdate()
   if (m_config->showDate()) {
     if (updateDate) {
-      QString dateString = QDate::currentDate().toString("ddd d MMMM");
-      m_dateLabel->setText(dateString);
+      m_dateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
       updateDate = false;
     }


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

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