summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/netsystemtime/ntpbase.ui962
-rw-r--r--noncore/settings/netsystemtime/settime.cpp17
2 files changed, 414 insertions, 565 deletions
diff --git a/noncore/settings/netsystemtime/ntpbase.ui b/noncore/settings/netsystemtime/ntpbase.ui
index f5e9371..be2c8d3 100644
--- a/noncore/settings/netsystemtime/ntpbase.ui
+++ b/noncore/settings/netsystemtime/ntpbase.ui
@@ -1,783 +1,631 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
2<class>NtpBase</class> 2<class>NtpBase</class>
3<widget> 3<widget class="QWidget">
4 <class>QWidget</class> 4 <property name="name">
5 <property stdset="1">
6 <name>name</name>
7 <cstring>NtpBase</cstring> 5 <cstring>NtpBase</cstring>
8 </property> 6 </property>
9 <property stdset="1"> 7 <property name="geometry">
10 <name>geometry</name>
11 <rect> 8 <rect>
12 <x>0</x> 9 <x>0</x>
13 <y>0</y> 10 <y>0</y>
14 <width>324</width> 11 <width>324</width>
15 <height>411</height> 12 <height>411</height>
16 </rect> 13 </rect>
17 </property> 14 </property>
18 <property stdset="1"> 15 <property name="caption">
19 <name>caption</name> 16 <string>Set Time</string>
20 <string>Network Time</string>
21 </property> 17 </property>
22 <property> 18 <property name="layoutMargin" stdset="0">
23 <name>layoutMargin</name>
24 </property> 19 </property>
25 <property> 20 <property name="layoutSpacing" stdset="0">
26 <name>layoutSpacing</name>
27 </property> 21 </property>
28 <grid> 22 <grid>
29 <property stdset="1"> 23 <property name="name">
30 <name>margin</name> 24 <cstring>unnamed</cstring>
25 </property>
26 <property name="margin">
31 <number>2</number> 27 <number>2</number>
32 </property> 28 </property>
33 <property stdset="1"> 29 <property name="spacing">
34 <name>spacing</name>
35 <number>2</number> 30 <number>2</number>
36 </property> 31 </property>
37 <widget row="0" column="0" > 32 <widget class="QTabWidget" row="0" column="0">
38 <class>QTabWidget</class> 33 <property name="name">
39 <property stdset="1">
40 <name>name</name>
41 <cstring>TabWidgetMain</cstring> 34 <cstring>TabWidgetMain</cstring>
42 </property> 35 </property>
43 <property> 36 <property name="layoutMargin" stdset="0">
44 <name>layoutMargin</name>
45 </property> 37 </property>
46 <property> 38 <property name="layoutSpacing" stdset="0">
47 <name>layoutSpacing</name>
48 </property> 39 </property>
49 <widget> 40 <widget class="QWidget">
50 <class>QWidget</class> 41 <property name="name">
51 <property stdset="1">
52 <name>name</name>
53 <cstring>tabMain</cstring> 42 <cstring>tabMain</cstring>
54 </property> 43 </property>
55 <attribute> 44 <attribute name="title">
56 <name>title</name>
57 <string>Main</string> 45 <string>Main</string>
58 </attribute> 46 </attribute>
59 <grid> 47 <grid>
60 <property stdset="1"> 48 <property name="name">
61 <name>margin</name> 49 <cstring>unnamed</cstring>
50 </property>
51 <property name="margin">
62 <number>2</number> 52 <number>2</number>
63 </property> 53 </property>
64 <property stdset="1"> 54 <property name="spacing">
65 <name>spacing</name>
66 <number>2</number> 55 <number>2</number>
67 </property> 56 </property>
68 <widget row="0" column="0" > 57 <widget class="QFrame" row="0" column="0">
69 <class>QFrame</class> 58 <property name="name">
70 <property stdset="1">
71 <name>name</name>
72 <cstring>FrameSystemTime</cstring> 59 <cstring>FrameSystemTime</cstring>
73 </property> 60 </property>
74 <property stdset="1"> 61 <property name="frameShape">
75 <name>frameShape</name>
76 <enum>StyledPanel</enum> 62 <enum>StyledPanel</enum>
77 </property> 63 </property>
78 <property stdset="1"> 64 <property name="frameShadow">
79 <name>frameShadow</name>
80 <enum>Raised</enum> 65 <enum>Raised</enum>
81 </property> 66 </property>
82 </widget> 67 </widget>
83 </grid> 68 </grid>
84 </widget> 69 </widget>
85 <widget> 70 <widget class="QWidget">
86 <class>QWidget</class> 71 <property name="name">
87 <property stdset="1"> 72 <cstring>tabSetTime</cstring>
88 <name>name</name>
89 <cstring>tabNtp</cstring>
90 </property> 73 </property>
91 <attribute> 74 <attribute name="title">
92 <name>title</name> 75 <string>Manual</string>
93 <string>NTP</string>
94 </attribute> 76 </attribute>
95 <grid> 77 <vbox>
96 <property stdset="1"> 78 <property name="name">
97 <name>margin</name> 79 <cstring>unnamed</cstring>
98 <number>1</number>
99 </property> 80 </property>
100 <property stdset="1"> 81 <property name="margin">
101 <name>spacing</name>
102 <number>2</number> 82 <number>2</number>
103 </property> 83 </property>
104 <widget row="1" column="0" > 84 <property name="spacing">
105 <class>QPushButton</class> 85 <number>2</number>
106 <property stdset="1"> 86 </property>
107 <name>name</name> 87 <widget class="QFrame">
108 <cstring>runNtp</cstring> 88 <property name="name">
89 <cstring>FrameSetTime</cstring>
109 </property> 90 </property>
110 <property stdset="1"> 91 <property name="frameShape">
111 <name>text</name> 92 <enum>StyledPanel</enum>
112 <string>Get time from network</string> 93 </property>
94 <property name="frameShadow">
95 <enum>Raised</enum>
113 </property> 96 </property>
114 </widget> 97 </widget>
115 <widget row="0" column="0" > 98 <widget class="QPushButton">
116 <class>QFrame</class> 99 <property name="name">
117 <property stdset="1"> 100 <cstring>PushButtonSetManualTime</cstring>
118 <name>name</name> 101 </property>
119 <cstring>FrameNtp</cstring> 102 <property name="text">
103 <string>Set time</string>
120 </property> 104 </property>
121 <property stdset="1"> 105 </widget>
122 <name>frameShape</name> 106 </vbox>
107 </widget>
108 <widget class="QWidget">
109 <property name="name">
110 <cstring>TabSettings</cstring>
111 </property>
112 <attribute name="title">
113 <string>Settings</string>
114 </attribute>
115 <grid>
116 <property name="name">
117 <cstring>unnamed</cstring>
118 </property>
119 <property name="margin">
120 <number>2</number>
121 </property>
122 <property name="spacing">
123 <number>2</number>
124 </property>
125 <widget class="QFrame" row="0" column="0">
126 <property name="name">
127 <cstring>FrameSettings</cstring>
128 </property>
129 <property name="frameShape">
123 <enum>StyledPanel</enum> 130 <enum>StyledPanel</enum>
124 </property> 131 </property>
125 <property stdset="1"> 132 <property name="frameShadow">
126 <name>frameShadow</name>
127 <enum>Raised</enum> 133 <enum>Raised</enum>
128 </property> 134 </property>
129 <property> 135 <property name="layoutMargin" stdset="0">
130 <name>layoutMargin</name>
131 </property> 136 </property>
132 <property> 137 <property name="layoutSpacing" stdset="0">
133 <name>layoutSpacing</name>
134 </property> 138 </property>
135 <grid> 139 <grid>
136 <property stdset="1"> 140 <property name="name">
137 <name>margin</name> 141 <cstring>unnamed</cstring>
138 <number>2</number>
139 </property> 142 </property>
140 <property stdset="1"> 143 <property name="margin">
141 <name>spacing</name> 144 <number>3</number>
142 <number>2</number>
143 </property> 145 </property>
144 <widget row="0" column="0" > 146 <property name="spacing">
145 <class>QLayoutWidget</class> 147 <number>11</number>
146 <property stdset="1"> 148 </property>
147 <name>name</name> 149 <widget class="QLayoutWidget" row="0" column="0">
148 <cstring>Layout4</cstring> 150 <property name="name">
151 <cstring>Layout6</cstring>
149 </property> 152 </property>
150 <vbox> 153 <grid>
151 <property stdset="1"> 154 <property name="name">
152 <name>margin</name> 155 <cstring>unnamed</cstring>
156 </property>
157 <property name="margin">
153 <number>0</number> 158 <number>0</number>
154 </property> 159 </property>
155 <property stdset="1"> 160 <property name="spacing">
156 <name>spacing</name>
157 <number>6</number> 161 <number>6</number>
158 </property> 162 </property>
159 <widget> 163 <widget class="QLabel" row="0" column="0">
160 <class>QLabel</class> 164 <property name="name">
161 <property stdset="1"> 165 <cstring>TextLabel7_2</cstring>
162 <name>name</name>
163 <cstring>TextLabel1</cstring>
164 </property>
165 <property stdset="1">
166 <name>autoMask</name>
167 <bool>false</bool>
168 </property> 166 </property>
169 <property stdset="1"> 167 <property name="text">
170 <name>text</name> 168 <string>Use</string>
171 <string>Start Time:</string>
172 </property> 169 </property>
173 </widget> 170 </widget>
174 <widget> 171 <widget class="QLabel" row="0" column="2">
175 <class>QLabel</class> 172 <property name="name">
176 <property stdset="1"> 173 <cstring>TextLabel2_2</cstring>
177 <name>name</name>
178 <cstring>TextLabelStartTime</cstring>
179 </property> 174 </property>
180 <property stdset="1"> 175 <property name="text">
181 <name>text</name> 176 <string>as</string>
182 <string>nan</string>
183 </property> 177 </property>
184 </widget> 178 </widget>
185 <widget> 179 <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
186 <class>QLabel</class> 180 <property name="name">
187 <property stdset="1"> 181 <cstring>TextLabel1_3</cstring>
188 <name>name</name>
189 <cstring>TextLabel3</cstring>
190 </property> 182 </property>
191 <property stdset="1"> 183 <property name="text">
192 <name>text</name> 184 <string>NTP server to get the time from the network.</string>
193 <string>Time Shift:</string> 185 </property>
186 <property name="alignment">
187 <set>WordBreak|AlignVCenter|AlignLeft</set>
188 </property>
189 <property name="wordwrap" stdset="0">
194 </property> 190 </property>
195 </widget> 191 </widget>
196 <widget> 192 <widget class="QComboBox" row="0" column="1">
197 <class>QLabel</class> 193 <property name="name">
198 <property stdset="1"> 194 <cstring>ComboNtpSrv</cstring>
199 <name>name</name>
200 <cstring>TextLabelTimeShift</cstring>
201 </property> 195 </property>
202 <property stdset="1"> 196 <property name="editable">
203 <name>text</name> 197 <bool>true</bool>
204 <string>nan</string>
205 </property> 198 </property>
206 </widget> 199 </widget>
207 <widget> 200 </grid>
208 <class>QLabel</class> 201 </widget>
209 <property stdset="1"> 202 <spacer row="3" column="0">
210 <name>name</name> 203 <property name="name">
211 <cstring>TextLabel5</cstring> 204 <cstring>Spacer2</cstring>
205 </property>
206 <property name="orientation">
207 <enum>Vertical</enum>
208 </property>
209 <property name="sizeType">
210 <enum>Expanding</enum>
211 </property>
212 <property name="sizeHint">
213 <size>
214 <width>0</width>
215 <height>20</height>
216 </size>
217 </property>
218 </spacer>
219 <widget class="QLayoutWidget" row="2" column="0">
220 <property name="name">
221 <cstring>Layout7</cstring>
222 </property>
223 <grid>
224 <property name="name">
225 <cstring>unnamed</cstring>
226 </property>
227 <property name="margin">
228 <number>0</number>
229 </property>
230 <property name="spacing">
231 <number>6</number>
232 </property>
233 <widget class="QLabel" row="0" column="0">
234 <property name="name">
235 <cstring>TextLabel1_2</cstring>
212 </property> 236 </property>
213 <property stdset="1"> 237 <property name="text">
214 <name>text</name> 238 <string>Insure a delay of</string>
215 <string>New Time:</string>
216 </property> 239 </property>
217 </widget> 240 </widget>
218 <widget> 241 <widget class="QLabel" row="0" column="2">
219 <class>QLabel</class> 242 <property name="name">
220 <property stdset="1"> 243 <cstring>TextLabel2</cstring>
221 <name>name</name>
222 <cstring>TextLabelNewTime</cstring>
223 </property> 244 </property>
224 <property stdset="1"> 245 <property name="text">
225 <name>text</name> 246 <string>minutes until</string>
226 <string>nan</string>
227 </property> 247 </property>
228 </widget> 248 </widget>
229 <spacer> 249 <widget class="QLabel" row="1" column="0" rowspan="1" colspan="3">
230 <property> 250 <property name="name">
231 <name>name</name> 251 <cstring>TextLabel3_3</cstring>
232 <cstring>Spacer1</cstring>
233 </property> 252 </property>
234 <property stdset="1"> 253 <property name="text">
235 <name>orientation</name> 254 <string>a new NTP lookup will be used to predict the time.</string>
236 <enum>Vertical</enum>
237 </property> 255 </property>
238 <property stdset="1"> 256 <property name="alignment">
239 <name>sizeType</name> 257 <set>WordBreak|AlignVCenter|AlignLeft</set>
240 <enum>Expanding</enum>
241 </property> 258 </property>
242 <property> 259 <property name="wordwrap" stdset="0">
243 <name>sizeHint</name>
244 <size>
245 <width>20</width>
246 <height>20</height>
247 </size>
248 </property> 260 </property>
249 </spacer> 261 </widget>
250 </vbox> 262 <widget class="QSpinBox" row="0" column="1">
263 <property name="name">
264 <cstring>SpinBoxMinLookupDelay</cstring>
265 </property>
266 <property name="maxValue">
267 <number>9999999</number>
268 </property>
269 <property name="minValue">
270 <number>42</number>
271 </property>
272 </widget>
273 </grid>
251 </widget> 274 </widget>
252 <widget row="1" column="0" > 275 <widget class="QLayoutWidget" row="1" column="0">
253 <class>QMultiLineEdit</class> 276 <property name="name">
254 <property stdset="1"> 277 <cstring>Layout7_2</cstring>
255 <name>name</name>
256 <cstring>MultiLineEditntpOutPut</cstring>
257 </property>
258 <property stdset="1">
259 <name>font</name>
260 <font>
261 <pointsize>7</pointsize>
262 </font>
263 </property>
264 <property stdset="1">
265 <name>wordWrap</name>
266 <enum>WidgetWidth</enum>
267 </property>
268 <property stdset="1">
269 <name>text</name>
270 <string></string>
271 </property> 278 </property>
279 <grid>
280 <property name="name">
281 <cstring>unnamed</cstring>
282 </property>
283 <property name="margin">
284 <number>0</number>
285 </property>
286 <property name="spacing">
287 <number>6</number>
288 </property>
289 <widget class="QLabel" row="0" column="0">
290 <property name="name">
291 <cstring>TextLabel1_2_2</cstring>
292 </property>
293 <property name="sizePolicy">
294 <sizepolicy>
295 <hsizetype>1</hsizetype>
296 <vsizetype>1</vsizetype>
297 <horstretch>0</horstretch>
298 <verstretch>0</verstretch>
299 </sizepolicy>
300 </property>
301 <property name="text">
302 <string>Wait for </string>
303 </property>
304 </widget>
305 <widget class="QLabel" row="0" column="2">
306 <property name="name">
307 <cstring>TextLabel2_3</cstring>
308 </property>
309 <property name="text">
310 <string>minutes until</string>
311 </property>
312 </widget>
313 <widget class="QLabel" row="1" column="0" rowspan="1" colspan="3">
314 <property name="name">
315 <cstring>TextLabel3_3_2</cstring>
316 </property>
317 <property name="text">
318 <string>NTP tries to syncronises the clock with the network.</string>
319 </property>
320 <property name="alignment">
321 <set>WordBreak|AlignVCenter|AlignLeft</set>
322 </property>
323 <property name="wordwrap" stdset="0">
324 </property>
325 </widget>
326 <widget class="QSpinBox" row="0" column="1">
327 <property name="name">
328 <cstring>SpinBoxNtpDelay</cstring>
329 </property>
330 <property name="maxValue">
331 <number>9999999</number>
332 </property>
333 <property name="minValue">
334 <number>0</number>
335 </property>
336 </widget>
337 </grid>
272 </widget> 338 </widget>
273 </grid> 339 </grid>
274 </widget> 340 </widget>
275 </grid> 341 </grid>
276 </widget> 342 </widget>
277 <widget> 343 <widget class="QWidget">
278 <class>QWidget</class> 344 <property name="name">
279 <property stdset="1">
280 <name>name</name>
281 <cstring>tab</cstring> 345 <cstring>tab</cstring>
282 </property> 346 </property>
283 <attribute> 347 <attribute name="title">
284 <name>title</name>
285 <string>Predict</string> 348 <string>Predict</string>
286 </attribute> 349 </attribute>
287 <grid> 350 <grid>
288 <property stdset="1"> 351 <property name="name">
289 <name>margin</name> 352 <cstring>unnamed</cstring>
353 </property>
354 <property name="margin">
290 <number>5</number> 355 <number>5</number>
291 </property> 356 </property>
292 <property stdset="1"> 357 <property name="spacing">
293 <name>spacing</name>
294 <number>6</number> 358 <number>6</number>
295 </property> 359 </property>
296 <widget row="0" column="0" > 360 <widget class="QTable" row="0" column="0">
297 <class>QTable</class> 361 <property name="name">
298 <property stdset="1">
299 <name>name</name>
300 <cstring>TableLookups</cstring> 362 <cstring>TableLookups</cstring>
301 </property> 363 </property>
302 <property stdset="1"> 364 <property name="font">
303 <name>font</name>
304 <font> 365 <font>
305 <pointsize>8</pointsize> 366 <pointsize>8</pointsize>
306 </font> 367 </font>
307 </property> 368 </property>
308 <property stdset="1"> 369 <property name="numRows">
309 <name>numRows</name>
310 <number>2</number> 370 <number>2</number>
311 </property> 371 </property>
312 <property stdset="1"> 372 <property name="numCols">
313 <name>numCols</name>
314 <number>2</number> 373 <number>2</number>
315 </property> 374 </property>
316 </widget> 375 </widget>
317 <widget row="1" column="0" > 376 <widget class="QLayoutWidget" row="1" column="0">
318 <class>QLayoutWidget</class> 377 <property name="name">
319 <property stdset="1">
320 <name>name</name>
321 <cstring>Layout9</cstring> 378 <cstring>Layout9</cstring>
322 </property> 379 </property>
323 <grid> 380 <grid>
324 <property stdset="1"> 381 <property name="name">
325 <name>margin</name> 382 <cstring>unnamed</cstring>
383 </property>
384 <property name="margin">
326 <number>0</number> 385 <number>0</number>
327 </property> 386 </property>
328 <property stdset="1"> 387 <property name="spacing">
329 <name>spacing</name>
330 <number>6</number> 388 <number>6</number>
331 </property> 389 </property>
332 <widget row="0" column="1" > 390 <widget class="QLabel" row="0" column="1">
333 <class>QLabel</class> 391 <property name="name">
334 <property stdset="1">
335 <name>name</name>
336 <cstring>TextLabelShift</cstring> 392 <cstring>TextLabelShift</cstring>
337 </property> 393 </property>
338 <property stdset="1"> 394 <property name="text">
339 <name>text</name>
340 <string>nan</string> 395 <string>nan</string>
341 </property> 396 </property>
342 </widget> 397 </widget>
343 <widget row="1" column="0" > 398 <widget class="QLabel" row="1" column="0">
344 <class>QLabel</class> 399 <property name="name">
345 <property stdset="1">
346 <name>name</name>
347 <cstring>TextLabel4</cstring> 400 <cstring>TextLabel4</cstring>
348 </property> 401 </property>
349 <property stdset="1"> 402 <property name="text">
350 <name>text</name>
351 <string>Esimated Shift:</string> 403 <string>Esimated Shift:</string>
352 </property> 404 </property>
353 </widget> 405 </widget>
354 <widget row="1" column="1" > 406 <widget class="QLabel" row="1" column="1">
355 <class>QLabel</class> 407 <property name="name">
356 <property stdset="1">
357 <name>name</name>
358 <cstring>TextLabelEstimatedShift</cstring> 408 <cstring>TextLabelEstimatedShift</cstring>
359 </property> 409 </property>
360 <property stdset="1"> 410 <property name="text">
361 <name>text</name>
362 <string>nan</string> 411 <string>nan</string>
363 </property> 412 </property>
364 </widget> 413 </widget>
365 <widget row="2" column="0" > 414 <widget class="QLabel" row="2" column="0">
366 <class>QLabel</class> 415 <property name="name">
367 <property stdset="1">
368 <name>name</name>
369 <cstring>TextLabel3_2</cstring> 416 <cstring>TextLabel3_2</cstring>
370 </property> 417 </property>
371 <property stdset="1"> 418 <property name="text">
372 <name>text</name>
373 <string>Predicted Time:</string> 419 <string>Predicted Time:</string>
374 </property> 420 </property>
375 </widget> 421 </widget>
376 <widget row="0" column="0" > 422 <widget class="QLabel" row="0" column="0">
377 <class>QLabel</class> 423 <property name="name">
378 <property stdset="1">
379 <name>name</name>
380 <cstring>Mean_shift_label</cstring> 424 <cstring>Mean_shift_label</cstring>
381 </property> 425 </property>
382 <property stdset="1"> 426 <property name="text">
383 <name>text</name>
384 <string>Mean shift:</string> 427 <string>Mean shift:</string>
385 </property> 428 </property>
386 </widget> 429 </widget>
387 <widget row="2" column="1" > 430 <widget class="QLabel" row="2" column="1">
388 <class>QLabel</class> 431 <property name="name">
389 <property stdset="1">
390 <name>name</name>
391 <cstring>TextLabelPredTime</cstring> 432 <cstring>TextLabelPredTime</cstring>
392 </property> 433 </property>
393 <property stdset="1"> 434 <property name="text">
394 <name>text</name>
395 <string>nan</string> 435 <string>nan</string>
396 </property> 436 </property>
397 </widget> 437 </widget>
398 </grid> 438 </grid>
399 </widget> 439 </widget>
400 <widget row="2" column="0" > 440 <widget class="QLayoutWidget" row="2" column="0">
401 <class>QLayoutWidget</class> 441 <property name="name">
402 <property stdset="1">
403 <name>name</name>
404 <cstring>Layout11</cstring> 442 <cstring>Layout11</cstring>
405 </property> 443 </property>
406 <hbox> 444 <hbox>
407 <property stdset="1"> 445 <property name="name">
408 <name>margin</name> 446 <cstring>unnamed</cstring>
447 </property>
448 <property name="margin">
409 <number>0</number> 449 <number>0</number>
410 </property> 450 </property>
411 <property stdset="1"> 451 <property name="spacing">
412 <name>spacing</name>
413 <number>6</number> 452 <number>6</number>
414 </property> 453 </property>
415 <widget> 454 <widget class="QPushButton">
416 <class>QPushButton</class> 455 <property name="name">
417 <property stdset="1">
418 <name>name</name>
419 <cstring>PushButtonSetPredTime</cstring> 456 <cstring>PushButtonSetPredTime</cstring>
420 </property> 457 </property>
421 <property stdset="1"> 458 <property name="text">
422 <name>text</name>
423 <string>Set predicted time</string> 459 <string>Set predicted time</string>
424 </property> 460 </property>
425 </widget> 461 </widget>
426 <widget> 462 <widget class="QPushButton">
427 <class>QPushButton</class> 463 <property name="name">
428 <property stdset="1">
429 <name>name</name>
430 <cstring>PushButtonPredict</cstring> 464 <cstring>PushButtonPredict</cstring>
431 </property> 465 </property>
432 <property stdset="1"> 466 <property name="text">
433 <name>text</name>
434 <string>Predict time</string> 467 <string>Predict time</string>
435 </property> 468 </property>
436 </widget> 469 </widget>
437 </hbox> 470 </hbox>
438 </widget> 471 </widget>
439 </grid> 472 </grid>
440 </widget> 473 </widget>
441 <widget> 474 <widget class="QWidget">
442 <class>QWidget</class> 475 <property name="name">
443 <property stdset="1"> 476 <cstring>tabNtp</cstring>
444 <name>name</name>
445 <cstring>TabSettings</cstring>
446 </property> 477 </property>
447 <attribute> 478 <attribute name="title">
448 <name>title</name> 479 <string>NTP</string>
449 <string>Settings</string>
450 </attribute> 480 </attribute>
451 <grid> 481 <grid>
452 <property stdset="1"> 482 <property name="name">
453 <name>margin</name> 483 <cstring>unnamed</cstring>
454 <number>2</number> 484 </property>
485 <property name="margin">
486 <number>1</number>
455 </property> 487 </property>
456 <property stdset="1"> 488 <property name="spacing">
457 <name>spacing</name>
458 <number>2</number> 489 <number>2</number>
459 </property> 490 </property>
460 <widget row="0" column="0" > 491 <widget class="QPushButton" row="1" column="0">
461 <class>QFrame</class> 492 <property name="name">
462 <property stdset="1"> 493 <cstring>runNtp</cstring>
463 <name>name</name>
464 <cstring>FrameSettings</cstring>
465 </property> 494 </property>
466 <property stdset="1"> 495 <property name="text">
467 <name>frameShape</name> 496 <string>Get time from network</string>
497 </property>
498 </widget>
499 <widget class="QFrame" row="0" column="0">
500 <property name="name">
501 <cstring>FrameNtp</cstring>
502 </property>
503 <property name="frameShape">
468 <enum>StyledPanel</enum> 504 <enum>StyledPanel</enum>
469 </property> 505 </property>
470 <property stdset="1"> 506 <property name="frameShadow">
471 <name>frameShadow</name>
472 <enum>Raised</enum> 507 <enum>Raised</enum>
473 </property> 508 </property>
474 <property> 509 <property name="layoutMargin" stdset="0">
475 <name>layoutMargin</name>
476 </property> 510 </property>
477 <property> 511 <property name="layoutSpacing" stdset="0">
478 <name>layoutSpacing</name>
479 </property> 512 </property>
480 <grid> 513 <grid>
481 <property stdset="1"> 514 <property name="name">
482 <name>margin</name> 515 <cstring>unnamed</cstring>
483 <number>3</number>
484 </property> 516 </property>
485 <property stdset="1"> 517 <property name="margin">
486 <name>spacing</name> 518 <number>2</number>
487 <number>11</number>
488 </property> 519 </property>
489 <widget row="0" column="0" > 520 <property name="spacing">
490 <class>QLayoutWidget</class> 521 <number>2</number>
491 <property stdset="1"> 522 </property>
492 <name>name</name> 523 <widget class="QLayoutWidget" row="0" column="0">
493 <cstring>Layout6</cstring> 524 <property name="name">
525 <cstring>Layout4</cstring>
494 </property> 526 </property>
495 <grid> 527 <vbox>
496 <property stdset="1"> 528 <property name="name">
497 <name>margin</name> 529 <cstring>unnamed</cstring>
530 </property>
531 <property name="margin">
498 <number>0</number> 532 <number>0</number>
499 </property> 533 </property>
500 <property stdset="1"> 534 <property name="spacing">
501 <name>spacing</name>
502 <number>6</number> 535 <number>6</number>
503 </property> 536 </property>
504 <widget row="0" column="0" > 537 <widget class="QLabel">
505 <class>QLabel</class> 538 <property name="name">
506 <property stdset="1"> 539 <cstring>TextLabel1</cstring>
507 <name>name</name>
508 <cstring>TextLabel7_2</cstring>
509 </property>
510 <property stdset="1">
511 <name>text</name>
512 <string>Use</string>
513 </property> 540 </property>
514 </widget> 541 <property name="autoMask">
515 <widget row="0" column="2" > 542 <bool>false</bool>
516 <class>QLabel</class>
517 <property stdset="1">
518 <name>name</name>
519 <cstring>TextLabel2_2</cstring>
520 </property> 543 </property>
521 <property stdset="1"> 544 <property name="text">
522 <name>text</name> 545 <string>Start Time:</string>
523 <string>as</string>
524 </property> 546 </property>
525 </widget> 547 </widget>
526 <widget row="1" column="0" rowspan="1" colspan="2" > 548 <widget class="QLabel">
527 <class>QLabel</class> 549 <property name="name">
528 <property stdset="1"> 550 <cstring>TextLabelStartTime</cstring>
529 <name>name</name>
530 <cstring>TextLabel1_3</cstring>
531 </property>
532 <property stdset="1">
533 <name>text</name>
534 <string>NTP server to get the time from the network.</string>
535 </property>
536 <property stdset="1">
537 <name>alignment</name>
538 <set>WordBreak|AlignVCenter|AlignLeft</set>
539 </property> 551 </property>
540 <property> 552 <property name="text">
541 <name>wordwrap</name> 553 <string>nan</string>
542 </property> 554 </property>
543 </widget> 555 </widget>
544 <widget row="0" column="1" > 556 <widget class="QLabel">
545 <class>QComboBox</class> 557 <property name="name">
546 <property stdset="1"> 558 <cstring>TextLabel3</cstring>
547 <name>name</name>
548 <cstring>ComboNtpSrv</cstring>
549 </property> 559 </property>
550 <property stdset="1"> 560 <property name="text">
551 <name>editable</name> 561 <string>Time Shift:</string>
552 <bool>true</bool>
553 </property> 562 </property>
554 </widget> 563 </widget>
555 </grid> 564 <widget class="QLabel">
556 </widget> 565 <property name="name">
557 <spacer row="3" column="0" > 566 <cstring>TextLabelTimeShift</cstring>
558 <property>
559 <name>name</name>
560 <cstring>Spacer2</cstring>
561 </property>
562 <property stdset="1">
563 <name>orientation</name>
564 <enum>Vertical</enum>
565 </property>
566 <property stdset="1">
567 <name>sizeType</name>
568 <enum>Expanding</enum>
569 </property>
570 <property>
571 <name>sizeHint</name>
572 <size>
573 <width>20</width>
574 <height>20</height>
575 </size>
576 </property>
577 </spacer>
578 <widget row="2" column="0" >
579 <class>QLayoutWidget</class>
580 <property stdset="1">
581 <name>name</name>
582 <cstring>Layout7</cstring>
583 </property>
584 <grid>
585 <property stdset="1">
586 <name>margin</name>
587 <number>0</number>
588 </property>
589 <property stdset="1">
590 <name>spacing</name>
591 <number>6</number>
592 </property>
593 <widget row="0" column="0" >
594 <class>QLabel</class>
595 <property stdset="1">
596 <name>name</name>
597 <cstring>TextLabel1_2</cstring>
598 </property> 567 </property>
599 <property stdset="1"> 568 <property name="text">
600 <name>text</name> 569 <string>nan</string>
601 <string>Insure a delay of</string>
602 </property> 570 </property>
603 </widget> 571 </widget>
604 <widget row="0" column="2" > 572 <widget class="QLabel">
605 <class>QLabel</class> 573 <property name="name">
606 <property stdset="1"> 574 <cstring>TextLabel5</cstring>
607 <name>name</name>
608 <cstring>TextLabel2</cstring>
609 </property> 575 </property>
610 <property stdset="1"> 576 <property name="text">
611 <name>text</name> 577 <string>New Time:</string>
612 <string>minutes until</string>
613 </property> 578 </property>
614 </widget> 579 </widget>
615 <widget row="1" column="0" rowspan="1" colspan="3" > 580 <widget class="QLabel">
616 <class>QLabel</class> 581 <property name="name">
617 <property stdset="1"> 582 <cstring>TextLabelNewTime</cstring>
618 <name>name</name>
619 <cstring>TextLabel3_3</cstring>
620 </property>
621 <property stdset="1">
622 <name>text</name>
623 <string>a new NTP lookup will be used to predict the time.</string>
624 </property>
625 <property stdset="1">
626 <name>alignment</name>
627 <set>WordBreak|AlignVCenter|AlignLeft</set>
628 </property> 583 </property>
629 <property> 584 <property name="text">
630 <name>wordwrap</name> 585 <string>nan</string>
631 </property> 586 </property>
632 </widget> 587 </widget>
633 <widget row="0" column="1" > 588 <spacer>
634 <class>QSpinBox</class> 589 <property name="name">
635 <property stdset="1"> 590 <cstring>Spacer1</cstring>
636 <name>name</name>
637 <cstring>SpinBoxMinLookupDelay</cstring>
638 </property> 591 </property>
639 <property stdset="1"> 592 <property name="orientation">
640 <name>maxValue</name> 593 <enum>Vertical</enum>
641 <number>9999999</number>
642 </property> 594 </property>
643 <property stdset="1"> 595 <property name="sizeType">
644 <name>minValue</name> 596 <enum>Expanding</enum>
645 <number>42</number>
646 </property> 597 </property>
647 </widget> 598 <property name="sizeHint">
648 </grid> 599 <size>
600 <width>0</width>
601 <height>20</height>
602 </size>
603 </property>
604 </spacer>
605 </vbox>
649 </widget> 606 </widget>
650 <widget row="1" column="0" > 607 <widget class="QMultiLineEdit" row="1" column="0">
651 <class>QLayoutWidget</class> 608 <property name="name">
652 <property stdset="1"> 609 <cstring>MultiLineEditntpOutPut</cstring>
653 <name>name</name> 610 </property>
654 <cstring>Layout7_2</cstring> 611 <property name="font">
612 <font>
613 <pointsize>7</pointsize>
614 </font>
615 </property>
616 <property name="text">
617 <string></string>
618 </property>
619 <property name="wordWrap">
620 <enum>WidgetWidth</enum>
655 </property> 621 </property>
656 <grid>
657 <property stdset="1">
658 <name>margin</name>
659 <number>0</number>
660 </property>
661 <property stdset="1">
662 <name>spacing</name>
663 <number>6</number>
664 </property>
665 <widget row="0" column="0" >
666 <class>QLabel</class>
667 <property stdset="1">
668 <name>name</name>
669 <cstring>TextLabel1_2_2</cstring>
670 </property>
671 <property stdset="1">
672 <name>sizePolicy</name>
673 <sizepolicy>
674 <hsizetype>1</hsizetype>
675 <vsizetype>1</vsizetype>
676 </sizepolicy>
677 </property>
678 <property stdset="1">
679 <name>text</name>
680 <string>Wait for </string>
681 </property>
682 </widget>
683 <widget row="0" column="2" >
684 <class>QLabel</class>
685 <property stdset="1">
686 <name>name</name>
687 <cstring>TextLabel2_3</cstring>
688 </property>
689 <property stdset="1">
690 <name>text</name>
691 <string>minutes until</string>
692 </property>
693 </widget>
694 <widget row="1" column="0" rowspan="1" colspan="3" >
695 <class>QLabel</class>
696 <property stdset="1">
697 <name>name</name>
698 <cstring>TextLabel3_3_2</cstring>
699 </property>
700 <property stdset="1">
701 <name>text</name>
702 <string>NTP tries to syncronises the clock with the network.</string>
703 </property>
704 <property stdset="1">
705 <name>alignment</name>
706 <set>WordBreak|AlignVCenter|AlignLeft</set>
707 </property>
708 <property>
709 <name>wordwrap</name>
710 </property>
711 </widget>
712 <widget row="0" column="1" >
713 <class>QSpinBox</class>
714 <property stdset="1">
715 <name>name</name>
716 <cstring>SpinBoxNtpDelay</cstring>
717 </property>
718 <property stdset="1">
719 <name>maxValue</name>
720 <number>9999999</number>
721 </property>
722 <property stdset="1">
723 <name>minValue</name>
724 <number>0</number>
725 </property>
726 </widget>
727 </grid>
728 </widget> 622 </widget>
729 </grid> 623 </grid>
730 </widget> 624 </widget>
731 </grid> 625 </grid>
732 </widget> 626 </widget>
733 <widget>
734 <class>QWidget</class>
735 <property stdset="1">
736 <name>name</name>
737 <cstring>tabSetTime</cstring>
738 </property>
739 <attribute>
740 <name>title</name>
741 <string>Manual</string>
742 </attribute>
743 <vbox>
744 <property stdset="1">
745 <name>margin</name>
746 <number>2</number>
747 </property>
748 <property stdset="1">
749 <name>spacing</name>
750 <number>2</number>
751 </property>
752 <widget>
753 <class>QFrame</class>
754 <property stdset="1">
755 <name>name</name>
756 <cstring>FrameSetTime</cstring>
757 </property>
758 <property stdset="1">
759 <name>frameShape</name>
760 <enum>StyledPanel</enum>
761 </property>
762 <property stdset="1">
763 <name>frameShadow</name>
764 <enum>Raised</enum>
765 </property>
766 </widget>
767 <widget>
768 <class>QPushButton</class>
769 <property stdset="1">
770 <name>name</name>
771 <cstring>PushButtonSetManualTime</cstring>
772 </property>
773 <property stdset="1">
774 <name>text</name>
775 <string>Set time</string>
776 </property>
777 </widget>
778 </vbox>
779 </widget>
780 </widget> 627 </widget>
781 </grid> 628 </grid>
782</widget> 629</widget>
630<layoutdefaults spacing="6" margin="11"/>
783</UI> 631</UI>
diff --git a/noncore/settings/netsystemtime/settime.cpp b/noncore/settings/netsystemtime/settime.cpp
index d1dc5b8..f6e02d5 100644
--- a/noncore/settings/netsystemtime/settime.cpp
+++ b/noncore/settings/netsystemtime/settime.cpp
@@ -1,501 +1,502 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "settime.h" 21#include "settime.h"
22 22
23#include <qpe/alarmserver.h> 23#include <qpe/alarmserver.h>
24#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25#include <qpe/config.h> 25#include <qpe/config.h>
26#include <qpe/datebookdb.h> 26#include <qpe/datebookdb.h>
27#include <qpe/datebookmonth.h> 27#include <qpe/datebookmonth.h>
28#include <qpe/global.h> 28#include <qpe/global.h>
29#include <qpe/resource.h> 29#include <qpe/resource.h>
30#include <qpe/timeconversion.h> 30#include <qpe/timeconversion.h>
31#include <qpe/tzselect.h> 31#include <qpe/tzselect.h>
32#include <qpe/timestring.h> 32#include <qpe/timestring.h>
33#include <qpe/qpedialog.h> 33#include <qpe/qpedialog.h>
34#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 34#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
35#include <qpe/qcopenvelope_qws.h> 35#include <qpe/qcopenvelope_qws.h>
36#endif 36#endif
37 37
38#include <qbuttongroup.h> 38#include <qbuttongroup.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qradiobutton.h> 42#include <qradiobutton.h>
43#include <qspinbox.h> 43#include <qspinbox.h>
44#include <qtoolbutton.h> 44#include <qtoolbutton.h>
45#include <qwindowsystem_qws.h> 45#include <qwindowsystem_qws.h>
46#include <qcombobox.h> 46#include <qcombobox.h>
47 47
48#include <sys/time.h> 48#include <sys/time.h>
49#include <time.h> 49#include <time.h>
50#include <stdlib.h> 50#include <stdlib.h>
51#include <stdio.h> 51#include <stdio.h>
52 52
53 53
54SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f ) 54SetDateTime::SetDateTime(QWidget *parent, const char *name, WFlags f )
55 : NtpBase( parent, name, f ) 55 : NtpBase( parent, name, f )
56{ 56{
57 // setCaption( tr("Set System Time") ); 57 // setCaption( tr("Set System Time") );
58 58
59// QVBoxLayout *vb = new QVBoxLayout( this, 5 ); 59// QVBoxLayout *vb = new QVBoxLayout( this, 5 );
60 QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 ); 60 QVBoxLayout *vb = new QVBoxLayout( FrameSystemTime, 5 );
61 QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 ); 61 QVBoxLayout *vb2 = new QVBoxLayout( FrameSetTime, 5 );
62 62
63 TextLabelMainPredTime = new QLabel( FrameSystemTime ); 63# TextLabelMainPredTime = new QLabel( FrameSystemTime );
64 vb->addWidget( TextLabelMainPredTime, 1, 0 ); 64# vb->addWidget( TextLabelMainPredTime, 1, 0 );
65 ButtonSetTime = new QPushButton( FrameSystemTime );
66 vb->addWidget( ButtonSetTime, 1, 0 );
67
68 QFrame *hline = new QFrame( FrameSystemTime );
69 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
70 vb->addWidget( hline );
71 65
72 QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" ); 66 QHBoxLayout *hb = new QHBoxLayout( vb, -1, "timezone layout" );
73 67
74 QLabel *lblZone = new QLabel( tr( "Time Zone" ), FrameSystemTime, "timezone label" ); 68 QLabel *lblZone = new QLabel( tr( "Time Zone" ), FrameSystemTime, "timezone label" );
75 lblZone->setMaximumSize( lblZone->sizeHint() ); 69 lblZone->setMaximumSize( lblZone->sizeHint() );
76 hb->addWidget( lblZone ); 70 hb->addWidget( lblZone );
77 71
78 tz = new TimeZoneSelector( FrameSystemTime, "Timezone choices" ); 72 tz = new TimeZoneSelector( FrameSystemTime, "Timezone choices" );
79 tz->setMinimumSize( tz->sizeHint() ); 73 tz->setMinimumSize( tz->sizeHint() );
80 hb->addWidget( tz ); 74 hb->addWidget( tz );
81 75
82 timeButton = new SetTime( FrameSetTime ); 76 timeButton = new SetTime( FrameSetTime );
83 vb2->addWidget( timeButton ); 77 vb2->addWidget( timeButton );
84 78
85 QHBoxLayout *db = new QHBoxLayout( vb2 ); 79 QHBoxLayout *db = new QHBoxLayout( vb2 );
86 QLabel *dateLabel = new QLabel( tr("Date"), FrameSetTime ); 80 QLabel *dateLabel = new QLabel( tr("Date"), FrameSetTime );
87 db->addWidget( dateLabel, 1 ); 81 db->addWidget( dateLabel, 1 );
88 dateButton = new DateButton( TRUE, FrameSetTime ); 82 dateButton = new DateButton( TRUE, FrameSetTime );
89 db->addWidget( dateButton, 2 ); 83 db->addWidget( dateButton, 2 );
90 84
91 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 85 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
92 vb2->addItem( spacer ); 86 vb2->addItem( spacer );
93 87
94 hline = new QFrame( FrameSystemTime ); 88 hline = new QFrame( FrameSystemTime );
95 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 89 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
96 vb->addWidget( hline ); 90 vb->addWidget( hline );
97 91
98 Config config("qpe"); 92 Config config("qpe");
99 config.setGroup( "Time" ); 93 config.setGroup( "Time" );
100 94
101 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 95 QHBoxLayout *hb1 = new QHBoxLayout( vb );
102 96
103 QLabel *l = new QLabel( tr("Time format"), FrameSystemTime ); 97 QLabel *l = new QLabel( tr("Time format"), FrameSystemTime );
104 hb1->addWidget( l, 1 ); 98 hb1->addWidget( l, 1 );
105 99
106 100
107 ampmCombo = new QComboBox( FrameSystemTime ); 101 ampmCombo = new QComboBox( FrameSystemTime );
108 ampmCombo->insertItem( tr("24 hour"), 0 ); 102 ampmCombo->insertItem( tr("24 hour"), 0 );
109 ampmCombo->insertItem( tr("12 hour"), 1 ); 103 ampmCombo->insertItem( tr("12 hour"), 1 );
110 hb1->addWidget( ampmCombo, 2 ); 104 hb1->addWidget( ampmCombo, 2 );
111 105
112 int show12hr = config.readBoolEntry("AMPM") ? 1 : 0; 106 int show12hr = config.readBoolEntry("AMPM") ? 1 : 0;
113 ampmCombo->setCurrentItem( show12hr ); 107 ampmCombo->setCurrentItem( show12hr );
114 timeButton->show12hourTime( show12hr ); 108 timeButton->show12hourTime( show12hr );
115 109
116 connect(ampmCombo, SIGNAL(activated(int)), 110 connect(ampmCombo, SIGNAL(activated(int)),
117 timeButton, SLOT(show12hourTime(int))); 111 timeButton, SLOT(show12hourTime(int)));
118 112
119 113
120 114
121 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 115 QHBoxLayout *hb2 = new QHBoxLayout( vb );
122 l = new QLabel( tr("Weeks start on" ), FrameSystemTime ); 116 l = new QLabel( tr("Weeks start on" ), FrameSystemTime );
123 //l->setAlignment( AlignRight | AlignVCenter ); 117 //l->setAlignment( AlignRight | AlignVCenter );
124 hb2->addWidget( l, 1 ); 118 hb2->addWidget( l, 1 );
125 119
126 weekStartCombo = new QComboBox( FrameSystemTime ); 120 weekStartCombo = new QComboBox( FrameSystemTime );
127 weekStartCombo->insertItem( tr("Sunday"), 0 ); 121 weekStartCombo->insertItem( tr("Sunday"), 0 );
128 weekStartCombo->insertItem( tr("Monday"), 1 ); 122 weekStartCombo->insertItem( tr("Monday"), 1 );
129 123
130 hb2->addWidget( weekStartCombo, 2 ); 124 hb2->addWidget( weekStartCombo, 2 );
131 int startMonday = config.readBoolEntry("MONDAY") ? 1 : 0; 125 int startMonday = config.readBoolEntry("MONDAY") ? 1 : 0;
132 dateButton->setWeekStartsMonday( startMonday ); 126 dateButton->setWeekStartsMonday( startMonday );
133 weekStartCombo->setCurrentItem( startMonday ); 127 weekStartCombo->setCurrentItem( startMonday );
134 128
135 connect( weekStartCombo, SIGNAL( activated(int)), 129 connect( weekStartCombo, SIGNAL( activated(int)),
136 dateButton, SLOT(setWeekStartsMonday(int))); 130 dateButton, SLOT(setWeekStartsMonday(int)));
137 131
138 132
139 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 133 QHBoxLayout *hb3 = new QHBoxLayout( vb );
140 l = new QLabel( tr("Date format" ), FrameSystemTime ); 134 l = new QLabel( tr("Date format" ), FrameSystemTime );
141 hb3->addWidget( l, 1 ); 135 hb3->addWidget( l, 1 );
142 dateFormatCombo = new QComboBox( FrameSystemTime ); 136 dateFormatCombo = new QComboBox( FrameSystemTime );
143 hb3->addWidget( dateFormatCombo, 2 ); 137 hb3->addWidget( dateFormatCombo, 2 );
144 138
145 config.setGroup( "Date" ); 139 config.setGroup( "Date" );
146 DateFormat df(QChar(config.readEntry("Separator", "/")[0]), 140 DateFormat df(QChar(config.readEntry("Separator", "/")[0]),
147 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear), 141 (DateFormat::Order)config .readNumEntry("ShortOrder", DateFormat::DayMonthYear),
148 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear)); 142 (DateFormat::Order)config.readNumEntry("LongOrder", DateFormat::DayMonthYear));
149 143
150 int currentdf = 0; 144 int currentdf = 0;
151 date_formats[0] = DateFormat('/', DateFormat::MonthDayYear); 145 date_formats[0] = DateFormat('/', DateFormat::MonthDayYear);
152 dateFormatCombo->insertItem( tr( date_formats[0].toNumberString()) ); 146 dateFormatCombo->insertItem( tr( date_formats[0].toNumberString()) );
153 date_formats[1] = DateFormat('.', DateFormat::DayMonthYear); 147 date_formats[1] = DateFormat('.', DateFormat::DayMonthYear);
154 if (df == date_formats[1]) 148 if (df == date_formats[1])
155 currentdf = 1; 149 currentdf = 1;
156 dateFormatCombo->insertItem( tr( date_formats[1].toNumberString() ) ); 150 dateFormatCombo->insertItem( tr( date_formats[1].toNumberString() ) );
157 date_formats[2] = DateFormat('-', DateFormat::YearMonthDay, 151 date_formats[2] = DateFormat('-', DateFormat::YearMonthDay,
158 DateFormat::DayMonthYear); 152 DateFormat::DayMonthYear);
159 if (df == date_formats[2]) 153 if (df == date_formats[2])
160 currentdf = 2; 154 currentdf = 2;
161 dateFormatCombo->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601 155 dateFormatCombo->insertItem( tr( date_formats[2].toNumberString() ) ); //ISO8601
162 date_formats[3] = DateFormat('/', DateFormat::DayMonthYear); 156 date_formats[3] = DateFormat('/', DateFormat::DayMonthYear);
163 if (df == date_formats[3]) 157 if (df == date_formats[3])
164 currentdf = 3; 158 currentdf = 3;
165 dateFormatCombo->insertItem( tr( date_formats[3].toNumberString() ) ); 159 dateFormatCombo->insertItem( tr( date_formats[3].toNumberString() ) );
166 160
167 dateFormatCombo->setCurrentItem( currentdf ); 161 dateFormatCombo->setCurrentItem( currentdf );
168 dateButton->setDateFormat( df ); 162 dateButton->setDateFormat( df );
169 163
170 connect( dateFormatCombo, SIGNAL( activated(int)), 164 connect( dateFormatCombo, SIGNAL( activated(int)),
171 SLOT(formatChanged(int))); 165 SLOT(formatChanged(int)));
172 166
173 QHBoxLayout *hb4 = new QHBoxLayout( vb ); 167 QHBoxLayout *hb4 = new QHBoxLayout( vb );
174 l = new QLabel( tr("Applet format" ), FrameSystemTime ); 168 l = new QLabel( tr("Applet format" ), FrameSystemTime );
175 hb4->addWidget( l, 1 ); 169 hb4->addWidget( l, 1 );
176 170
177 clockAppletCombo = new QComboBox( FrameSystemTime ); 171 clockAppletCombo = new QComboBox( FrameSystemTime );
178 clockAppletCombo->insertItem( tr("hh:mm"), 0 ); 172 clockAppletCombo->insertItem( tr("hh:mm"), 0 );
179 clockAppletCombo->insertItem( tr("D/M hh:mm"), 1 ); 173 clockAppletCombo->insertItem( tr("D/M hh:mm"), 1 );
180 clockAppletCombo->insertItem( tr("M/D hh:mm"), 2 ); 174 clockAppletCombo->insertItem( tr("M/D hh:mm"), 2 );
181 175
182 hb4->addWidget( clockAppletCombo, 2 ); 176 hb4->addWidget( clockAppletCombo, 2 );
183 int clockApplet = config.readNumEntry("ClockApplet",0); 177 int clockApplet = config.readNumEntry("ClockApplet",0);
184 clockAppletCombo->setCurrentItem( clockApplet ); 178 clockAppletCombo->setCurrentItem( clockApplet );
185 179
186 vb->addStretch( 0 ); 180 vb->addStretch( 0 );
187 181
182 QFrame *hline = new QFrame( FrameSystemTime );
183 hline->setFrameStyle( QFrame::HLine | QFrame::Sunken );
184 vb->addWidget( hline );
185
186 ButtonSetTime = new QPushButton( FrameSystemTime );
187 vb->addWidget( ButtonSetTime, 1, 0 );
188
188 QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()), 189 QObject::connect( PushButtonSetManualTime, SIGNAL(clicked()),
189 this, SLOT(commitTime())); 190 this, SLOT(commitTime()));
190 191
191 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), 192 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ),
192 timeButton, SLOT( slotTzChange( const QString& ) ) ); 193 timeButton, SLOT( slotTzChange( const QString& ) ) );
193 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ), 194 QObject::connect( tz, SIGNAL( signalNewTz( const QString& ) ),
194 SLOT( tzChange( const QString& ) ) ); 195 SLOT( tzChange( const QString& ) ) );
195 196
196 QObject::connect( weekStartCombo, SIGNAL( activated ( int )), 197 QObject::connect( weekStartCombo, SIGNAL( activated ( int )),
197 SLOT(updateSystem(int ) )); 198 SLOT(updateSystem(int ) ));
198 QObject::connect( ampmCombo, SIGNAL( activated ( int )), 199 QObject::connect( ampmCombo, SIGNAL( activated ( int )),
199 SLOT(updateSystem(int ) )); 200 SLOT(updateSystem(int ) ));
200 QObject::connect( dateFormatCombo, SIGNAL( activated ( int )), 201 QObject::connect( dateFormatCombo, SIGNAL( activated ( int )),
201 SLOT(updateSystem(int ) )); 202 SLOT(updateSystem(int ) ));
202 QObject::connect( clockAppletCombo, SIGNAL( activated ( int )), 203 QObject::connect( clockAppletCombo, SIGNAL( activated ( int )),
203 SLOT(updateSystem(int ) )); 204 SLOT(updateSystem(int ) ));
204} 205}
205 206
206SetDateTime::~SetDateTime() 207SetDateTime::~SetDateTime()
207{ 208{
208 writeSettings(); 209 writeSettings();
209 210
210} 211}
211 212
212void SetDateTime::writeSettings() 213void SetDateTime::writeSettings()
213{ 214{
214 Config config("qpe"); 215 Config config("qpe");
215 config.setGroup( "Time" ); 216 config.setGroup( "Time" );
216 config.writeEntry( "AMPM", ampmCombo->currentItem() ); 217 config.writeEntry( "AMPM", ampmCombo->currentItem() );
217 config.writeEntry( "MONDAY", weekStartCombo->currentItem() ); 218 config.writeEntry( "MONDAY", weekStartCombo->currentItem() );
218 config.setGroup( "Date" ); 219 config.setGroup( "Date" );
219 DateFormat df = date_formats[dateFormatCombo->currentItem()]; 220 DateFormat df = date_formats[dateFormatCombo->currentItem()];
220 config.writeEntry( "Separator", QString(df.separator())); 221 config.writeEntry( "Separator", QString(df.separator()));
221 config.writeEntry( "ShortOrder", df.shortOrder()); 222 config.writeEntry( "ShortOrder", df.shortOrder());
222 config.writeEntry( "LongOrder", df.longOrder()); 223 config.writeEntry( "LongOrder", df.longOrder());
223 config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() ); 224 config.writeEntry( "ClockApplet", clockAppletCombo->currentItem() );
224 225
225 Config lconfig("locale"); 226 Config lconfig("locale");
226 lconfig.setGroup( "Location" ); 227 lconfig.setGroup( "Location" );
227 lconfig.writeEntry( "Timezone", tz->currentZone() ); 228 lconfig.writeEntry( "Timezone", tz->currentZone() );
228 229
229} 230}
230 231
231void SetDateTime::commitTime() 232void SetDateTime::commitTime()
232{ 233{
233 Config cfg("ntp",Config::User); 234 Config cfg("ntp",Config::User);
234 cfg.setGroup("lookups"); 235 cfg.setGroup("lookups");
235 cfg.writeEntry("lastNtp",false); 236 cfg.writeEntry("lastNtp",false);
236 tz->setFocus(); 237 tz->setFocus();
237 // Need to process the QCOP event generated above before proceeding 238 // Need to process the QCOP event generated above before proceeding
238 qApp->processEvents(); 239 qApp->processEvents();
239 240
240 // before we progress further, set our TZ! 241 // before we progress further, set our TZ!
241 setenv( "TZ", tz->currentZone(), 1 ); 242 setenv( "TZ", tz->currentZone(), 1 );
242 // now set the time... 243 // now set the time...
243 QDateTime dt( dateButton->date(), timeButton->time() ); 244 QDateTime dt( dateButton->date(), timeButton->time() );
244 245
245 if ( dt.isValid() ) setTime(dt); 246 if ( dt.isValid() ) setTime(dt);
246} 247}
247 248
248void SetDateTime::setTime(QDateTime dt) 249void SetDateTime::setTime(QDateTime dt)
249{ 250{
250 // really turn off the screensaver before doing anything 251 // really turn off the screensaver before doing anything
251 { 252 {
252 // Needs to be encased in { } so that it deconstructs and sends 253 // Needs to be encased in { } so that it deconstructs and sends
253 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 254 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
254 disableScreenSaver << 0 << 0 << 0; 255 disableScreenSaver << 0 << 0 << 0;
255 } 256 }
256 Config cfg("ntp",Config::User); 257 Config cfg("ntp",Config::User);
257 cfg.setGroup("correction"); 258 cfg.setGroup("correction");
258 int t = TimeConversion::toUTC(dt); 259 int t = TimeConversion::toUTC(dt);
259 struct timeval myTv; 260 struct timeval myTv;
260 myTv.tv_sec = t; 261 myTv.tv_sec = t;
261 cfg.writeEntry("time", t ); 262 cfg.writeEntry("time", t );
262 myTv.tv_usec = 0; 263 myTv.tv_usec = 0;
263 264
264 if ( myTv.tv_sec != -1 ) 265 if ( myTv.tv_sec != -1 )
265 ::settimeofday( &myTv, 0 ); 266 ::settimeofday( &myTv, 0 );
266 Global::writeHWClock(); 267 Global::writeHWClock();
267 // since time has changed quickly load in the datebookdb 268 // since time has changed quickly load in the datebookdb
268 // to allow the alarm server to get a better grip on itself 269 // to allow the alarm server to get a better grip on itself
269 // (example re-trigger alarms for when we travel back in time) 270 // (example re-trigger alarms for when we travel back in time)
270 DateBookDB db; 271 DateBookDB db;
271 //QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" ); 272 //QCopEnvelope timeApplet( "QPE/TaskBar", "reloadApplets()" );
272 //timeApplet << ""; 273 //timeApplet << "";
273 // Restore screensaver 274 // Restore screensaver
274 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 275 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
275 enableScreenSaver << -1 << -1 << -1; 276 enableScreenSaver << -1 << -1 << -1;
276} 277}
277 278
278void SetDateTime::updateSystem(int i) 279void SetDateTime::updateSystem(int i)
279{ 280{
280 // really turn off the screensaver before doing anything 281 // really turn off the screensaver before doing anything
281 { 282 {
282 // Needs to be encased in { } so that it deconstructs and sends 283 // Needs to be encased in { } so that it deconstructs and sends
283 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 284 QCopEnvelope disableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
284 disableScreenSaver << 0 << 0 << 0; 285 disableScreenSaver << 0 << 0 << 0;
285 } 286 }
286 qDebug("SetDateTime::updateSystem(int %i)",i); 287 qDebug("SetDateTime::updateSystem(int %i)",i);
287 writeSettings(); 288 writeSettings();
288 289
289 // set the timezone for everyone else... 290 // set the timezone for everyone else...
290 QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" ); 291 QCopEnvelope setTimeZone( "QPE/System", "timeChange(QString)" );
291 setTimeZone << tz->currentZone(); 292 setTimeZone << tz->currentZone();
292 293
293 // AM/PM setting and notify time changed 294 // AM/PM setting and notify time changed
294 QCopEnvelope setClock( "QPE/System", "clockChange(bool)" ); 295 QCopEnvelope setClock( "QPE/System", "clockChange(bool)" );
295 setClock << ampmCombo->currentItem(); 296 setClock << ampmCombo->currentItem();
296 297
297 // Notify everyone what day we prefer to start the week on. 298 // Notify everyone what day we prefer to start the week on.
298 QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" ); 299 QCopEnvelope setWeek( "QPE/System", "weekChange(bool)" );
299 setWeek << weekStartCombo->currentItem(); 300 setWeek << weekStartCombo->currentItem();
300 301
301 // Notify everyone what date format to use 302 // Notify everyone what date format to use
302 QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" ); 303 QCopEnvelope setDateFormat( "QPE/System", "setDateFormat(DateFormat)" );
303 setDateFormat << date_formats[dateFormatCombo->currentItem()]; 304 setDateFormat << date_formats[dateFormatCombo->currentItem()];
304 305
305 // Restore screensaver 306 // Restore screensaver
306 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" ); 307 QCopEnvelope enableScreenSaver( "QPE/System", "setScreenSaverIntervals(int,int,int)" );
307 enableScreenSaver << -1 << -1 << -1; 308 enableScreenSaver << -1 << -1 << -1;
308 // since time has changed quickly load in the datebookdb 309 // since time has changed quickly load in the datebookdb
309 // to allow the alarm server to get a better grip on itself 310 // to allow the alarm server to get a better grip on itself
310 // (example re-trigger alarms for when we travel back in time) 311 // (example re-trigger alarms for when we travel back in time)
311 DateBookDB db; 312 DateBookDB db;
312 313
313} 314}
314 315
315void SetDateTime::tzChange( const QString &tz ) 316void SetDateTime::tzChange( const QString &tz )
316{ 317{
317 // set the TZ get the time and leave gracefully... 318 // set the TZ get the time and leave gracefully...
318 QString strSave; 319 QString strSave;
319 strSave = getenv( "TZ" ); 320 strSave = getenv( "TZ" );
320 setenv( "TZ", tz, 1 ); 321 setenv( "TZ", tz, 1 );
321 322
322 QDate d = QDate::currentDate(); 323 QDate d = QDate::currentDate();
323 // reset the time. 324 // reset the time.
324 if ( !strSave.isNull() ) { 325 if ( !strSave.isNull() ) {
325 setenv( "TZ", strSave, 1 ); 326 setenv( "TZ", strSave, 1 );
326 } 327 }
327 dateButton->setDate( d ); 328 dateButton->setDate( d );
328 updateSystem(); 329 updateSystem();
329} 330}
330 331
331void SetDateTime::formatChanged(int i) 332void SetDateTime::formatChanged(int i)
332{ 333{
333 dateButton->setDateFormat(date_formats[i]); 334 dateButton->setDateFormat(date_formats[i]);
334} 335}
335 336
336static const int ValueAM = 0; 337static const int ValueAM = 0;
337static const int ValuePM = 1; 338static const int ValuePM = 1;
338 339
339 340
340 341
341SetTime::SetTime( QWidget *parent, const char *name ) 342SetTime::SetTime( QWidget *parent, const char *name )
342 : QWidget( parent, name ) 343 : QWidget( parent, name )
343{ 344{
344 use12hourTime = FALSE; 345 use12hourTime = FALSE;
345 346
346 QTime currTime = QTime::currentTime(); 347 QTime currTime = QTime::currentTime();
347 hour = currTime.hour(); 348 hour = currTime.hour();
348 minute = currTime.minute(); 349 minute = currTime.minute();
349 350
350 QHBoxLayout *hb2 = new QHBoxLayout( this ); 351 QHBoxLayout *hb2 = new QHBoxLayout( this );
351 hb2->setSpacing( 3 ); 352 hb2->setSpacing( 3 );
352 353
353 QLabel *l = new QLabel( tr("Hour"), this ); 354 QLabel *l = new QLabel( tr("Hour"), this );
354 // l->setAlignment( AlignRight | AlignVCenter ); 355 // l->setAlignment( AlignRight | AlignVCenter );
355 hb2->addWidget( l ); 356 hb2->addWidget( l );
356 357
357 sbHour = new QSpinBox( this ); 358 sbHour = new QSpinBox( this );
358 sbHour->setMinimumWidth( 30 ); 359 sbHour->setMinimumWidth( 30 );
359 if(use12hourTime) { 360 if(use12hourTime) {
360 sbHour->setMinValue(1); 361 sbHour->setMinValue(1);
361 sbHour->setMaxValue( 12 ); 362 sbHour->setMaxValue( 12 );
362 int show_hour = hour; 363 int show_hour = hour;
363 if (hour > 12) 364 if (hour > 12)
364 show_hour -= 12; 365 show_hour -= 12;
365 if (show_hour == 0) 366 if (show_hour == 0)
366 show_hour = 12; 367 show_hour = 12;
367 368
368 sbHour->setValue( show_hour ); 369 sbHour->setValue( show_hour );
369 } else { 370 } else {
370 sbHour->setMinValue( 0 ); 371 sbHour->setMinValue( 0 );
371 sbHour->setMaxValue( 23 ); 372 sbHour->setMaxValue( 23 );
372 sbHour->setValue( hour ); 373 sbHour->setValue( hour );
373 } 374 }
374 sbHour->setWrapping(TRUE); 375 sbHour->setWrapping(TRUE);
375 connect( sbHour, SIGNAL(valueChanged(int)), this, SLOT(hourChanged(int)) ); 376 connect( sbHour, SIGNAL(valueChanged(int)), this, SLOT(hourChanged(int)) );
376 hb2->addWidget( sbHour ); 377 hb2->addWidget( sbHour );
377 378
378 hb2->addStretch( 1 ); 379 hb2->addStretch( 1 );
379 380
380 l = new QLabel( tr("Minute"), this ); 381 l = new QLabel( tr("Minute"), this );
381 //l->setAlignment( AlignRight | AlignVCenter ); 382 //l->setAlignment( AlignRight | AlignVCenter );
382 hb2->addWidget( l ); 383 hb2->addWidget( l );
383 384
384 sbMin = new QSpinBox( this ); 385 sbMin = new QSpinBox( this );
385 sbMin->setMinValue( 0 ); 386 sbMin->setMinValue( 0 );
386 sbMin->setMaxValue( 59 ); 387 sbMin->setMaxValue( 59 );
387 sbMin->setWrapping(TRUE); 388 sbMin->setWrapping(TRUE);
388 sbMin->setValue( minute ); 389 sbMin->setValue( minute );
389 sbMin->setMinimumWidth( 30 ); 390 sbMin->setMinimumWidth( 30 );
390 connect( sbMin, SIGNAL(valueChanged(int)), this, SLOT(minuteChanged(int)) ); 391 connect( sbMin, SIGNAL(valueChanged(int)), this, SLOT(minuteChanged(int)) );
391 hb2->addWidget( sbMin ); 392 hb2->addWidget( sbMin );
392 393
393 hb2->addStretch( 1 ); 394 hb2->addStretch( 1 );
394 395
395 ampm = new QComboBox( this ); 396 ampm = new QComboBox( this );
396 ampm->insertItem( tr("AM"), ValueAM ); 397 ampm->insertItem( tr("AM"), ValueAM );
397 ampm->insertItem( tr("PM"), ValuePM ); 398 ampm->insertItem( tr("PM"), ValuePM );
398 connect( ampm, SIGNAL(activated(int)), this, SLOT(checkedPM(int)) ); 399 connect( ampm, SIGNAL(activated(int)), this, SLOT(checkedPM(int)) );
399 hb2->addWidget( ampm ); 400 hb2->addWidget( ampm );
400 401
401 hb2->addStretch( 1 ); 402 hb2->addStretch( 1 );
402 403
403} 404}
404 405
405QTime SetTime::time() const 406QTime SetTime::time() const
406{ 407{
407 return QTime( hour, minute, 0 ); 408 return QTime( hour, minute, 0 );
408} 409}
409 410
410void SetTime::hourChanged( int value ) 411void SetTime::hourChanged( int value )
411{ 412{
412 if(use12hourTime) { 413 if(use12hourTime) {
413 int realhour = value; 414 int realhour = value;
414 if (realhour == 12) 415 if (realhour == 12)
415 realhour = 0; 416 realhour = 0;
416 if (ampm->currentItem() == ValuePM ) 417 if (ampm->currentItem() == ValuePM )
417 realhour += 12; 418 realhour += 12;
418 hour = realhour; 419 hour = realhour;
419 } else 420 } else
420 hour = value; 421 hour = value;
421} 422}
422 423
423void SetTime::minuteChanged( int value ) 424void SetTime::minuteChanged( int value )
424{ 425{
425 minute = value; 426 minute = value;
426} 427}
427 428
428void SetTime::show12hourTime( int on ) 429void SetTime::show12hourTime( int on )
429{ 430{
430 use12hourTime = on; 431 use12hourTime = on;
431 ampm->setEnabled(on); 432 ampm->setEnabled(on);
432 433
433 int show_hour = hour; 434 int show_hour = hour;
434 if ( on ) { 435 if ( on ) {
435 /* this might change the value of hour */ 436 /* this might change the value of hour */
436 sbHour->setMinValue(1); 437 sbHour->setMinValue(1);
437 sbHour->setMaxValue( 12 ); 438 sbHour->setMaxValue( 12 );
438 439
439 /* so use one we saved earlier */ 440 /* so use one we saved earlier */
440 if (show_hour >= 12) { 441 if (show_hour >= 12) {
441 show_hour -= 12; 442 show_hour -= 12;
442 ampm->setCurrentItem( ValuePM ); 443 ampm->setCurrentItem( ValuePM );
443 } else { 444 } else {
444 ampm->setCurrentItem( ValueAM ); 445 ampm->setCurrentItem( ValueAM );
445 } 446 }
446 if (show_hour == 0) 447 if (show_hour == 0)
447 show_hour = 12; 448 show_hour = 12;
448 449
449 } else { 450 } else {
450 sbHour->setMinValue( 0 ); 451 sbHour->setMinValue( 0 );
451 sbHour->setMaxValue( 23 ); 452 sbHour->setMaxValue( 23 );
452 } 453 }
453 454
454 455
455 sbHour->setValue( show_hour ); 456 sbHour->setValue( show_hour );
456} 457}
457 458
458void SetTime::checkedPM( int c ) 459void SetTime::checkedPM( int c )
459{ 460{
460 int show_hour = sbHour->value(); 461 int show_hour = sbHour->value();
461 if (show_hour == 12) 462 if (show_hour == 12)
462 show_hour = 0; 463 show_hour = 0;
463 464
464 if ( c == ValuePM ) 465 if ( c == ValuePM )
465 show_hour += 12; 466 show_hour += 12;
466 467
467 hour = show_hour; 468 hour = show_hour;
468} 469}
469 470
470void SetTime::slotTzChange( const QString &tz ) 471void SetTime::slotTzChange( const QString &tz )
471{ 472{
472 // set the TZ get the time and leave gracefully... 473 // set the TZ get the time and leave gracefully...
473 QString strSave; 474 QString strSave;
474 strSave = getenv( "TZ" ); 475 strSave = getenv( "TZ" );
475 setenv( "TZ", tz, 1 ); 476 setenv( "TZ", tz, 1 );
476 477
477 QTime t = QTime::currentTime(); 478 QTime t = QTime::currentTime();
478 // reset the time. 479 // reset the time.
479 if ( !strSave.isNull() ) { 480 if ( !strSave.isNull() ) {
480 setenv( "TZ", strSave, 1 ); 481 setenv( "TZ", strSave, 1 );
481 } 482 }
482 483
483 // just set the spinboxes and let it propage through 484 // just set the spinboxes and let it propage through
484 if(use12hourTime) { 485 if(use12hourTime) {
485 int show_hour = t.hour(); 486 int show_hour = t.hour();
486 if (t.hour() >= 12) { 487 if (t.hour() >= 12) {
487 show_hour -= 12; 488 show_hour -= 12;
488 ampm->setCurrentItem( ValuePM ); 489 ampm->setCurrentItem( ValuePM );
489 } else { 490 } else {
490 ampm->setCurrentItem( ValueAM ); 491 ampm->setCurrentItem( ValueAM );
491 } 492 }
492 if (show_hour == 0) 493 if (show_hour == 0)
493 show_hour = 12; 494 show_hour = 12;
494 sbHour->setValue( show_hour ); 495 sbHour->setValue( show_hour );
495 } else { 496 } else {
496 sbHour->setValue( t.hour() ); 497 sbHour->setValue( t.hour() );
497 } 498 }
498 sbMin->setValue( t.minute() ); 499 sbMin->setValue( t.minute() );
499} 500}
500 501
501 502