103 // Create the key for alarm snooze time. |
103 // Create the key for alarm snooze time. |
104 mAlarmSnoozeTimeKey = new XQSettingsKey( |
104 mAlarmSnoozeTimeKey = new XQSettingsKey( |
105 XQSettingsKey::TargetCentralRepository, |
105 XQSettingsKey::TargetCentralRepository, |
106 KCRUidClockApp, |
106 KCRUidClockApp, |
107 KClockAppSnoozeTime); |
107 KClockAppSnoozeTime); |
108 |
108 // Create the key for clock type. |
109 // Start the monitoring for the alarm snooze time key. |
109 mClockTypeKey = new XQSettingsKey( |
|
110 XQSettingsKey::TargetCentralRepository, |
|
111 KCRUidClockApp, |
|
112 KClockType); |
|
113 // Start the monitoring for the alarm snooze time key and clock type. |
110 mSettingsManager->startMonitoring(*mAlarmSnoozeTimeKey); |
114 mSettingsManager->startMonitoring(*mAlarmSnoozeTimeKey); |
111 |
115 mSettingsManager->startMonitoring(*mClockTypeKey); |
112 // Listen to the key value changes. |
116 // Listen to the key value changes. |
113 connect( |
117 connect( |
114 mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), |
118 mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), |
115 this, SLOT(eventMonitor(XQSettingsKey, QVariant))); |
119 this, SLOT(eventMonitor(XQSettingsKey, QVariant))); |
116 OstTraceFunctionExit0( CLOCKSETTINGSVIEW_CLOCKSETTINGSVIEW_EXIT ); |
120 OstTraceFunctionExit0( CLOCKSETTINGSVIEW_CLOCKSETTINGSVIEW_EXIT ); |
123 { |
127 { |
124 OstTraceFunctionEntry0( DUP1_CLOCKSETTINGSVIEW_CLOCKSETTINGSVIEW_ENTRY ); |
128 OstTraceFunctionEntry0( DUP1_CLOCKSETTINGSVIEW_CLOCKSETTINGSVIEW_ENTRY ); |
125 if (mDocLoader) { |
129 if (mDocLoader) { |
126 delete mDocLoader; |
130 delete mDocLoader; |
127 } |
131 } |
128 |
|
129 // Remove the translator |
132 // Remove the translator |
130 if (mTranslator) { |
133 if (mTranslator) { |
131 delete mTranslator; |
134 delete mTranslator; |
132 mTranslator = 0; |
135 mTranslator = 0; |
133 } |
136 } |
134 if(mSettingsUtility){ |
137 if(mSettingsUtility){ |
135 delete mSettingsUtility; |
138 delete mSettingsUtility; |
136 } |
139 } |
|
140 if(mSettingsManager) { |
|
141 delete mSettingsManager; |
|
142 } |
|
143 // Delete cenrep keys |
|
144 delete mAlarmSnoozeTimeKey; |
|
145 delete mClockTypeKey; |
137 |
146 |
138 if(mSettingsModel){ |
147 if(mSettingsModel){ |
139 delete mSettingsModel; |
148 delete mSettingsModel; |
140 } |
149 } |
141 |
|
142 |
|
143 OstTraceFunctionExit0( DUP1_CLOCKSETTINGSVIEW_CLOCKSETTINGSVIEW_EXIT ); |
150 OstTraceFunctionExit0( DUP1_CLOCKSETTINGSVIEW_CLOCKSETTINGSVIEW_EXIT ); |
144 } |
151 } |
145 |
152 |
146 /*! |
153 /*! |
147 Loads the settings view from the docml. |
154 Loads the settings view from the docml. |
452 mClockTypeItem->setContentWidgetData("text", clockTypeList[1]); |
459 mClockTypeItem->setContentWidgetData("text", clockTypeList[1]); |
453 mClockTypeItem->setContentWidgetData("additionalText", clockTypeList[0]); |
460 mClockTypeItem->setContentWidgetData("additionalText", clockTypeList[0]); |
454 } |
461 } |
455 mClockTypeItem->setContentWidgetData("objectName", "clockType"); |
462 mClockTypeItem->setContentWidgetData("objectName", "clockType"); |
456 mSettingsForm->addConnection( |
463 mSettingsForm->addConnection( |
457 mClockTypeItem, SIGNAL(clicked()), |
464 mClockTypeItem, SIGNAL(clicked()), |
458 this, SLOT(handleClockTypeChanged())); |
465 this, SLOT(handleClockTypeChanged())); |
459 |
466 |
460 // Add the alarm snooze time item. |
467 // Add the alarm snooze time item. |
461 mAlarmSnoozeItem = mSettingsModel->appendDataFormItem( |
468 mAlarmSnoozeItem = mSettingsModel->appendDataFormItem( |
462 HbDataFormModelItem::ComboBoxItem, |
469 HbDataFormModelItem::ComboBoxItem, |
463 hbTrId("txt_clock_setlabel_alarm_snooze_time")); |
470 hbTrId("txt_clock_setlabel_alarm_snooze_time")); |
556 Slot which handles the clock type change.. |
563 Slot which handles the clock type change.. |
557 */ |
564 */ |
558 void ClockSettingsView::handleClockTypeChanged() |
565 void ClockSettingsView::handleClockTypeChanged() |
559 { |
566 { |
560 OstTraceFunctionEntry0( CLOCKSETTINGSVIEW_HANDLECLOCKTYPECHANGED_ENTRY ); |
567 OstTraceFunctionEntry0( CLOCKSETTINGSVIEW_HANDLECLOCKTYPECHANGED_ENTRY ); |
561 mSettingsUtility->setClockType( |
568 mSettingsUtility->setClockType(mClockTypeItem->contentWidgetData("text").toString()); |
562 mClockTypeItem->contentWidgetData("text").toString()); |
|
563 OstTraceFunctionExit0( CLOCKSETTINGSVIEW_HANDLECLOCKTYPECHANGED_EXIT ); |
569 OstTraceFunctionExit0( CLOCKSETTINGSVIEW_HANDLECLOCKTYPECHANGED_EXIT ); |
564 } |
570 } |
565 |
571 |
566 /*! |
572 /*! |
567 Slot which is called when the value changes in cenrep. |
573 Slot which is called when the value changes in cenrep. |
571 */ |
577 */ |
572 void ClockSettingsView::eventMonitor( |
578 void ClockSettingsView::eventMonitor( |
573 const XQSettingsKey& key, const QVariant& value) |
579 const XQSettingsKey& key, const QVariant& value) |
574 { |
580 { |
575 OstTraceFunctionEntry0( CLOCKSETTINGSVIEW_EVENTMONITOR_ENTRY ); |
581 OstTraceFunctionEntry0( CLOCKSETTINGSVIEW_EVENTMONITOR_ENTRY ); |
576 if (key.uid() == KCRUidClockApp && key.key() == KClockAppSnoozeTime) { |
582 if (key.uid() == KCRUidClockApp) { |
577 if (mSettingsManager->error() == XQSettingsManager::NoError) { |
583 // Update the snooze time |
578 |
584 if(key.key() == KClockAppSnoozeTime) { |
579 bool success; |
585 if (mSettingsManager->error() == XQSettingsManager::NoError) { |
580 int alarmSnoozeTime = value.toInt(&success); |
586 |
581 |
587 bool success; |
582 if (success) { |
588 int alarmSnoozeTime = value.toInt(&success); |
583 mAlarmSnoozeItem->setContentWidgetData( |
589 |
584 "currentIndex", mAlarmSnoozeTimeHash.key( |
590 if (success) { |
585 alarmSnoozeTime)); |
591 mAlarmSnoozeItem->setContentWidgetData( |
|
592 "currentIndex", mAlarmSnoozeTimeHash.key( |
|
593 alarmSnoozeTime)); |
|
594 } |
586 } |
595 } |
|
596 }else if(key.key() == KClockType) { |
|
597 // Update the clock type when its changed |
|
598 updateClockType(); |
587 } |
599 } |
588 } |
600 } |
589 OstTraceFunctionExit0( CLOCKSETTINGSVIEW_EVENTMONITOR_EXIT ); |
601 OstTraceFunctionExit0( CLOCKSETTINGSVIEW_EVENTMONITOR_EXIT ); |
590 } |
602 } |
591 |
603 |