summaryrefslogtreecommitdiff
path: root/core/settings/citytime/citytime.cpp
Unidiff
Diffstat (limited to 'core/settings/citytime/citytime.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/citytime/citytime.cpp94
1 files changed, 49 insertions, 45 deletions
diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp
index 721285d..d73bda1 100644
--- a/core/settings/citytime/citytime.cpp
+++ b/core/settings/citytime/citytime.cpp
@@ -25,2 +25,3 @@
25 25
26/* OPIE */
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
@@ -31,3 +32,5 @@
31#endif 32#endif
33#include <opie2/odebug.h>
32 34
35/* QT */
33#include <qlabel.h> 36#include <qlabel.h>
@@ -37,2 +40,3 @@
37 40
41/* STD */
38#include <stdlib.h> 42#include <stdlib.h>
@@ -48,3 +52,3 @@ CityTime::CityTime( QWidget *parent, const char* name,
48 bWhichClock = config.readBoolEntry( "AMPM", TRUE ); 52 bWhichClock = config.readBoolEntry( "AMPM", TRUE );
49 qDebug( QString("%1").arg(bWhichClock) ); 53 odebug << QString("%1").arg(bWhichClock) << oendl;
50 frmMap->changeClock( bWhichClock ); 54 frmMap->changeClock( bWhichClock );
@@ -120,29 +124,29 @@ CityTime::~CityTime()
120 if ( changed ) { 124 if ( changed ) {
121 Config cfg("CityTime"); 125 Config cfg("CityTime");
122 cfg.setGroup("TimeZones"); 126 cfg.setGroup("TimeZones");
123 QListIterator<QToolButton> itCity( listCities ); 127 QListIterator<QToolButton> itCity( listCities );
124 int i; 128 int i;
125 bool realTzWritten = FALSE; 129 bool realTzWritten = FALSE;
126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { 130 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) {
127 if ( !strCityTz[i].isNull() ) { 131 if ( !strCityTz[i].isNull() ) {
128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); 132 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]);
129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); 133 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text());
130 if ( strCityTz[i] == strRealTz ) 134 if ( strCityTz[i] == strRealTz )
131 realTzWritten = TRUE; 135 realTzWritten = TRUE;
132 } 136 }
133 } 137 }
134 if ( realTzWritten ) { 138 if ( realTzWritten ) {
135 cfg.removeEntry("Zone"+QString::number(CITIES)); 139 cfg.removeEntry("Zone"+QString::number(CITIES));
136 cfg.removeEntry("ZoneName"+QString::number(CITIES)); 140 cfg.removeEntry("ZoneName"+QString::number(CITIES));
137 } else { 141 } else {
138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); 142 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz);
139 if ( nameRealTz.isEmpty() ) { 143 if ( nameRealTz.isEmpty() ) {
140 int i = strRealTz.find( '/' ); 144 int i = strRealTz.find( '/' );
141 nameRealTz = strRealTz.mid( i+1 ); 145 nameRealTz = strRealTz.mid( i+1 );
142 } 146 }
143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); 147 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz);
144 } 148 }
145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); 149 QCopEnvelope ( "QPE/System", "timeZoneListChange()" );
146 150
147 changed = FALSE; 151 changed = FALSE;
148 } 152 }
@@ -160,3 +164,3 @@ void CityTime::timerEvent( QTimerEvent *e )
160 if ( e ) 164 if ( e )
161 killTimer( timerId ); 165 killTimer( timerId );
162 // change the time again!! 166 // change the time again!!
@@ -182,3 +186,3 @@ void CityTime::showTime( void )
182 if ( setenv( "TZ", strCityTz[i], true ) == 0 ) { 186 if ( setenv( "TZ", strCityTz[i], true ) == 0 ) {
183 itTime.current()->setText( TimeString::shortTime( bWhichClock ) ); 187 itTime.current()->setText( TimeString::shortTime( bWhichClock ) );
184 } else { 188 } else {
@@ -225,3 +229,3 @@ void CityTime::slotNewTz( const QString & strNewCountry,
225 // that is ever pressed! 229 // that is ever pressed!
226 changed = TRUE; 230 changed = TRUE;
227 break; 231 break;
@@ -243,11 +247,11 @@ void CityTime::readInTimes( void )
243 for ( ; i < CITIES ; i++ ) { 247 for ( ; i < CITIES ; i++ ) {
244 zn = cfg.readEntry("Zone"+QString::number(i), QString::null); 248 zn = cfg.readEntry("Zone"+QString::number(i), QString::null);
245 if ( zn.isNull() ) 249 if ( zn.isNull() )
246 break; 250 break;
247 QString nm = cfg.readEntry("ZoneName"+QString::number(i)); 251 QString nm = cfg.readEntry("ZoneName"+QString::number(i));
248 strCityTz[i] = zn; 252 strCityTz[i] = zn;
249 itCity.current()->setText(nm); 253 itCity.current()->setText(nm);
250 if ( zn == strRealTz ) 254 if ( zn == strRealTz )
251 nameRealTz = nm; 255 nameRealTz = nm;
252 ++itCity; 256 ++itCity;
253 } 257 }
@@ -265,8 +269,8 @@ void CityTime::readInTimes( void )
265 if ( nameRealTz.isEmpty() ) { 269 if ( nameRealTz.isEmpty() ) {
266 //remember the current time zone even if we don't have room 270 //remember the current time zone even if we don't have room
267 //to show it. 271 //to show it.
268 zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null); 272 zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null);
269 if ( zn == strRealTz ) 273 if ( zn == strRealTz )
270 nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES)); 274 nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES));
271 i++; 275 i++;
272 } 276 }