Diffstat (limited to 'core/settings/citytime/citytime.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/settings/citytime/citytime.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp index b2f9f14..f33b19f 100644 --- a/core/settings/citytime/citytime.cpp +++ b/core/settings/citytime/citytime.cpp @@ -9,43 +9,45 @@ ** packaging of this file. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ +// changes by Maximilian Reiss <harlekin@handhelds.org> + #include "zonemap.h" #include "citytime.h" #include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/timestring.h> #include <qpe/tzselect.h> #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) #include <qpe/qcopenvelope_qws.h> #endif - #include <qdir.h> #include <qfile.h> #include <qlabel.h> #include <qmessagebox.h> #include <qregexp.h> #include <qtextstream.h> #include <qtoolbutton.h> +#include <qlayout.h> #include <stdlib.h> CityTime::CityTime( QWidget *parent, const char* name, WFlags fl ) : CityTimeBase( parent, name, fl ), strRealTz(0), bAdded(false) { Config config( "qpe" ); bWhichClock = config.readBoolEntry( "AMPM", TRUE ); frmMap->changeClock( bWhichClock ); @@ -68,25 +70,24 @@ CityTime::CityTime( QWidget *parent, const char* name, listCities.append( cmdCity3 ); listTimes.append( lblCTime1 ); listTimes.append( lblCTime2 ); listTimes.append( lblCTime3 ); // kludgy way of getting the screen size so we don't have to depend // on a resize event... QWidget *d = QApplication::desktop(); if ( d->width() < d->height() ) { // append for that 4 down look - listCities.append( cmdCity4 ); listCities.append( cmdCity5 ); listCities.append( cmdCity6 ); listTimes.append( lblCTime4 ); listTimes.append( lblCTime5 ); listTimes.append( lblCTime6 ); lblCTime7->hide(); lblCTime8->hide(); lblCTime9->hide(); cmdCity7->hide(); cmdCity8->hide(); cmdCity9->hide(); @@ -95,24 +96,28 @@ CityTime::CityTime( QWidget *parent, const char* name, listCities.append( cmdCity8 ); listCities.append( cmdCity9 ); listTimes.append( lblCTime7 ); listTimes.append( lblCTime8 ); listTimes.append( lblCTime9 ); lblCTime4->hide(); lblCTime5->hide(); lblCTime6->hide(); cmdCity4->hide(); cmdCity5->hide(); cmdCity6->hide(); } + + selWidget = frmMap->selectionWidget( this ); + selWidget->hide(); + CityTimeBaseLayout->addWidget( selWidget ); bAdded = true; readInTimes(); changed = FALSE; QObject::connect( qApp, SIGNAL( clockChanged(bool) ), this, SLOT( changeClock(bool) ) ); // now start the timer so we can update the time quickly every second timerEvent( 0 ); } CityTime::~CityTime() { if ( changed ) { @@ -190,48 +195,53 @@ void CityTime::showTime( void ) unsetenv( "TZ" ); if ( !strRealTz.isNull() ) { if ( setenv( "TZ", strRealTz, true ) != 0 ) { QMessageBox::critical( this, tr( "Restore Time Zone" ), tr( "There was a problem setting your timezone." "Your time may be wrong now..." ) ); } } } void CityTime::beginNewTz() { + buttonWidget->hide(); frmMap->setFocus(); + selWidget->show(); + // CityTimeBaseLayout->addWidget( selWidget ); } void CityTime::slotNewTz( const QString & strNewCountry, const QString & strNewCity ) { // determine what to do based on what putton is pressed... QListIterator<QToolButton> itCity(listCities); int i; // go through the list and make adjustments based on which button is on for ( i = 0, itCity.toFirst(); itCity.current(), i < CITIES; i++, ++itCity ) { QToolButton *cmdTmp = itCity.current(); if ( cmdTmp->isOn() ) { 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; break; } } showTime(); + buttonWidget->show(); + selWidget->hide(); } void CityTime::readInTimes( void ) { Config cfg("CityTime"); 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); |