summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-02-11 18:37:03 (UTC)
committer harlekin <harlekin>2003-02-11 18:37:03 (UTC)
commitcb85b004afe2750733cef1663961539f6a3968e6 (patch) (unidiff)
tree6084bf1fb78375325938f96077e0faa03ece955f
parentec6795c6a15a3b9f4721b628d48366097da9c903 (diff)
downloadopie-cb85b004afe2750733cef1663961539f6a3968e6.zip
opie-cb85b004afe2750733cef1663961539f6a3968e6.tar.gz
opie-cb85b004afe2750733cef1663961539f6a3968e6.tar.bz2
fix bug #644, ampm vs 24 h handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/settings/citytime/citytime.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp
index 5dc9b02..b359ae1 100644
--- a/core/settings/citytime/citytime.cpp
+++ b/core/settings/citytime/citytime.cpp
@@ -36,33 +36,35 @@
36#include <qlabel.h> 36#include <qlabel.h>
37#include <qmessagebox.h> 37#include <qmessagebox.h>
38#include <qregexp.h> 38#include <qregexp.h>
39#include <qtextstream.h> 39#include <qtextstream.h>
40#include <qtoolbutton.h> 40#include <qtoolbutton.h>
41#include <qlayout.h> 41#include <qlayout.h>
42 42
43#include <stdlib.h> 43#include <stdlib.h>
44 44
45CityTime::CityTime( QWidget *parent, const char* name, 45CityTime::CityTime( QWidget *parent, const char* name,
46 WFlags fl ) 46 WFlags fl )
47 : CityTimeBase( parent, name, fl ), 47 : CityTimeBase( parent, name, fl ),
48 strRealTz(0), 48 strRealTz(0),
49 bAdded(false) 49 bAdded(false)
50{ 50{
51 Config config( "qpe" ); 51 Config config( "qpe" );
52 config.setGroup( "Time" );
52 bWhichClock = config.readBoolEntry( "AMPM", TRUE ); 53 bWhichClock = config.readBoolEntry( "AMPM", TRUE );
54 qDebug( QString("%1").arg(bWhichClock) );
53 frmMap->changeClock( bWhichClock ); 55 frmMap->changeClock( bWhichClock );
54 56
55 char *pEnv; 57 char *pEnv;
56 pEnv = NULL; 58 pEnv = NULL;
57 pEnv = getenv("TZ"); 59 pEnv = getenv("TZ");
58 if ( pEnv ) 60 if ( pEnv )
59 strRealTz = pEnv; 61 strRealTz = pEnv;
60 pEnv = NULL; 62 pEnv = NULL;
61 pEnv = getenv("HOME"); 63 pEnv = getenv("HOME");
62 if ( pEnv ) 64 if ( pEnv )
63 strHome = pEnv; 65 strHome = pEnv;
64 // append the labels to their respective lists... 66 // append the labels to their respective lists...
65 listCities.setAutoDelete( true ); 67 listCities.setAutoDelete( true );
66 listTimes.setAutoDelete( true ); 68 listTimes.setAutoDelete( true );
67 69
68 listCities.append( cmdCity1 ); 70 listCities.append( cmdCity1 );
@@ -170,33 +172,33 @@ void CityTime::timerEvent( QTimerEvent *e )
170 172
171void CityTime::mousePressEvent( QMouseEvent * ) 173void CityTime::mousePressEvent( QMouseEvent * )
172{ 174{
173 // DEBUG enable this to get a look at the zone information DEBUG 175 // DEBUG enable this to get a look at the zone information DEBUG
174// frmMap->showZones(); 176// frmMap->showZones();
175} 177}
176 178
177void CityTime::showTime( void ) 179void CityTime::showTime( void )
178{ 180{
179 int i; 181 int i;
180 QListIterator<QLabel> itTime(listTimes); 182 QListIterator<QLabel> itTime(listTimes);
181 183
182 // traverse the list... 184 // traverse the list...
183 for ( i = 0, itTime.toFirst(); i < CITIES; i++, ++itTime) { 185 for ( i = 0, itTime.toFirst(); i < CITIES; i++, ++itTime) {
184 if ( !strCityTz[i].isNull() ) { 186 if ( !strCityTz[i].isNull() ) {
185 if ( setenv( "TZ", strCityTz[i], true ) == 0 ) { 187 if ( setenv( "TZ", strCityTz[i], true ) == 0 ) {
186 itTime.current()->setText( TimeString::shortTime(bWhichClock) ); 188 itTime.current()->setText( TimeString::shortTime( bWhichClock ) );
187 } else { 189 } else {
188 QMessageBox::critical( this, tr( "Time Changing" ), 190 QMessageBox::critical( this, tr( "Time Changing" ),
189 tr( "There was a problem setting timezone %1" ) 191 tr( "There was a problem setting timezone %1" )
190 .arg( QString::number( i + 1 ) ) ); 192 .arg( QString::number( i + 1 ) ) );
191 } 193 }
192 } 194 }
193 } 195 }
194 // done playing around... put it all back 196 // done playing around... put it all back
195 unsetenv( "TZ" ); 197 unsetenv( "TZ" );
196 if ( !strRealTz.isNull() ) { 198 if ( !strRealTz.isNull() ) {
197 if ( setenv( "TZ", strRealTz, true ) != 0 ) { 199 if ( setenv( "TZ", strRealTz, true ) != 0 ) {
198 QMessageBox::critical( this, tr( "Restore Time Zone" ), 200 QMessageBox::critical( this, tr( "Restore Time Zone" ),
199 tr( "There was a problem setting your timezone." 201 tr( "There was a problem setting your timezone."
200 "Your time may be wrong now..." ) ); 202 "Your time may be wrong now..." ) );
201 } 203 }
202 } 204 }