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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/settings/citytime/citytime.cpp b/core/settings/citytime/citytime.cpp
index e7f0c46..721285d 100644
--- a/core/settings/citytime/citytime.cpp
+++ b/core/settings/citytime/citytime.cpp
@@ -64,98 +64,98 @@ CityTime::CityTime( QWidget *parent, const char* name,
64 64
65 listCities.append( cmdCity1 ); 65 listCities.append( cmdCity1 );
66 listCities.append( cmdCity2 ); 66 listCities.append( cmdCity2 );
67 listCities.append( cmdCity3 ); 67 listCities.append( cmdCity3 );
68 68
69 listTimes.append( lblCTime1 ); 69 listTimes.append( lblCTime1 );
70 listTimes.append( lblCTime2 ); 70 listTimes.append( lblCTime2 );
71 listTimes.append( lblCTime3 ); 71 listTimes.append( lblCTime3 );
72 72
73 73
74 // kludgy way of getting the screen size so we don't have to depend 74 // kludgy way of getting the screen size so we don't have to depend
75 // on a resize event... 75 // on a resize event...
76 QWidget *d = QApplication::desktop(); 76 QWidget *d = QApplication::desktop();
77 if ( d->width() < d->height() ) { 77 if ( d->width() < d->height() ) {
78 // append for that 4 down look 78 // append for that 4 down look
79 listCities.append( cmdCity4 ); 79 listCities.append( cmdCity4 );
80 listCities.append( cmdCity5 ); 80 listCities.append( cmdCity5 );
81 listCities.append( cmdCity6 ); 81 listCities.append( cmdCity6 );
82 listTimes.append( lblCTime4 ); 82 listTimes.append( lblCTime4 );
83 listTimes.append( lblCTime5 ); 83 listTimes.append( lblCTime5 );
84 listTimes.append( lblCTime6 ); 84 listTimes.append( lblCTime6 );
85 lblCTime7->hide(); 85 lblCTime7->hide();
86 lblCTime8->hide(); 86 lblCTime8->hide();
87 lblCTime9->hide(); 87 lblCTime9->hide();
88 cmdCity7->hide(); 88 cmdCity7->hide();
89 cmdCity8->hide(); 89 cmdCity8->hide();
90 cmdCity9->hide(); 90 cmdCity9->hide();
91 } else { 91 } else {
92 listCities.append( cmdCity7 ); 92 listCities.append( cmdCity7 );
93 listCities.append( cmdCity8 ); 93 listCities.append( cmdCity8 );
94 listCities.append( cmdCity9 ); 94 listCities.append( cmdCity9 );
95 listTimes.append( lblCTime7 ); 95 listTimes.append( lblCTime7 );
96 listTimes.append( lblCTime8 ); 96 listTimes.append( lblCTime8 );
97 listTimes.append( lblCTime9 ); 97 listTimes.append( lblCTime9 );
98 lblCTime4->hide(); 98 lblCTime4->hide();
99 lblCTime5->hide(); 99 lblCTime5->hide();
100 lblCTime6->hide(); 100 lblCTime6->hide();
101 cmdCity4->hide(); 101 cmdCity4->hide();
102 cmdCity5->hide(); 102 cmdCity5->hide();
103 cmdCity6->hide(); 103 cmdCity6->hide();
104 } 104 }
105 105
106 selWidget = frmMap->selectionWidget( this ); 106 selWidget = frmMap->selectionWidget( this );
107 selWidget->hide(); 107 selWidget->hide();
108 CityTimeBaseLayout->addWidget( selWidget ); 108 CityTimeBaseLayout->addWidget( selWidget );
109 bAdded = true; 109 bAdded = true;
110 readInTimes(); 110 readInTimes();
111 changed = FALSE; 111 changed = FALSE;
112 QObject::connect( qApp, SIGNAL( clockChanged( bool ) ), 112 QObject::connect( qApp, SIGNAL( clockChanged(bool) ),
113 this, SLOT( changeClock( bool ) ) ); 113 this, SLOT( changeClock(bool) ) );
114 // now start the timer so we can update the time quickly every second 114 // now start the timer so we can update the time quickly every second
115 timerEvent( 0 ); 115 timerEvent( 0 );
116} 116}
117 117
118CityTime::~CityTime() 118CityTime::~CityTime()
119{ 119{
120 if ( changed ) { 120 if ( changed ) {
121 Config cfg("CityTime"); 121 Config cfg("CityTime");
122 cfg.setGroup("TimeZones"); 122 cfg.setGroup("TimeZones");
123 QListIterator<QToolButton> itCity( listCities ); 123 QListIterator<QToolButton> itCity( listCities );
124 int i; 124 int i;
125 bool realTzWritten = FALSE; 125 bool realTzWritten = FALSE;
126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) { 126 for ( i = 0, itCity.toFirst(); i < CITIES; i++, ++itCity ) {
127 if ( !strCityTz[i].isNull() ) { 127 if ( !strCityTz[i].isNull() ) {
128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]); 128 cfg.writeEntry("Zone"+QString::number(i), strCityTz[i]);
129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text()); 129 cfg.writeEntry("ZoneName"+QString::number(i), itCity.current()->text());
130 if ( strCityTz[i] == strRealTz ) 130 if ( strCityTz[i] == strRealTz )
131 realTzWritten = TRUE; 131 realTzWritten = TRUE;
132 } 132 }
133 } 133 }
134 if ( realTzWritten ) { 134 if ( realTzWritten ) {
135 cfg.removeEntry("Zone"+QString::number(CITIES)); 135 cfg.removeEntry("Zone"+QString::number(CITIES));
136 cfg.removeEntry("ZoneName"+QString::number(CITIES)); 136 cfg.removeEntry("ZoneName"+QString::number(CITIES));
137 } else { 137 } else {
138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz); 138 cfg.writeEntry("Zone"+QString::number(CITIES), strRealTz);
139 if ( nameRealTz.isEmpty() ) { 139 if ( nameRealTz.isEmpty() ) {
140 int i = strRealTz.find( '/' ); 140 int i = strRealTz.find( '/' );
141 nameRealTz = strRealTz.mid( i+1 ); 141 nameRealTz = strRealTz.mid( i+1 );
142 } 142 }
143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz); 143 cfg.writeEntry("ZoneName"+QString::number(CITIES), nameRealTz);
144 } 144 }
145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" ); 145 QCopEnvelope ( "QPE/System", "timeZoneListChange()" );
146 146
147 changed = FALSE; 147 changed = FALSE;
148 } 148 }
149 // restore the timezone, just in case we messed with it and 149 // restore the timezone, just in case we messed with it and
150 // are destroyed at an inoppurtune moment 150 // are destroyed at an inoppurtune moment
151 if ( !strRealTz.isNull() ) { 151 if ( !strRealTz.isNull() ) {
152 // this should be checked, but there is not much that can done at this 152 // this should be checked, but there is not much that can done at this
153 //point if it fails 153 //point if it fails
154 setenv( "TZ", strRealTz, true ); 154 setenv( "TZ", strRealTz, true );
155 } 155 }
156} 156}
157 157
158void CityTime::timerEvent( QTimerEvent *e ) 158void CityTime::timerEvent( QTimerEvent *e )
159{ 159{
160 if ( e ) 160 if ( e )
161 killTimer( timerId ); 161 killTimer( timerId );