author | ar <ar> | 2004-05-02 17:31:50 (UTC) |
---|---|---|
committer | ar <ar> | 2004-05-02 17:31:50 (UTC) |
commit | a210b9a597ba0c929d95c38ffbaf972916c7b8a7 (patch) (side-by-side diff) | |
tree | ce121d5017eb054222c86e0afb6057a28ea7bf8a /core/settings/citytime/citytime.cpp | |
parent | 18759e9156c96795831120408a9da0d3b4ec71a4 (diff) | |
download | opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.zip opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.gz opie-a210b9a597ba0c929d95c38ffbaf972916c7b8a7.tar.bz2 |
- convert qDebug to odebug
Diffstat (limited to 'core/settings/citytime/citytime.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/settings/citytime/citytime.cpp | 94 |
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 @@ -20,36 +20,40 @@ // changes by Maximilian Reiss <harlekin@handhelds.org> #include "zonemap.h" #include "citytime.h" +/* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/tzselect.h> #if !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif +#include <opie2/odebug.h> +/* QT */ #include <qlabel.h> #include <qmessagebox.h> #include <qtoolbutton.h> #include <qlayout.h> +/* STD */ #include <stdlib.h> CityTime::CityTime( QWidget *parent, const char* name, WFlags fl ) : CityTimeBase( parent, name, fl ), strRealTz(0), bAdded(false) { Config config( "qpe" ); config.setGroup( "Time" ); bWhichClock = config.readBoolEntry( "AMPM", TRUE ); - qDebug( QString("%1").arg(bWhichClock) ); + odebug << QString("%1").arg(bWhichClock) << oendl; frmMap->changeClock( bWhichClock ); char *pEnv; pEnv = NULL; pEnv = getenv("TZ"); if ( pEnv ) @@ -115,39 +119,39 @@ CityTime::CityTime( QWidget *parent, const char* name, timerEvent( 0 ); } CityTime::~CityTime() { if ( changed ) { - Config cfg("CityTime"); - cfg.setGroup("TimeZones"); - QListIterator<QToolButton> itCity( listCities ); - int i; - bool realTzWritten = FALSE; - for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { - if ( !strCityTz[i].isNull() ) { - cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); - cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); - if ( strCityTz[i] == strRealTz ) - realTzWritten = TRUE; - } - } - if ( realTzWritten ) { - cfg.removeEntry("Zone"+QString::number(CITIES)); - cfg.removeEntry("ZoneName"+QString::number(CITIES)); - } else { - cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); - if ( nameRealTz.isEmpty() ) { - int i = strRealTz.find( '/' ); - nameRealTz = strRealTz.mid( i+1 ); - } - cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); - } - QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); + Config cfg("CityTime"); + cfg.setGroup("TimeZones"); + QListIterator<QToolButton> itCity( listCities ); + int i; + bool realTzWritten = FALSE; + for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { + if ( !strCityTz[i].isNull() ) { + cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); + cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); + if ( strCityTz[i] == strRealTz ) + realTzWritten = TRUE; + } + } + if ( realTzWritten ) { + cfg.removeEntry("Zone"+QString::number(CITIES)); + cfg.removeEntry("ZoneName"+QString::number(CITIES)); + } else { + cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); + if ( nameRealTz.isEmpty() ) { + int i = strRealTz.find( '/' ); + nameRealTz = strRealTz.mid( i+1 ); + } + cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); + } + QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); - changed = FALSE; + changed = FALSE; } // restore the timezone, just in case we messed with it and // are destroyed at an inoppurtune moment if ( !strRealTz.isNull() ) { // this should be checked, but there is not much that can done at this //point if it fails @@ -155,13 +159,13 @@ CityTime::~CityTime() } } void CityTime::timerEvent( QTimerEvent *e ) { if ( e ) - killTimer( timerId ); + killTimer( timerId ); // change the time again!! showTime(); int ms = 1000 - QTime::currentTime().msec(); timerId = startTimer( ms ); } @@ -177,13 +181,13 @@ void CityTime::showTime( void ) QListIterator<QLabel> itTime(listTimes); // traverse the list... for ( i = 0, itTime.toFirst(); i < CITIES; i++, ++itTime) { if ( !strCityTz[i].isNull() ) { if ( setenv( "TZ", strCityTz[i], true ) == 0 ) { - itTime.current()->setText( TimeString::shortTime( bWhichClock ) ); + itTime.current()->setText( TimeString::shortTime( bWhichClock ) ); } else { QMessageBox::critical( this, tr( "Time Changing" ), tr( "There was a problem setting timezone %1" ) .arg( QString::number( i + 1 ) ) ); } } @@ -220,13 +224,13 @@ void CityTime::slotNewTz( const QString & strNewCountry, strCityTz[i] = strNewCountry + strNewCity; QString s = strNewCity; cmdTmp->setText( s.replace( QRegExp("_"), " " ) ); cmdTmp->toggle(); // we can actually break, since there is only one button // that is ever pressed! - changed = TRUE; + changed = TRUE; break; } } showTime(); buttonWidget->show(); selWidget->hide(); @@ -238,21 +242,21 @@ void CityTime::readInTimes( void ) cfg.setGroup("TimeZones"); QListIterator<QToolButton> itCity( listCities ); int i=0; nameRealTz = QString::null; QString zn; for ( ; i < CITIES ; i++ ) { - zn = cfg.readEntry("Zone"+QString::number(i), QString::null); - if ( zn.isNull() ) - break; - QString nm = cfg.readEntry("ZoneName"+QString::number(i)); - strCityTz[i] = zn; - itCity.current()->setText(nm); - if ( zn == strRealTz ) - nameRealTz = nm; - ++itCity; + zn = cfg.readEntry("Zone"+QString::number(i), QString::null); + if ( zn.isNull() ) + break; + QString nm = cfg.readEntry("ZoneName"+QString::number(i)); + strCityTz[i] = zn; + itCity.current()->setText(nm); + if ( zn == strRealTz ) + nameRealTz = nm; + ++itCity; } if ( i == 0 ) { // write in our own in a shameless self promotion and some humor QStringList list = timezoneDefaults(); int i; QStringList::Iterator it = list.begin(); @@ -260,18 +264,18 @@ void CityTime::readInTimes( void ) i++, ++itCity ) { strCityTz[i] = *it++; itCity.current()->setText( *it++ ); } } if ( nameRealTz.isEmpty() ) { - //remember the current time zone even if we don't have room - //to show it. - zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null); - if ( zn == strRealTz ) - nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES)); - i++; + //remember the current time zone even if we don't have room + //to show it. + zn = cfg.readEntry("Zone"+QString::number(CITIES), QString::null); + if ( zn == strRealTz ) + nameRealTz = cfg.readEntry("ZoneName"+QString::number(CITIES)); + i++; } } void CityTime::changeClock( bool newClock ) { bWhichClock = newClock; |