15 * Implementation file for class ClockSettingsView. |
15 * Implementation file for class ClockSettingsView. |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 |
19 // System includes |
19 // System includes |
20 #include <QDebug> |
|
21 #include <HbInstance> |
20 #include <HbInstance> |
22 #include <HbDataForm> |
21 #include <HbDataForm> |
23 #include <HbAction> |
22 #include <HbAction> |
24 #include <HbDataFormModel> |
23 #include <HbDataFormModel> |
25 #include <HbDataFormModelItem> |
24 #include <HbDataFormModelItem> |
26 #include <HbLabel> |
25 #include <HbLabel> |
27 #include <HbPushButton> |
26 #include <HbPushButton> |
28 #include <HbCheckBox> |
27 #include <HbCheckBox> |
29 #include <HbApplication> |
28 #include <HbTranslator> |
30 #include <QTranslator> |
29 #include <xqsettingsmanager.h> |
|
30 #include <xqsettingskey.h> |
|
31 #include <clockdomaincrkeys.h> |
31 |
32 |
32 // User includes |
33 // User includes |
33 #include "clocksettingsview.h" |
34 #include "clocksettingsview.h" |
34 #include "clocksettingsdefines.h" |
35 #include "clocksettingsdefines.h" |
35 #include "clocksettingsdocloader.h" |
36 #include "clocksettingsdocloader.h" |
36 #include "settingsutility.h" |
37 #include "settingsutility.h" |
37 #include "timezoneclient.h" |
38 #include "timezoneclient.h" |
38 #include "skinnableclock.h" |
|
39 #include "settingsdatatypes.h" |
39 #include "settingsdatatypes.h" |
40 #include "settingscustomitem.h" |
40 #include "settingscustomitem.h" |
41 |
41 |
42 /*! |
42 /*! |
43 \class ClockSettingsView |
43 \class ClockSettingsView |
52 \param parent The parent of type QGraphicsWidget. |
52 \param parent The parent of type QGraphicsWidget. |
53 */ |
53 */ |
54 ClockSettingsView::ClockSettingsView(QObject *parent) |
54 ClockSettingsView::ClockSettingsView(QObject *parent) |
55 :QObject(parent) |
55 :QObject(parent) |
56 { |
56 { |
57 qDebug("clock: ClockSettingsView::ClockSettingsView() -->"); |
|
58 |
57 |
59 // Load the translation file and install the editor specific translator |
58 // Load the translation file and install the editor specific translator |
60 mTranslator = new QTranslator; |
59 mTranslator = new HbTranslator("clocksettingsview"); |
61 //QString lang = QLocale::system().name(); |
60 mTranslator->loadCommon(); |
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 |
61 |
68 // Construct the settings utility. |
62 // Construct the settings utility. |
69 mSettingsUtility = new SettingsUtility(); |
63 mSettingsUtility = new SettingsUtility(); |
70 |
64 |
71 // Construct the timezone client. |
65 // Construct the timezone client. |
72 mTimezoneClient = new TimezoneClient(); |
66 mTimezoneClient = TimezoneClient::getInstance(); |
73 connect( |
67 connect( |
74 mTimezoneClient, SIGNAL(timechanged()), |
68 mTimezoneClient, SIGNAL(timechanged()), |
75 this, SLOT(updatePlaceInfo())); |
69 this, SLOT(updatePlaceItem())); |
76 connect( |
|
77 mTimezoneClient, SIGNAL(timechanged()), |
|
78 this, SLOT(updateDateLabel())); |
|
79 connect( |
|
80 mTimezoneClient, SIGNAL(timechanged()), |
|
81 this, SLOT(updateClockWidget())); |
|
82 connect( |
70 connect( |
83 mTimezoneClient, SIGNAL(timechanged()), |
71 mTimezoneClient, SIGNAL(timechanged()), |
84 this, SLOT(updateDateItem())); |
72 this, SLOT(updateDateItem())); |
85 connect( |
73 connect( |
86 mTimezoneClient, SIGNAL(timechanged()), |
74 mTimezoneClient, SIGNAL(timechanged()), |
87 this, SLOT(updateTimeItem())); |
75 this, SLOT(updateTimeItem())); |
|
76 connect( |
|
77 mTimezoneClient, SIGNAL(autoTimeUpdateChanged(int)), |
|
78 this, SLOT(handleAutoTimeUpdateChange(int))); |
|
79 connect( |
|
80 mTimezoneClient, SIGNAL(cityUpdated()), |
|
81 this, SLOT(updatePlaceItem())); |
88 |
82 |
89 // Start a timer. For updating the remaining alarm time. |
83 // Start a timer. For updating the remaining alarm time. |
90 mTickTimer = new QTimer(this); |
84 mTickTimer = new QTimer(this); |
91 connect( |
85 connect( |
92 mTickTimer, SIGNAL(timeout()), |
86 mTickTimer, SIGNAL(timeout()), |
93 this, SLOT(updateTimeItem())); |
87 this, SLOT(updateTimeItem())); |
94 |
88 |
95 qDebug("clock: ClockSettingsView::ClockSettingsView() <--"); |
89 // Create the settings manager. |
|
90 mSettingsManager = new XQSettingsManager(this); |
|
91 |
|
92 // Create the key for alarm snooze time. |
|
93 mAlarmSnoozeTimeKey = new XQSettingsKey( |
|
94 XQSettingsKey::TargetCentralRepository, |
|
95 KCRUidClockApp, |
|
96 KClockAppSnoozeTime); |
|
97 |
|
98 // Start the monitoring for the alarm snooze time key. |
|
99 mSettingsManager->startMonitoring(*mAlarmSnoozeTimeKey); |
|
100 |
|
101 // Listen to the key value changes. |
|
102 connect( |
|
103 mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), |
|
104 this, SLOT(eventMonitor(XQSettingsKey, QVariant))); |
96 } |
105 } |
97 |
106 |
98 /*! |
107 /*! |
99 Destructor. |
108 Destructor. |
100 */ |
109 */ |
101 ClockSettingsView::~ClockSettingsView() |
110 ClockSettingsView::~ClockSettingsView() |
102 { |
111 { |
103 qDebug("clock: ClockSettingsView::~ClockSettingsView() -->"); |
|
104 |
|
105 if (mDocLoader) { |
112 if (mDocLoader) { |
106 delete mDocLoader; |
113 delete mDocLoader; |
107 } |
114 } |
108 |
115 |
109 // Remove the translator |
116 // Remove the translator |
110 HbApplication::instance()->removeTranslator(mTranslator); |
|
111 if (mTranslator) { |
117 if (mTranslator) { |
112 delete mTranslator; |
118 delete mTranslator; |
113 mTranslator = 0; |
119 mTranslator = 0; |
114 } |
120 } |
115 |
121 if(mSettingsUtility){ |
116 qDebug("clock: ClockSettingsView::~ClockSettingsView() <--"); |
122 delete mSettingsUtility; |
|
123 } |
|
124 |
|
125 if(mSettingsModel){ |
|
126 delete mSettingsModel; |
|
127 } |
|
128 |
|
129 |
117 } |
130 } |
118 |
131 |
119 /*! |
132 /*! |
120 Loads the settings view from the docml. |
133 Loads the settings view from the docml. |
121 */ |
134 */ |
122 void ClockSettingsView::loadSettingsView() |
135 void ClockSettingsView::loadSettingsView() |
123 { |
136 { |
124 qDebug() << "clock: ClockViewManager::loadMainView -->"; |
|
125 |
|
126 bool loadSuccess; |
137 bool loadSuccess; |
127 |
138 |
128 // Construct the document loader instance |
139 // Construct the document loader instance |
129 mDocLoader = new ClockSettingsDocLoader(); |
140 mDocLoader = new ClockSettingsDocLoader(); |
130 |
141 |
173 window->removeView(mSettingsView); |
183 window->removeView(mSettingsView); |
174 deleteLater(); |
184 deleteLater(); |
175 } |
185 } |
176 |
186 |
177 /*! |
187 /*! |
178 Updates the day and date in the day label. |
188 Updates the zone info in the place item field. |
179 */ |
189 */ |
180 void ClockSettingsView::updateDateLabel() |
190 void ClockSettingsView::updatePlaceItem() |
181 { |
191 { |
182 qDebug() << "clock: ClockSettingsView::updateDateLabel -->"; |
|
183 |
|
184 // Get the current datetime. |
|
185 QDateTime dateTime = QDateTime::currentDateTime(); |
|
186 // Get the day name. |
|
187 QString dayName = dateTime.toString("dddd"); |
|
188 // Get the date in correct format. |
|
189 QString currentDate = mSettingsUtility->date(); |
|
190 // Construct the day + date string. |
|
191 QString dayDateString; |
|
192 dayDateString+= dayName; |
|
193 dayDateString += " "; |
|
194 dayDateString += currentDate; |
|
195 |
|
196 mDayDateLabel->clear(); |
|
197 mDayDateLabel->setPlainText(dayDateString); |
|
198 |
|
199 qDebug() << "clock: ClockSettingsView::updateDateLabel <--"; |
|
200 } |
|
201 |
|
202 /*! |
|
203 Updates the zone info in the place label. |
|
204 */ |
|
205 void ClockSettingsView::updatePlaceInfo() |
|
206 { |
|
207 qDebug() << "clock: ClockSettingsView::updateClockZoneInfo -->"; |
|
208 |
|
209 // Get the current zone info. |
192 // Get the current zone info. |
210 LocationInfo currentZoneInfo = mTimezoneClient->getCurrentZoneInfoL(); |
193 LocationInfo currentZoneInfo = mTimezoneClient->getCurrentZoneInfoL(); |
211 |
194 |
212 // Construct the GMT +/- X string. |
|
213 QString gmtOffset; |
|
214 |
|
215 int utcOffset = currentZoneInfo.zoneOffset; |
|
216 int offsetInHours (utcOffset/60); |
|
217 int offsetInMinutes (utcOffset%60); |
|
218 |
|
219 // Check wether the offset is +ve or -ve. |
|
220 if (0 < utcOffset) { |
|
221 // We have a positive offset. Append the '+' character. |
|
222 gmtOffset += tr(" +"); |
|
223 } else if (0 > utcOffset) { |
|
224 // We have a negative offset. Append the '-' character. |
|
225 gmtOffset += tr(" -"); |
|
226 offsetInHours = -offsetInHours; |
|
227 } else { |
|
228 // We dont have an offset. We are at GMT zone. |
|
229 } |
|
230 |
|
231 // Append the hour component. |
|
232 gmtOffset += QString::number(offsetInHours); |
|
233 |
|
234 // Get the time separator from settings and append it. |
|
235 QStringList timeSeparatorList; |
|
236 int index = mSettingsUtility->timeSeparator(timeSeparatorList); |
|
237 gmtOffset += timeSeparatorList.at(index); |
|
238 |
|
239 // Append the minute component. |
|
240 // If minute component is less less than 10, append a '00' |
|
241 if (0 <= offsetInMinutes && offsetInMinutes < 10) { |
|
242 gmtOffset += tr("00"); |
|
243 } else { |
|
244 gmtOffset += QString::number(offsetInMinutes); |
|
245 } |
|
246 |
|
247 gmtOffset += tr(" GMT "); |
|
248 |
|
249 // Append DST info. |
|
250 if (currentZoneInfo.dstOn) { |
|
251 gmtOffset += tr(" DST"); |
|
252 } |
|
253 |
|
254 // Update the labels with the correct info. |
|
255 mPlaceLabel->clear(); |
|
256 if (mTimezoneClient->timeUpdateOn()) { |
195 if (mTimezoneClient->timeUpdateOn()) { |
257 mPlaceLabel->setPlainText( |
|
258 currentZoneInfo.countryName + tr(" ") + gmtOffset); |
|
259 mPlaceDataFormItem->setContentWidgetData( |
196 mPlaceDataFormItem->setContentWidgetData( |
260 "text", currentZoneInfo.countryName); |
197 "text", currentZoneInfo.countryName); |
261 } else { |
198 } else { |
262 QString placeInfo = currentZoneInfo.cityName |
199 QString placeInfo = currentZoneInfo.cityName |
263 + tr(", ") + currentZoneInfo.countryName; |
200 + tr(", ") + currentZoneInfo.countryName; |
264 mPlaceLabel->setPlainText(placeInfo + tr(" ") + gmtOffset); |
|
265 mPlaceDataFormItem->setContentWidgetData("text", placeInfo); |
201 mPlaceDataFormItem->setContentWidgetData("text", placeInfo); |
266 } |
202 } |
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 } |
203 } |
282 |
204 |
283 /*! |
205 /*! |
284 Slot to update the display of the date settings item field. |
206 Slot to update the display of the date settings item field. |
285 */ |
207 */ |
320 mDocLoader->load( |
240 mDocLoader->load( |
321 CLOCK_SETTINGS_VIEW_DOCML, |
241 CLOCK_SETTINGS_VIEW_DOCML, |
322 CLOCK_SETTINGS_VIEW_PORTRAIT_SECTION, |
242 CLOCK_SETTINGS_VIEW_PORTRAIT_SECTION, |
323 &success); |
243 &success); |
324 } |
244 } |
325 |
|
326 qDebug() << "clock: ClockSettingsView::handleOrientationChanged <--"; |
|
327 |
|
328 } |
245 } |
329 |
246 |
330 void ClockSettingsView::handleNetworkTimeStateChange(int state) |
247 void ClockSettingsView::handleNetworkTimeStateChange(int state) |
331 { |
248 { |
332 bool cenrepValue = mTimezoneClient->timeUpdateOn(); |
249 bool cenrepValue = mTimezoneClient->timeUpdateOn(); |
333 if ((Qt::Checked == state && !cenrepValue) |
250 if ((Qt::Checked == state && !cenrepValue) |
334 || (Qt::Unchecked == state && cenrepValue)) { |
251 || (Qt::Unchecked == state && cenrepValue)) { |
335 if (Qt::Checked == state) { |
252 if (Qt::Checked == state) { |
336 // Disable the time, date and place item. |
|
337 if (mTimeDataFormItem) { |
|
338 mTimeDataFormItem->setEnabled(false); |
|
339 } |
|
340 if (mDateDataFormItem) { |
|
341 mDateDataFormItem->setEnabled(false); |
|
342 } |
|
343 if (mPlaceDataFormItem) { |
|
344 mPlaceDataFormItem->setEnabled(false); |
|
345 } |
|
346 // Update the cenrep value. |
253 // Update the cenrep value. |
347 mTimezoneClient->setTimeUpdateOn(true); |
254 mTimezoneClient->setTimeUpdateOn(true); |
348 |
255 |
349 } else if (Qt::Unchecked == state) { |
256 } else if (Qt::Unchecked == state) { |
350 // Enable the time, date and place item. |
|
351 if (mTimeDataFormItem) { |
|
352 mTimeDataFormItem->setEnabled(true); |
|
353 } |
|
354 if (mDateDataFormItem) { |
|
355 mDateDataFormItem->setEnabled(true); |
|
356 } |
|
357 if (mPlaceDataFormItem) { |
|
358 mPlaceDataFormItem->setEnabled(true); |
|
359 } |
|
360 |
|
361 // Update the cenrep value. |
257 // Update the cenrep value. |
362 mTimezoneClient->setTimeUpdateOn(false); |
258 mTimezoneClient->setTimeUpdateOn(false); |
363 } |
259 } |
364 |
|
365 updatePlaceInfo(); |
|
366 } |
260 } |
367 } |
261 } |
368 |
262 |
369 /*! |
263 /*! |
370 Called after loading the view from the docml. |
264 Called after loading the view from the docml. |
372 |
266 |
373 \param docLoader Pointer to ClockSettingsDocLoader object. |
267 \param docLoader Pointer to ClockSettingsDocLoader object. |
374 */ |
268 */ |
375 void ClockSettingsView::setupView() |
269 void ClockSettingsView::setupView() |
376 { |
270 { |
377 qDebug("clock: ClockSettingsView::setupView() -->"); |
|
378 |
|
379 HbMainWindow *window = hbInstance->allMainWindows().first(); |
271 HbMainWindow *window = hbInstance->allMainWindows().first(); |
380 window->addView(mSettingsView); |
272 window->addView(mSettingsView); |
381 window->setCurrentView(mSettingsView); |
273 window->setCurrentView(mSettingsView); |
382 |
274 |
383 // Add the back softkey. |
275 // Add the back softkey. |
384 mBackAction = new HbAction(Hb::BackAction); |
276 mBackAction = new HbAction(Hb::BackNaviAction); |
385 mSettingsView->setNavigationAction(mBackAction); |
277 mSettingsView->setNavigationAction(mBackAction); |
386 connect( |
278 connect( |
387 mBackAction, SIGNAL(triggered()), |
279 mBackAction, SIGNAL(triggered()), |
388 this, SLOT(handleBackAction())); |
280 this, SLOT(handleBackAction())); |
389 |
281 |
390 // Get the data form. |
282 // Get the data form. |
391 mSettingsForm = static_cast<HbDataForm *> ( |
283 mSettingsForm = static_cast<HbDataForm *> ( |
392 mDocLoader->findWidget(CLOCK_SETTINGS_DATA_FORM)); |
284 mDocLoader->findWidget(CLOCK_SETTINGS_DATA_FORM)); |
393 |
285 |
394 // Get the day-date label. |
|
395 mDayDateLabel = static_cast<HbLabel *> ( |
|
396 mDocLoader->findWidget(CLOCK_SETTINGS_DATE_LABEL)); |
|
397 |
|
398 // Get the place label. |
|
399 mPlaceLabel = static_cast<HbLabel *> ( |
|
400 mDocLoader->findWidget(CLOCK_SETTINGS_PLACE_LABEL)); |
|
401 |
|
402 // Get the clock widget. |
|
403 mClockWidget = static_cast<SkinnableClock *> ( |
|
404 mDocLoader->findObject(CLOCK_WIDGET)); |
|
405 |
|
406 // Create the custom prototype. |
286 // Create the custom prototype. |
407 QList <HbAbstractViewItem*> prototypes = mSettingsForm->itemPrototypes(); |
287 QList <HbAbstractViewItem*> prototypes = mSettingsForm->itemPrototypes(); |
408 SettingsCustomItem *customPrototype = new SettingsCustomItem(); |
288 SettingsCustomItem *customPrototype = new SettingsCustomItem(mSettingsForm); |
409 prototypes.append(customPrototype); |
289 prototypes.append(customPrototype); |
410 mSettingsForm->setItemPrototypes(prototypes); |
290 mSettingsForm->setItemPrototypes(prototypes); |
411 |
291 |
412 // Create the model. |
292 // Create the model. |
413 createModel(); |
293 createModel(); |
414 // Update the relevant info. |
294 updatePlaceItem(); |
415 updateDateLabel(); |
|
416 updateClockWidget(); |
|
417 updatePlaceInfo(); |
|
418 |
295 |
419 mTickTimer->start(60000 - 1000 * QTime::currentTime().second()); |
296 mTickTimer->start(60000 - 1000 * QTime::currentTime().second()); |
420 |
|
421 qDebug("clock: ClockSettingsView::setupView() <--"); |
|
422 } |
297 } |
423 |
298 |
424 /*! |
299 /*! |
425 Creates the model for the settings form. |
300 Creates the model for the settings form. |
426 */ |
301 */ |
511 // Add the regional settings item. |
386 // Add the regional settings item. |
512 HbDataFormModelItem::DataItemType regionalSettingsItem = |
387 HbDataFormModelItem::DataItemType regionalSettingsItem = |
513 static_cast<HbDataFormModelItem::DataItemType> |
388 static_cast<HbDataFormModelItem::DataItemType> |
514 (HbDataFormModelItem::CustomItemBase + RegionalSettingsItem); |
389 (HbDataFormModelItem::CustomItemBase + RegionalSettingsItem); |
515 mSettingsModel->appendDataFormItem(regionalSettingsItem); |
390 mSettingsModel->appendDataFormItem(regionalSettingsItem); |
516 |
391 |
|
392 // Add the clock type item. |
|
393 HbDataFormModelItem::DataItemType clockTypeSettingsItem = |
|
394 static_cast<HbDataFormModelItem::DataItemType> |
|
395 (HbDataFormModelItem::ToggleValueItem); |
|
396 mClockTypeItem = mSettingsModel->appendDataFormItem( |
|
397 clockTypeSettingsItem,hbTrId("txt_clock_setlabel_clock_type")); |
|
398 QStringList clockTypeList; |
|
399 int clockType = mSettingsUtility->clockType(clockTypeList); |
|
400 int zeroIndex(0); |
|
401 if( zeroIndex == clockType ){ |
|
402 mClockTypeItem->setContentWidgetData("text", clockTypeList[0]); |
|
403 mClockTypeItem->setContentWidgetData("additionalText", clockTypeList[1]); |
|
404 } else { |
|
405 mClockTypeItem->setContentWidgetData("text", clockTypeList[1]); |
|
406 mClockTypeItem->setContentWidgetData("additionalText", clockTypeList[0]); |
|
407 } |
|
408 mSettingsForm->addConnection( |
|
409 mClockTypeItem, SIGNAL(clicked()), |
|
410 this, SLOT(handleClockTypeChanged())); |
|
411 |
|
412 // Add the alarm snooze time item. |
|
413 mAlarmSnoozeItem = mSettingsModel->appendDataFormItem( |
|
414 HbDataFormModelItem::ComboBoxItem, |
|
415 hbTrId("txt_clock_setlabel_alarm_snooze_time")); |
|
416 QStringList alramSnoozeTimes; |
|
417 alramSnoozeTimes << hbTrId("txt_clock_set_ln_mins", 5) |
|
418 << hbTrId("txt_clock_set_ln_mins", 10) |
|
419 << hbTrId("txt_clock_set_ln_mins", 15) |
|
420 << hbTrId("txt_clock_set_ln_mins", 30); |
|
421 |
|
422 // Build the hash map for the reminder. |
|
423 mAlarmSnoozeTimeHash[0] = 5; |
|
424 mAlarmSnoozeTimeHash[1] = 10; |
|
425 mAlarmSnoozeTimeHash[2] = 15; |
|
426 mAlarmSnoozeTimeHash[3] = 30; |
|
427 |
|
428 mAlarmSnoozeItem->setContentWidgetData("items", alramSnoozeTimes); |
|
429 QVariant value = mSettingsManager->readItemValue(*mAlarmSnoozeTimeKey); |
|
430 bool success; |
|
431 int index; |
|
432 int alarmSnoozeTime = value.toInt(&success); |
|
433 if (success) { |
|
434 index = mAlarmSnoozeTimeHash.key(alarmSnoozeTime); |
|
435 } else { |
|
436 index = mAlarmSnoozeTimeHash.key(15); |
|
437 } |
|
438 mAlarmSnoozeItem->setContentWidgetData("currentIndex", index); |
|
439 mSettingsForm->addConnection( |
|
440 mAlarmSnoozeItem, SIGNAL(currentIndexChanged(int)), |
|
441 this, SLOT(handleAlarmSnoozeTimeChanged(int))); |
|
442 |
|
443 } |
|
444 |
|
445 /*! |
|
446 Slot which handles the auto time update value changes in cenrep. |
|
447 |
|
448 /param value New value of the auto time update. |
|
449 */ |
|
450 void ClockSettingsView::handleAutoTimeUpdateChange(int value) |
|
451 { |
|
452 int state = (mNetworkTimeItem->contentWidgetData("checkState")).toInt(); |
|
453 |
|
454 if (value) { |
|
455 // Disable the time, date and place item. |
|
456 if (mTimeDataFormItem) { |
|
457 mTimeDataFormItem->setEnabled(false); |
|
458 } |
|
459 if (mDateDataFormItem) { |
|
460 mDateDataFormItem->setEnabled(false); |
|
461 } |
|
462 if (mPlaceDataFormItem) { |
|
463 mPlaceDataFormItem->setEnabled(false); |
|
464 } |
|
465 if (Qt::Unchecked == state) { |
|
466 mNetworkTimeItem->setContentWidgetData( |
|
467 "checkState", Qt::Checked); |
|
468 } |
|
469 } else { |
|
470 // Enable the time, date and place item. |
|
471 if (mTimeDataFormItem) { |
|
472 mTimeDataFormItem->setEnabled(true); |
|
473 } |
|
474 if (mDateDataFormItem) { |
|
475 mDateDataFormItem->setEnabled(true); |
|
476 } |
|
477 if (mPlaceDataFormItem) { |
|
478 mPlaceDataFormItem->setEnabled(true); |
|
479 } |
|
480 if (Qt::Checked == state) { |
|
481 mNetworkTimeItem->setContentWidgetData( |
|
482 "checkState", Qt::Unchecked); |
|
483 } |
|
484 } |
|
485 updatePlaceItem(); |
|
486 } |
|
487 |
|
488 /*! |
|
489 Slot which handles the alarm snooze time changes. |
|
490 |
|
491 /param value New index of the alarm snooze time. |
|
492 */ |
|
493 void ClockSettingsView::handleAlarmSnoozeTimeChanged(int index) |
|
494 { |
|
495 if (mAlarmSnoozeTimeHash.value(index)) { |
|
496 mSettingsManager->writeItemValue( |
|
497 *mAlarmSnoozeTimeKey, mAlarmSnoozeTimeHash.value(index)); |
|
498 } |
|
499 } |
|
500 |
|
501 /*! |
|
502 Slot which handles the clock type change.. |
|
503 */ |
|
504 void ClockSettingsView::handleClockTypeChanged() |
|
505 { |
|
506 mSettingsUtility->setClockType( |
|
507 mClockTypeItem->contentWidgetData("text").toString()); |
|
508 } |
|
509 |
|
510 /*! |
|
511 Slot which is called when the value changes in cenrep. |
|
512 |
|
513 \param key The key which got changed in cenrep. |
|
514 \param value The new value of that key. |
|
515 */ |
|
516 void ClockSettingsView::eventMonitor( |
|
517 const XQSettingsKey& key, const QVariant& value) |
|
518 { |
|
519 if (key.uid() == KCRUidClockApp && key.key() == KClockAppSnoozeTime) { |
|
520 if (mSettingsManager->error() == XQSettingsManager::NoError) { |
|
521 |
|
522 bool success; |
|
523 int alarmSnoozeTime = value.toInt(&success); |
|
524 |
|
525 if (success) { |
|
526 mAlarmSnoozeItem->setContentWidgetData( |
|
527 "currentIndex", mAlarmSnoozeTimeHash.key( |
|
528 alarmSnoozeTime)); |
|
529 } |
|
530 } |
|
531 } |
517 } |
532 } |
518 |
533 |
519 // End of file --Don't remove this. |
534 // End of file --Don't remove this. |