|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Implementation file for class ClockSettingsView. |
|
16 * |
|
17 */ |
|
18 |
|
19 // System includes |
|
20 #include <QDebug> |
|
21 #include <HbInstance> |
|
22 #include <HbDataForm> |
|
23 #include <HbAction> |
|
24 #include <HbDataFormModel> |
|
25 #include <HbDataFormModelItem> |
|
26 #include <HbLabel> |
|
27 #include <HbPushButton> |
|
28 #include <HbCheckBox> |
|
29 #include <HbApplication> |
|
30 #include <QTranslator> |
|
31 |
|
32 // User includes |
|
33 #include "clocksettingsview.h" |
|
34 #include "clocksettingsdefines.h" |
|
35 #include "clocksettingsdocloader.h" |
|
36 #include "settingsutility.h" |
|
37 #include "timezoneclient.h" |
|
38 #include "skinnableclock.h" |
|
39 #include "settingsdatatypes.h" |
|
40 #include "settingscustomitem.h" |
|
41 |
|
42 /*! |
|
43 \class ClockSettingsView |
|
44 |
|
45 This implements the clock settings which allows user to set the |
|
46 date, time, location and other related parameters. |
|
47 */ |
|
48 |
|
49 /*! |
|
50 Constructor. |
|
51 |
|
52 \param parent The parent of type QGraphicsWidget. |
|
53 */ |
|
54 ClockSettingsView::ClockSettingsView(QObject *parent) |
|
55 :QObject(parent) |
|
56 { |
|
57 qDebug("clock: ClockSettingsView::ClockSettingsView() -->"); |
|
58 |
|
59 // Load the translation file and install the editor specific translator |
|
60 mTranslator = new QTranslator; |
|
61 //QString lang = QLocale::system().name(); |
|
62 //QString path = "Z:/resource/qt/translations/"; |
|
63 mTranslator->load("clocksettingsview",":/translations"); |
|
64 // TODO: Load the appropriate .qm file based on locale |
|
65 //bool loaded = mTranslator->load("caleneditor_" + lang, path); |
|
66 HbApplication::instance()->installTranslator(mTranslator); |
|
67 |
|
68 // Construct the settings utility. |
|
69 mSettingsUtility = new SettingsUtility(); |
|
70 |
|
71 // Construct the timezone client. |
|
72 mTimezoneClient = new TimezoneClient(); |
|
73 connect( |
|
74 mTimezoneClient, SIGNAL(timechanged()), |
|
75 this, SLOT(updatePlaceLabel())); |
|
76 connect( |
|
77 mTimezoneClient, SIGNAL(timechanged()), |
|
78 this, SLOT(updateDateLabel())); |
|
79 connect( |
|
80 mTimezoneClient, SIGNAL(timechanged()), |
|
81 this, SLOT(updateClockWidget())); |
|
82 connect( |
|
83 mTimezoneClient, SIGNAL(timechanged()), |
|
84 this, SLOT(updatePlaceItem())); |
|
85 connect( |
|
86 mTimezoneClient, SIGNAL(timechanged()), |
|
87 this, SLOT(updateDateItem())); |
|
88 connect( |
|
89 mTimezoneClient, SIGNAL(timechanged()), |
|
90 this, SLOT(updateTimeItem())); |
|
91 |
|
92 // Start a timer. For updating the remaining alarm time. |
|
93 mTickTimer = new QTimer(this); |
|
94 connect( |
|
95 mTickTimer, SIGNAL(timeout()), |
|
96 this, SLOT(updateTimeItem())); |
|
97 |
|
98 qDebug("clock: ClockSettingsView::ClockSettingsView() <--"); |
|
99 } |
|
100 |
|
101 /*! |
|
102 Destructor. |
|
103 */ |
|
104 ClockSettingsView::~ClockSettingsView() |
|
105 { |
|
106 qDebug("clock: ClockSettingsView::~ClockSettingsView() -->"); |
|
107 |
|
108 if (mDocLoader) { |
|
109 delete mDocLoader; |
|
110 } |
|
111 |
|
112 // Remove the translator |
|
113 HbApplication::instance()->removeTranslator(mTranslator); |
|
114 if (mTranslator) { |
|
115 delete mTranslator; |
|
116 mTranslator = 0; |
|
117 } |
|
118 |
|
119 qDebug("clock: ClockSettingsView::~ClockSettingsView() <--"); |
|
120 } |
|
121 |
|
122 /*! |
|
123 Loads the settings view from the docml. |
|
124 */ |
|
125 void ClockSettingsView::loadSettingsView() |
|
126 { |
|
127 qDebug() << "clock: ClockViewManager::loadMainView -->"; |
|
128 |
|
129 bool loadSuccess; |
|
130 |
|
131 // Construct the document loader instance |
|
132 mDocLoader = new ClockSettingsDocLoader(); |
|
133 |
|
134 // Load the application xml. |
|
135 mDocLoader->load(CLOCK_SETTINGS_VIEW_DOCML, &loadSuccess); |
|
136 |
|
137 // Load the correct section based on orientation. |
|
138 HbMainWindow *window = hbInstance->allMainWindows().first(); |
|
139 Qt::Orientation currentOrientation = window->orientation(); |
|
140 |
|
141 if (Qt::Vertical == currentOrientation) { |
|
142 // Load portrait section. |
|
143 mDocLoader->load( |
|
144 CLOCK_SETTINGS_VIEW_DOCML, |
|
145 CLOCK_SETTINGS_VIEW_PORTRAIT_SECTION, |
|
146 &loadSuccess); |
|
147 } else { |
|
148 // Load landscape section. |
|
149 mDocLoader->load( |
|
150 CLOCK_SETTINGS_VIEW_DOCML, |
|
151 CLOCK_SETTINGS_VIEW_LANDSCAPE_SECTION, |
|
152 &loadSuccess); |
|
153 } |
|
154 |
|
155 // Connect the required signals. |
|
156 connect( |
|
157 window, SIGNAL(orientationChanged(Qt::Orientation)), |
|
158 this, SLOT(handleOrientationChanged(Qt::Orientation))); |
|
159 |
|
160 // Find the main view. |
|
161 mSettingsView = static_cast<HbView *> ( |
|
162 mDocLoader->findWidget(CLOCK_SETTINGS_VIEW)); |
|
163 |
|
164 // Setup the view. |
|
165 setupView(); |
|
166 |
|
167 qDebug() << "clock: ClockViewManager::loadMainView <--"; |
|
168 } |
|
169 |
|
170 /*! |
|
171 Slot to handle the back action of the view. |
|
172 */ |
|
173 void ClockSettingsView::handleBackAction() |
|
174 { |
|
175 HbMainWindow *window = hbInstance->allMainWindows().first(); |
|
176 window->removeView(mSettingsView); |
|
177 deleteLater(); |
|
178 } |
|
179 |
|
180 /*! |
|
181 Updates the day and date in the day label. |
|
182 */ |
|
183 void ClockSettingsView::updateDateLabel() |
|
184 { |
|
185 qDebug() << "clock: ClockSettingsView::updateDateLabel -->"; |
|
186 |
|
187 // Get the current datetime. |
|
188 QDateTime dateTime = QDateTime::currentDateTime(); |
|
189 // Get the day name. |
|
190 QString dayName = dateTime.toString("dddd"); |
|
191 // Get the date in correct format. |
|
192 QString currentDate = mSettingsUtility->date(); |
|
193 // Construct the day + date string. |
|
194 QString dayDateString; |
|
195 dayDateString+= dayName; |
|
196 dayDateString += " "; |
|
197 dayDateString += currentDate; |
|
198 |
|
199 mDayDateLabel->clear(); |
|
200 mDayDateLabel->setPlainText(dayDateString); |
|
201 |
|
202 qDebug() << "clock: ClockSettingsView::updateDateLabel <--"; |
|
203 } |
|
204 |
|
205 /*! |
|
206 Updates the zone info in the place label. |
|
207 */ |
|
208 void ClockSettingsView::updatePlaceLabel() |
|
209 { |
|
210 qDebug() << "clock: ClockSettingsView::updateClockZoneInfo -->"; |
|
211 |
|
212 // Get the current zone info. |
|
213 LocationInfo currentZoneInfo = mTimezoneClient->getCurrentZoneInfoL(); |
|
214 |
|
215 // Construct the GMT +/- X string. |
|
216 QString gmtOffset; |
|
217 |
|
218 int utcOffset = currentZoneInfo.zoneOffset; |
|
219 int offsetInHours (utcOffset/60); |
|
220 int offsetInMinutes (utcOffset%60); |
|
221 |
|
222 // Check wether the offset is +ve or -ve. |
|
223 if (0 < utcOffset) { |
|
224 // We have a positive offset. Append the '+' character. |
|
225 gmtOffset += tr(" +"); |
|
226 } else if (0 > utcOffset) { |
|
227 // We have a negative offset. Append the '-' character. |
|
228 gmtOffset += tr(" -"); |
|
229 offsetInHours = -offsetInHours; |
|
230 } else { |
|
231 // We dont have an offset. We are at GMT zone. |
|
232 } |
|
233 |
|
234 // Append the hour component. |
|
235 gmtOffset += QString::number(offsetInHours); |
|
236 |
|
237 // Get the time separator from settings and append it. |
|
238 QStringList timeSeparatorList; |
|
239 int index = mSettingsUtility->timeSeparator(timeSeparatorList); |
|
240 gmtOffset += timeSeparatorList.at(index); |
|
241 |
|
242 // Append the minute component. |
|
243 // If minute component is less less than 10, append a '00' |
|
244 if (0 <= offsetInMinutes && offsetInMinutes < 10) { |
|
245 gmtOffset += tr("00"); |
|
246 } else { |
|
247 gmtOffset += QString::number(offsetInMinutes); |
|
248 } |
|
249 |
|
250 gmtOffset += tr(" GMT "); |
|
251 |
|
252 // Append DST info. |
|
253 if (currentZoneInfo.dstOn) { |
|
254 gmtOffset += tr(" DST"); |
|
255 } |
|
256 |
|
257 // Update the labels with the correct info. |
|
258 mPlaceLabel->clear(); |
|
259 if (mTimezoneClient->timeUpdateOn()) { |
|
260 mPlaceLabel->setPlainText( |
|
261 currentZoneInfo.countryName + tr(" ") + gmtOffset); |
|
262 } else { |
|
263 mPlaceLabel->setPlainText( |
|
264 currentZoneInfo.cityName + tr(", ") |
|
265 + currentZoneInfo.countryName + tr(" ") + gmtOffset); |
|
266 } |
|
267 |
|
268 qDebug() << "clock: ClockSettingsView::updateDayDateInfo <--"; |
|
269 } |
|
270 |
|
271 /*! |
|
272 Updates the clock widget display. |
|
273 */ |
|
274 void ClockSettingsView::updateClockWidget() |
|
275 { |
|
276 qDebug() << "clock: ClockSettingsView::updateClockWidget -->"; |
|
277 |
|
278 mClockWidget->updateDisplay(true); |
|
279 |
|
280 qDebug() << "clock: ClockSettingsView::updateClockWidget <--"; |
|
281 } |
|
282 |
|
283 /*! |
|
284 Slot which connects to the itemShown signal of the data form. |
|
285 */ |
|
286 void ClockSettingsView::formItemDisplayed(const QModelIndex &index) |
|
287 { |
|
288 qDebug() << "clock: ClockSettingsView::settingItemDisplayed -->"; |
|
289 |
|
290 // In this function implement only display updation. |
|
291 // DO NOT connect slots here. |
|
292 |
|
293 bool timeUpdateValue = mTimezoneClient->timeUpdateOn(); |
|
294 |
|
295 // Get the form item. |
|
296 HbDataFormViewItem *item = |
|
297 static_cast<HbDataFormViewItem*>(mSettingsForm->itemByIndex(index)); |
|
298 HbWidget *contentWidget = item->dataItemContentWidget(); |
|
299 |
|
300 switch (index.row()) { |
|
301 case NetworkTimeItem: |
|
302 { |
|
303 mNetworkTimeWidget = static_cast<HbCheckBox *>(contentWidget); |
|
304 /*if (timeUpdateValue) { |
|
305 mNetworkTimeWidget->setCheckState(Qt::Checked); |
|
306 } else { |
|
307 mNetworkTimeWidget->setCheckState(Qt::Unchecked); |
|
308 }*/ |
|
309 } |
|
310 break; |
|
311 case TimeItem: |
|
312 { |
|
313 |
|
314 } |
|
315 break; |
|
316 |
|
317 case DateItem: |
|
318 { |
|
319 // Update the item display. |
|
320 |
|
321 } |
|
322 break; |
|
323 |
|
324 case PlaceItem: |
|
325 { |
|
326 // Update the item display. |
|
327 // mPlaceWidget = static_cast<HbPushButton *>(contentWidget); |
|
328 // Get the current zone info. |
|
329 updatePlaceLabel(); |
|
330 |
|
331 |
|
332 } |
|
333 break; |
|
334 |
|
335 default: |
|
336 break; |
|
337 } |
|
338 |
|
339 qDebug() << "clock: ClockSettingsView::settingItemDisplayed <--"; |
|
340 } |
|
341 |
|
342 /*! |
|
343 Slot which connects to the dataChanged signal of the data form. |
|
344 */ |
|
345 void ClockSettingsView::formItemValueChanged( |
|
346 const QModelIndex& topLeft, const QModelIndex& bottomRight) |
|
347 { |
|
348 qDebug("clock: ClockSettingsView::formItemValueChanged() -->"); |
|
349 |
|
350 Q_UNUSED(bottomRight) |
|
351 // Get the form item. |
|
352 HbDataFormViewItem *item = |
|
353 static_cast<HbDataFormViewItem*>( |
|
354 mSettingsForm->itemByIndex(topLeft)); |
|
355 HbWidget *contentWidget = item->dataItemContentWidget(); |
|
356 |
|
357 |
|
358 switch (topLeft.row()) { |
|
359 case NetworkTimeItem: |
|
360 { |
|
361 Qt::CheckState state = mNetworkTimeWidget->checkState(); |
|
362 bool cenrepValue = mTimezoneClient->timeUpdateOn(); |
|
363 |
|
364 if ((Qt::Checked == state && !cenrepValue) |
|
365 || (Qt::Unchecked == state && cenrepValue)) { |
|
366 if (Qt::Checked == state) { |
|
367 // Disable the time, date and place item. |
|
368 if (mTimeDataFormItem) { |
|
369 mTimeDataFormItem->setEnabled(false); |
|
370 } |
|
371 if (mDateDataFormItem) { |
|
372 mDateDataFormItem->setEnabled(false); |
|
373 } |
|
374 if (mPlaceDataFormItem) { |
|
375 mPlaceDataFormItem->setEnabled(false); |
|
376 } |
|
377 // Update the cenrep value. |
|
378 mTimezoneClient->setTimeUpdateOn(true); |
|
379 |
|
380 } else if (Qt::Unchecked == state) { |
|
381 // Enable the time, date and place item. |
|
382 if (mTimeDataFormItem) { |
|
383 mTimeDataFormItem->setEnabled(true); |
|
384 } |
|
385 if (mDateDataFormItem) { |
|
386 mDateDataFormItem->setEnabled(true); |
|
387 } |
|
388 if (mPlaceDataFormItem) { |
|
389 mPlaceDataFormItem->setEnabled(true); |
|
390 } |
|
391 |
|
392 // Update the cenrep value. |
|
393 mTimezoneClient->setTimeUpdateOn(false); |
|
394 } |
|
395 |
|
396 updatePlaceItem(); |
|
397 updatePlaceLabel(); |
|
398 } |
|
399 } |
|
400 break; |
|
401 |
|
402 default: |
|
403 break; |
|
404 } |
|
405 |
|
406 |
|
407 qDebug("clock: ClockSettingsView::formItemValueChanged() <--"); |
|
408 } |
|
409 |
|
410 /*! |
|
411 Slot to update the display of the date settings item field. |
|
412 */ |
|
413 void ClockSettingsView::updateDateItem() |
|
414 { |
|
415 mDateDataFormItem->setContentWidgetData("text", mSettingsUtility->date()); |
|
416 } |
|
417 |
|
418 /*! |
|
419 Slot to update the display of the time settings item field. |
|
420 */ |
|
421 void ClockSettingsView::updateTimeItem() |
|
422 { |
|
423 if (!mTickTimer->isActive()) { |
|
424 mTickTimer->stop(); |
|
425 } |
|
426 mTimeDataFormItem->setContentWidgetData("text", mSettingsUtility->time()); |
|
427 |
|
428 // Start the timer again. |
|
429 mTickTimer->start(60000 - 1000 * QTime::currentTime().second()); |
|
430 } |
|
431 |
|
432 /*! |
|
433 Slot to update the display of the place settings item field. |
|
434 */ |
|
435 void ClockSettingsView::updatePlaceItem() |
|
436 { |
|
437 // Get the current zone info. |
|
438 LocationInfo currentZoneInfo = mTimezoneClient->getCurrentZoneInfoL(); |
|
439 QString placeItemText(currentZoneInfo.cityName); |
|
440 placeItemText+= tr(","); |
|
441 placeItemText.append(currentZoneInfo.countryName); |
|
442 mPlaceDataFormItem->setContentWidgetData("text", placeItemText); |
|
443 // mPlaceWidget->setText(placeItemText); |
|
444 } |
|
445 |
|
446 /*! |
|
447 This slot is called whenever orientattion of the view changes. |
|
448 */ |
|
449 void ClockSettingsView::handleOrientationChanged(Qt::Orientation orientation) |
|
450 { |
|
451 qDebug() << "clock: ClockSettingsView::handleOrientationChanged -->"; |
|
452 |
|
453 bool success; |
|
454 // If horizontal, load the landscape section. |
|
455 if (Qt::Horizontal == orientation) { |
|
456 mDocLoader->load( |
|
457 CLOCK_SETTINGS_VIEW_DOCML, |
|
458 CLOCK_SETTINGS_VIEW_LANDSCAPE_SECTION, |
|
459 &success); |
|
460 } else if (Qt::Vertical == orientation) { |
|
461 mDocLoader->load( |
|
462 CLOCK_SETTINGS_VIEW_DOCML, |
|
463 CLOCK_SETTINGS_VIEW_PORTRAIT_SECTION, |
|
464 &success); |
|
465 } |
|
466 |
|
467 qDebug() << "clock: ClockSettingsView::handleOrientationChanged <--"; |
|
468 |
|
469 } |
|
470 |
|
471 /*! |
|
472 Called after loading the view from the docml. |
|
473 The initializaion/setup of the view is done here. |
|
474 |
|
475 \param docLoader Pointer to ClockSettingsDocLoader object. |
|
476 */ |
|
477 void ClockSettingsView::setupView() |
|
478 { |
|
479 qDebug("clock: ClockSettingsView::setupView() -->"); |
|
480 |
|
481 HbMainWindow *window = hbInstance->allMainWindows().first(); |
|
482 window->addView(mSettingsView); |
|
483 window->setCurrentView(mSettingsView); |
|
484 |
|
485 // Add the back softkey. |
|
486 mBackAction = new HbAction(Hb::BackAction); |
|
487 mSettingsView->setNavigationAction(mBackAction); |
|
488 connect( |
|
489 mBackAction, SIGNAL(triggered()), |
|
490 this, SLOT(handleBackAction())); |
|
491 |
|
492 // Get the data form. |
|
493 mSettingsForm = static_cast<HbDataForm *> ( |
|
494 mDocLoader->findWidget(CLOCK_SETTINGS_DATA_FORM)); |
|
495 |
|
496 connect( |
|
497 mSettingsForm, SIGNAL(itemShown(const QModelIndex)), |
|
498 this, SLOT(formItemDisplayed(const QModelIndex))); |
|
499 |
|
500 // Get the day-date label. |
|
501 mDayDateLabel = static_cast<HbLabel *> ( |
|
502 mDocLoader->findWidget(CLOCK_SETTINGS_DATE_LABEL)); |
|
503 |
|
504 // Get the place label. |
|
505 mPlaceLabel = static_cast<HbLabel *> ( |
|
506 mDocLoader->findWidget(CLOCK_SETTINGS_PLACE_LABEL)); |
|
507 |
|
508 // Get the clock widget. |
|
509 mClockWidget = static_cast<SkinnableClock *> ( |
|
510 mDocLoader->findObject(CLOCK_WIDGET)); |
|
511 |
|
512 // Create the custom prototype. |
|
513 QList <HbAbstractViewItem*> prototypes = mSettingsForm->itemPrototypes(); |
|
514 SettingsCustomItem *customPrototype = new SettingsCustomItem(); |
|
515 prototypes.append(customPrototype); |
|
516 mSettingsForm->setItemPrototypes(prototypes); |
|
517 |
|
518 // Create the model. |
|
519 createModel(); |
|
520 // Update the relevant info. |
|
521 updateDateLabel(); |
|
522 updateClockWidget(); |
|
523 updatePlaceLabel(); |
|
524 |
|
525 mTickTimer->start(60000 - 1000 * QTime::currentTime().second()); |
|
526 |
|
527 qDebug("clock: ClockSettingsView::setupView() <--"); |
|
528 } |
|
529 |
|
530 /*! |
|
531 Creates the model for the settings form. |
|
532 */ |
|
533 void ClockSettingsView::createModel() |
|
534 { |
|
535 // Remove the model. |
|
536 if (mSettingsForm->model()) { |
|
537 delete mSettingsForm->model(); |
|
538 mSettingsForm->setModel(0); |
|
539 } |
|
540 |
|
541 // Create a model and set it. |
|
542 mSettingsModel = new HbDataFormModel(); |
|
543 // Add the items to the view. |
|
544 populateModel(); |
|
545 mSettingsForm->setModel(mSettingsModel); |
|
546 |
|
547 connect( |
|
548 mSettingsModel, |
|
549 SIGNAL(dataChanged(const QModelIndex, const QModelIndex)), |
|
550 this, |
|
551 SLOT(formItemValueChanged(const QModelIndex, const QModelIndex))); |
|
552 } |
|
553 |
|
554 /*! |
|
555 Poplulates the item in the model. |
|
556 */ |
|
557 void ClockSettingsView::populateModel() |
|
558 { |
|
559 if (!mSettingsModel) { |
|
560 createModel(); |
|
561 } |
|
562 |
|
563 // Add the network time update item. |
|
564 HbDataFormModelItem *networkTimeItem = mSettingsModel->appendDataFormItem( |
|
565 HbDataFormModelItem::CheckBoxItem, |
|
566 ""); |
|
567 bool networkTime = mTimezoneClient->timeUpdateOn(); |
|
568 Qt::CheckState state = Qt::Unchecked; |
|
569 if (networkTime) { |
|
570 state = Qt::Checked; |
|
571 } |
|
572 networkTimeItem->setContentWidgetData( |
|
573 "checkState", state); |
|
574 networkTimeItem->setContentWidgetData( |
|
575 "text", QString(hbTrId("txt_clk_setlabel_use_network_date_time"))); |
|
576 |
|
577 // Add the time item. |
|
578 // Custom data type for adding a time button to the data form. |
|
579 HbDataFormModelItem::DataItemType timeItemType = |
|
580 static_cast<HbDataFormModelItem::DataItemType> |
|
581 (HbDataFormModelItem::CustomItemBase + TimeItem); |
|
582 mTimeDataFormItem = mSettingsModel->appendDataFormItem( |
|
583 timeItemType, QString(hbTrId("txt_clock_setlabel_time"))); |
|
584 mTimeDataFormItem->setContentWidgetData("text", mSettingsUtility->time()); |
|
585 |
|
586 // Add the date item. |
|
587 // Custom data type for adding a time button to the data form. |
|
588 HbDataFormModelItem::DataItemType dateItemType = |
|
589 static_cast<HbDataFormModelItem::DataItemType> |
|
590 (HbDataFormModelItem::CustomItemBase + DateItem); |
|
591 mDateDataFormItem = mSettingsModel->appendDataFormItem( |
|
592 dateItemType, QString(hbTrId("txt_clock_setlabel_date"))); |
|
593 mDateDataFormItem->setContentWidgetData("text", mSettingsUtility->date()); |
|
594 |
|
595 // Add the place item. |
|
596 HbDataFormModelItem::DataItemType placeItemType = |
|
597 static_cast<HbDataFormModelItem::DataItemType> |
|
598 (HbDataFormModelItem::CustomItemBase + PlaceItem); |
|
599 mPlaceDataFormItem = mSettingsModel->appendDataFormItem( |
|
600 placeItemType, QString(hbTrId("txt_clock_formlabel_place"))); |
|
601 |
|
602 LocationInfo currentZoneInfo = mTimezoneClient->getCurrentZoneInfoL(); |
|
603 QString placeItemText(""); |
|
604 if (Qt::Unchecked == state) { |
|
605 placeItemText.append(currentZoneInfo.cityName); |
|
606 placeItemText+= tr(", "); |
|
607 } |
|
608 placeItemText.append(currentZoneInfo.countryName); |
|
609 // mPlaceWidget->setText(placeItemText); |
|
610 mPlaceDataFormItem->setContentWidgetData("text", placeItemText); |
|
611 |
|
612 if (networkTime) { |
|
613 mTimeDataFormItem->setEnabled(false); |
|
614 mDateDataFormItem->setEnabled(false); |
|
615 mPlaceDataFormItem->setEnabled(false); |
|
616 } else { |
|
617 mTimeDataFormItem->setEnabled(true); |
|
618 mDateDataFormItem->setEnabled(true); |
|
619 mPlaceDataFormItem->setEnabled(true); |
|
620 } |
|
621 |
|
622 // Add the regional settings item. |
|
623 HbDataFormModelItem::DataItemType regionalSettingsItem = |
|
624 static_cast<HbDataFormModelItem::DataItemType> |
|
625 (HbDataFormModelItem::CustomItemBase + RegionalSettingsItem); |
|
626 mSettingsModel->appendDataFormItem(regionalSettingsItem); |
|
627 |
|
628 } |
|
629 |
|
630 // End of file --Don't remove this. |