-rw-r--r-- | noncore/settings/netsystemtime/timetabwidget.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/noncore/settings/netsystemtime/timetabwidget.cpp b/noncore/settings/netsystemtime/timetabwidget.cpp index 1ea460e..3cc127d 100644 --- a/noncore/settings/netsystemtime/timetabwidget.cpp +++ b/noncore/settings/netsystemtime/timetabwidget.cpp | |||
@@ -1,292 +1,298 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | =. | 3 | =. |
4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> | 4 | .=l. Copyright (c) 2002 OPIE team <opie@handhelds.org?> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This file is free software; you can | 6 | _;:, .> :=|. This file is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; either version 2 of the License, | 10 | - . .-<_> .<> Foundation; either version 2 of the License, |
11 | ._= =} : or (at your option) any later version. | 11 | ._= =} : or (at your option) any later version. |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This file is distributed in the hope that | 13 | .i_,=:_. -<s. This file is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
18 | ..}^=.= = ; Public License for more details. | 18 | ..}^=.= = ; Public License for more details. |
19 | ++= -. .` .: | 19 | ++= -. .` .: |
20 | : = ...= . :.=- You should have received a copy of the GNU | 20 | : = ...= . :.=- You should have received a copy of the GNU |
21 | -. .:....=;==+<; General Public License along with this file; | 21 | -. .:....=;==+<; General Public License along with this file; |
22 | -_. . . )=. = see the file COPYING. If not, write to the | 22 | -_. . . )=. = see the file COPYING. If not, write to the |
23 | -- :-=` Free Software Foundation, Inc., | 23 | -- :-=` Free Software Foundation, Inc., |
24 | 59 Temple Place - Suite 330, | 24 | 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include "timetabwidget.h" | 29 | #include "timetabwidget.h" |
30 | 30 | ||
31 | #include <qpe/config.h> | 31 | #include <qpe/config.h> |
32 | #include <qpe/datebookmonth.h> | 32 | #include <qpe/datebookmonth.h> |
33 | #include <qpe/global.h> | 33 | #include <qpe/global.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qpe/tzselect.h> | 35 | #include <qpe/tzselect.h> |
36 | 36 | ||
37 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 37 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
38 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | #include <qcombobox.h> | 41 | #include <qcombobox.h> |
42 | #include <qdatetime.h> | 42 | #include <qdatetime.h> |
43 | #include <qframe.h> | 43 | #include <qframe.h> |
44 | #include <qlabel.h> | 44 | #include <qlabel.h> |
45 | #include <qlayout.h> | 45 | #include <qlayout.h> |
46 | #include <qpushbutton.h> | 46 | #include <qpushbutton.h> |
47 | #include <qscrollview.h> | 47 | #include <qscrollview.h> |
48 | #include <qspinbox.h> | 48 | #include <qspinbox.h> |
49 | 49 | ||
50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
51 | #include <sys/time.h> | 51 | #include <sys/time.h> |
52 | 52 | ||
53 | static const int ValueAM = 0; | 53 | static const int ValueAM = 0; |
54 | static const int ValuePM = 1; | 54 | static const int ValuePM = 1; |
55 | 55 | ||
56 | TimeTabWidget::TimeTabWidget( QWidget *parent ) | 56 | TimeTabWidget::TimeTabWidget( QWidget *parent ) |
57 | : QWidget( parent, 0x0, 0 ) | 57 | : QWidget( parent, 0x0, 0 ) |
58 | { | 58 | { |
59 | // Synchronize HW clock to systemtime | 59 | // Synchronize HW clock to systemtime |
60 | // This app will update systemtime | 60 | // This app will update systemtime |
61 | // - if Cancel is clicked, will reset systemtime to HW clock's time | 61 | // - if Cancel is clicked, will reset systemtime to HW clock's time |
62 | // - if Ok is clicked, will leave systemtime as is | 62 | // - if Ok is clicked, will leave systemtime as is |
63 | system("/sbin/hwclock --systohc --utc"); | 63 | system("/sbin/hwclock --systohc --utc"); |
64 | 64 | ||
65 | QVBoxLayout *tmpvb = new QVBoxLayout( this ); | 65 | QVBoxLayout *tmpvb = new QVBoxLayout( this ); |
66 | QScrollView *sv = new QScrollView( this ); | 66 | QScrollView *sv = new QScrollView( this ); |
67 | tmpvb->addWidget( sv, 0, 0 ); | 67 | tmpvb->addWidget( sv, 0, 0 ); |
68 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 68 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
69 | sv->setFrameStyle( QFrame::NoFrame ); | 69 | sv->setFrameStyle( QFrame::NoFrame ); |
70 | QWidget *container = new QWidget( sv->viewport() ); | 70 | QWidget *container = new QWidget( sv->viewport() ); |
71 | sv->addChild( container ); | 71 | sv->addChild( container ); |
72 | 72 | ||
73 | QGridLayout *layout = new QGridLayout( container ); | 73 | QGridLayout *layout = new QGridLayout( container ); |
74 | layout->setMargin( 2 ); | 74 | layout->setMargin( 2 ); |
75 | layout->setSpacing( 4 ); | 75 | layout->setSpacing( 4 ); |
76 | 76 | ||
77 | // Hours | 77 | // Hours |
78 | layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 ); | 78 | layout->addMultiCellWidget( new QLabel( tr( "Hour" ), container ), 1, 1, 0, 1 ); |
79 | sbHour = new QSpinBox( container ); | 79 | sbHour = new QSpinBox( container ); |
80 | sbHour->setWrapping( TRUE ); | 80 | sbHour->setWrapping( TRUE ); |
81 | layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 ); | 81 | layout->addMultiCellWidget( sbHour, 2, 2, 0, 1 ); |
82 | 82 | ||
83 | // Minutes | 83 | // Minutes |
84 | layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 ); | 84 | layout->addMultiCellWidget( new QLabel( tr( "Minute" ), container ), 1, 1, 2, 3 ); |
85 | sbMin = new QSpinBox( container ); | 85 | sbMin = new QSpinBox( container ); |
86 | sbMin->setWrapping( TRUE ); | 86 | sbMin->setWrapping( TRUE ); |
87 | sbMin->setMinValue( 0 ); | 87 | sbMin->setMinValue( 0 ); |
88 | sbMin->setMaxValue( 59 ); | 88 | sbMin->setMaxValue( 59 ); |
89 | layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 ); | 89 | layout->addMultiCellWidget( sbMin, 2, 2, 2, 3 ); |
90 | 90 | ||
91 | // AM/PM | 91 | // AM/PM |
92 | cbAmpm = new QComboBox( container ); | 92 | cbAmpm = new QComboBox( container ); |
93 | cbAmpm->insertItem( tr( "AM" ), ValueAM ); | 93 | cbAmpm->insertItem( tr( "AM" ), ValueAM ); |
94 | cbAmpm->insertItem( tr( "PM" ), ValuePM ); | 94 | cbAmpm->insertItem( tr( "PM" ), ValuePM ); |
95 | layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 ); | 95 | layout->addMultiCellWidget( cbAmpm, 2, 2, 4, 5 ); |
96 | 96 | ||
97 | // Date | 97 | // Date |
98 | layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 ); | 98 | layout->addWidget( new QLabel( tr( "Date" ), container ), 4, 0 ); |
99 | btnDate = new DateButton( TRUE, container ); | 99 | btnDate = new DateButton( TRUE, container ); |
100 | layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 ); | 100 | layout->addMultiCellWidget( btnDate, 4, 4, 1, 5 ); |
101 | 101 | ||
102 | // Timezone | 102 | // Timezone |
103 | layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 ); | 103 | layout->addMultiCellWidget( new QLabel( tr( "Time zone" ), container ), 6, 6, 0, 1 ); |
104 | selTimeZone = new TimeZoneSelector( container ); | 104 | selTimeZone = new TimeZoneSelector( container ); |
105 | connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) ); | 105 | connect( selTimeZone, SIGNAL(signalNewTz(const QString&)), this, SLOT(slotTZChanged(const QString&)) ); |
106 | layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 ); | 106 | layout->addMultiCellWidget( selTimeZone, 6, 6, 2, 5 ); |
107 | 107 | ||
108 | // Space filler | 108 | // Space filler |
109 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); | 109 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 7, 0 ); |
110 | 110 | ||
111 | // Set NTP time button | 111 | // Set NTP time button |
112 | QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), | 112 | QPushButton *pb = new QPushButton( Resource::loadPixmap( "netsystemtime/ntptab" ), |
113 | tr( "Get time from the network" ), container ); | 113 | tr( "Get time from the network" ), container ); |
114 | connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); | 114 | connect( pb, SIGNAL(clicked()), this, SIGNAL(getNTPTime()) ); |
115 | layout->addMultiCellWidget( pb, 8, 8, 0, 5 ); | 115 | layout->addMultiCellWidget( pb, 8, 8, 0, 5 ); |
116 | 116 | ||
117 | // Set predicted time button | 117 | // Set predicted time button |
118 | pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), | 118 | pb = new QPushButton( Resource::loadPixmap( "netsystemtime/predicttab" ), tr( "Set predicted time" ), |
119 | container ); | 119 | container ); |
120 | connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) ); | 120 | connect( pb, SIGNAL(clicked()), this, SIGNAL(getPredictedTime()) ); |
121 | layout->addMultiCellWidget( pb, 9, 9, 0, 5 ); | 121 | layout->addMultiCellWidget( pb, 9, 9, 0, 5 ); |
122 | 122 | ||
123 | // Space filler at bottom of widget | 123 | // Space filler at bottom of widget |
124 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 ); | 124 | layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Minimum, QSizePolicy::Expanding ), 10, 0 ); |
125 | 125 | ||
126 | // Initialize values | 126 | // Initialize values |
127 | Config config( "locale" ); | 127 | Config config( "locale" ); |
128 | config.setGroup( "Location" ); | 128 | config.setGroup( "Location" ); |
129 | selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) ); | 129 | selTimeZone->setCurrentZone( config.readEntry( "Timezone", "America/New_York" ) ); |
130 | use12HourTime = FALSE; | 130 | use12HourTime = FALSE; |
131 | setDateTime( QDateTime::currentDateTime() ); | 131 | setDateTime( QDateTime::currentDateTime() ); |
132 | } | 132 | } |
133 | 133 | ||
134 | TimeTabWidget::~TimeTabWidget() | 134 | TimeTabWidget::~TimeTabWidget() |
135 | { | 135 | { |
136 | } | 136 | } |
137 | 137 | ||
138 | void TimeTabWidget::saveSettings( bool commit ) | 138 | void TimeTabWidget::saveSettings( bool commit ) |
139 | { | 139 | { |
140 | if ( commit ) | 140 | if ( commit ) |
141 | { | 141 | { |
142 | // Set timezone and announce to world | 142 | // Set timezone and announce to world |
143 | QString tz = selTimeZone->currentZone(); | 143 | QString tz = selTimeZone->currentZone(); |
144 | Config config("locale"); | 144 | Config config("locale"); |
145 | config.setGroup( "Location" ); | 145 | config.setGroup( "Location" ); |
146 | config.writeEntry( "Timezone", tz ); | 146 | config.writeEntry( "Timezone", tz ); |
147 | setenv( "TZ", tz, 1 ); | 147 | setenv( "TZ", tz, 1 ); |
148 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); | 148 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); |
149 | setTimeZone << tz; | 149 | setTimeZone << tz; |
150 | 150 | ||
151 | // If controls have a valid date & time, update systemtime | 151 | // If controls have a valid date & time, update systemtime |
152 | int hour = sbHour->value(); | 152 | int hour = sbHour->value(); |
153 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) | 153 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) |
154 | hour += 12; | 154 | hour += 12; |
155 | QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); | 155 | QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); |
156 | setSystemTime( dt ); | 156 | setSystemTime( dt ); |
157 | } | 157 | } |
158 | else | 158 | else |
159 | { | 159 | { |
160 | // Reset systemtime to hardware clock (i.e. undo any changes made by this app) | 160 | // Reset systemtime to hardware clock (i.e. undo any changes made by this app) |
161 | system("/sbin/hwclock --hctosys --utc"); | 161 | system("/sbin/hwclock --hctosys --utc"); |
162 | } | 162 | } |
163 | } | 163 | } |
164 | 164 | ||
165 | void TimeTabWidget::setDateTime( const QDateTime &dt ) | 165 | void TimeTabWidget::setDateTime( const QDateTime &dt ) |
166 | { | 166 | { |
167 | // Set time | 167 | // Set time |
168 | QTime t = dt.time(); | 168 | QTime t = dt.time(); |
169 | if( use12HourTime ) | 169 | if( use12HourTime ) |
170 | { | 170 | { |
171 | int show_hour = t.hour(); | 171 | int show_hour = t.hour(); |
172 | if ( t.hour() >= 12 ) | 172 | if ( t.hour() >= 12 ) |
173 | { | 173 | { |
174 | show_hour -= 12; | 174 | show_hour -= 12; |
175 | cbAmpm->setCurrentItem( ValuePM ); | 175 | cbAmpm->setCurrentItem( ValuePM ); |
176 | } | 176 | } |
177 | else | 177 | else |
178 | { | 178 | { |
179 | cbAmpm->setCurrentItem( ValueAM ); | 179 | cbAmpm->setCurrentItem( ValueAM ); |
180 | } | 180 | } |
181 | if ( show_hour == 0 ) | 181 | if ( show_hour == 0 ) |
182 | show_hour = 12; | 182 | show_hour = 12; |
183 | sbHour->setValue( show_hour ); | 183 | sbHour->setValue( show_hour ); |
184 | } | 184 | } |
185 | else | 185 | else |
186 | { | 186 | { |
187 | sbHour->setValue( t.hour() ); | 187 | sbHour->setValue( t.hour() ); |
188 | } | 188 | } |
189 | sbMin->setValue( t.minute() ); | 189 | sbMin->setValue( t.minute() ); |
190 | 190 | ||
191 | // Set date | 191 | // Set date |
192 | btnDate->setDate( dt.date() ); | 192 | btnDate->setDate( dt.date() ); |
193 | } | 193 | } |
194 | 194 | ||
195 | void TimeTabWidget::setSystemTime( const QDateTime &dt ) | 195 | void TimeTabWidget::setSystemTime( const QDateTime &dt ) |
196 | { | 196 | { |
197 | // Set system clock | 197 | // Set system clock |
198 | if ( dt.isValid() ) | 198 | if ( dt.isValid() ) |
199 | { | 199 | { |
200 | struct timeval myTv; | 200 | struct timeval myTv; |
201 | int t = TimeConversion::toUTC( dt ); | 201 | int t = TimeConversion::toUTC( dt ); |
202 | myTv.tv_sec = t; | 202 | myTv.tv_sec = t; |
203 | myTv.tv_usec = 0; | 203 | myTv.tv_usec = 0; |
204 | 204 | ||
205 | if ( myTv.tv_sec != -1 ) | 205 | if ( myTv.tv_sec != -1 ) |
206 | ::settimeofday( &myTv, 0 ); | 206 | ::settimeofday( &myTv, 0 ); |
207 | |||
208 | /* | ||
209 | * Commit the datetime to the 'hardware' | ||
210 | * as Global::writeHWClock() is a NOOP with Opie Alarm | ||
211 | */ | ||
212 | system("/sbin/hwclock --systohc --utc"); | ||
207 | } | 213 | } |
208 | } | 214 | } |
209 | 215 | ||
210 | void TimeTabWidget::slotUse12HourTime( int i ) | 216 | void TimeTabWidget::slotUse12HourTime( int i ) |
211 | { | 217 | { |
212 | use12HourTime = (i == 1); | 218 | use12HourTime = (i == 1); |
213 | 219 | ||
214 | cbAmpm->setEnabled( use12HourTime ); | 220 | cbAmpm->setEnabled( use12HourTime ); |
215 | 221 | ||
216 | int show_hour = sbHour->value(); | 222 | int show_hour = sbHour->value(); |
217 | 223 | ||
218 | if ( use12HourTime ) | 224 | if ( use12HourTime ) |
219 | { | 225 | { |
220 | sbHour->setMinValue( 1 ); | 226 | sbHour->setMinValue( 1 ); |
221 | sbHour->setMaxValue( 12 ); | 227 | sbHour->setMaxValue( 12 ); |
222 | 228 | ||
223 | if ( show_hour >= 12 ) | 229 | if ( show_hour >= 12 ) |
224 | { | 230 | { |
225 | show_hour -= 12; | 231 | show_hour -= 12; |
226 | cbAmpm->setCurrentItem( ValuePM ); | 232 | cbAmpm->setCurrentItem( ValuePM ); |
227 | } | 233 | } |
228 | else | 234 | else |
229 | { | 235 | { |
230 | cbAmpm->setCurrentItem( ValueAM ); | 236 | cbAmpm->setCurrentItem( ValueAM ); |
231 | } | 237 | } |
232 | if ( show_hour == 0 ) | 238 | if ( show_hour == 0 ) |
233 | show_hour = 12; | 239 | show_hour = 12; |
234 | } | 240 | } |
235 | else | 241 | else |
236 | { | 242 | { |
237 | sbHour->setMinValue( 0 ); | 243 | sbHour->setMinValue( 0 ); |
238 | sbHour->setMaxValue( 23 ); | 244 | sbHour->setMaxValue( 23 ); |
239 | 245 | ||
240 | if ( cbAmpm->currentItem() == ValuePM ) | 246 | if ( cbAmpm->currentItem() == ValuePM ) |
241 | { | 247 | { |
242 | show_hour += 12; | 248 | show_hour += 12; |
243 | if ( show_hour == 24 ) | 249 | if ( show_hour == 24 ) |
244 | show_hour = 0; | 250 | show_hour = 0; |
245 | } | 251 | } |
246 | } | 252 | } |
247 | 253 | ||
248 | sbHour->setValue( show_hour ); | 254 | sbHour->setValue( show_hour ); |
249 | } | 255 | } |
250 | 256 | ||
251 | void TimeTabWidget::slotDateFormatChanged( const DateFormat &df ) | 257 | void TimeTabWidget::slotDateFormatChanged( const DateFormat &df ) |
252 | { | 258 | { |
253 | btnDate->setDateFormat( df ); | 259 | btnDate->setDateFormat( df ); |
254 | } | 260 | } |
255 | 261 | ||
256 | void TimeTabWidget::slotWeekStartChanged( int monday ) | 262 | void TimeTabWidget::slotWeekStartChanged( int monday ) |
257 | { | 263 | { |
258 | btnDate->setWeekStartsMonday( monday ); | 264 | btnDate->setWeekStartsMonday( monday ); |
259 | } | 265 | } |
260 | 266 | ||
261 | void TimeTabWidget::slotTZChanged( const QString &newtz ) | 267 | void TimeTabWidget::slotTZChanged( const QString &newtz ) |
262 | { | 268 | { |
263 | // If controls have a valid date & time, update systemtime | 269 | // If controls have a valid date & time, update systemtime |
264 | int hour = sbHour->value(); | 270 | int hour = sbHour->value(); |
265 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) | 271 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) |
266 | hour += 12; | 272 | hour += 12; |
267 | QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); | 273 | QDateTime dt( btnDate->date(), QTime ( hour, sbMin->value(), QTime::currentTime().second() ) ); |
268 | setSystemTime( dt ); | 274 | setSystemTime( dt ); |
269 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); | 275 | QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); |
270 | setTimeZone << newtz; | 276 | setTimeZone << newtz; |
271 | 277 | ||
272 | // Set system timezone | 278 | // Set system timezone |
273 | QString currtz = getenv( "TZ" ); | 279 | QString currtz = getenv( "TZ" ); |
274 | setenv( "TZ", newtz, 1 ); | 280 | setenv( "TZ", newtz, 1 ); |
275 | 281 | ||
276 | // Get new date/time | 282 | // Get new date/time |
277 | hour = sbHour->value(); | 283 | hour = sbHour->value(); |
278 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) | 284 | if ( use12HourTime && cbAmpm->currentItem() == ValuePM ) |
279 | hour += 12; | 285 | hour += 12; |
280 | dt = QDateTime::currentDateTime(); | 286 | dt = QDateTime::currentDateTime(); |
281 | 287 | ||
282 | // Reset system timezone | 288 | // Reset system timezone |
283 | if ( !currtz.isNull() ) | 289 | if ( !currtz.isNull() ) |
284 | { | 290 | { |
285 | setenv( "TZ", currtz, 1 ); | 291 | setenv( "TZ", currtz, 1 ); |
286 | } | 292 | } |
287 | 293 | ||
288 | // Set controls to new time | 294 | // Set controls to new time |
289 | setDateTime( dt ); | 295 | setDateTime( dt ); |
290 | 296 | ||
291 | emit tzChanged( newtz ); | 297 | emit tzChanged( newtz ); |
292 | } | 298 | } |