25 |
25 |
26 #include "debugtraces.h" |
26 #include "debugtraces.h" |
27 |
27 |
28 //Localized constants |
28 //Localized constants |
29 #define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages") |
29 #define LOC_RECEIVING_SERVICE_MESSAGES hbTrId("txt_messaging_setlabel_receiving_service_messages") |
30 #define LOC_ON hbTrId("txt_messaging_setlabel_val_on") |
30 |
31 #define LOC_OFF hbTrId("txt_messaging_setlabel_val_off") |
31 #define LOC_OFF hbTrId("txt_messaging_setlabel_val_off") |
32 #define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support") |
32 #define LOC_REDUCED_SUPPORT hbTrId("txt_messaging_setlabel_val_reduced_support") |
33 #define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support") |
33 #define LOC_FULL_SUPPORT hbTrId("txt_messaging_setlabel_val_full_support") |
34 #define LOC_ADVANCED hbTrId("txt_messaging_button_advanced") |
34 #define LOC_ADVANCED hbTrId("txt_messaging_button_advanced") |
35 #define LOC_CHAR_ENCODING hbTrId("txt_messaging_setlabel_character_encoding") |
35 #define LOC_CHAR_ENCODING hbTrId("txt_messaging_setlabel_character_encoding") |
81 settingsModel = new HbDataFormModel(0); |
81 settingsModel = new HbDataFormModel(0); |
82 |
82 |
83 MsgSettingEngine::CharacterEncoding charEncoding = |
83 MsgSettingEngine::CharacterEncoding charEncoding = |
84 MsgSettingEngine::ReducedSupport; |
84 MsgSettingEngine::ReducedSupport; |
85 |
85 |
86 bool receiveServiceMessages = false; |
86 mSettingEngine->settingsCharEncoding(charEncoding); |
87 |
|
88 mSettingEngine->settingsServiceMessagesAndCharEncoding( |
|
89 receiveServiceMessages, |
|
90 charEncoding); |
|
91 |
87 |
92 // 1. Character encoding |
88 // 1. Character encoding |
93 HbDataFormModelItem *characterEncoding = |
89 HbDataFormModelItem *characterEncoding = |
94 new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, |
90 new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, |
95 LOC_CHAR_ENCODING, |
91 LOC_CHAR_ENCODING, |
107 this->addConnection(characterEncoding, |
103 this->addConnection(characterEncoding, |
108 SIGNAL(currentIndexChanged(int)), |
104 SIGNAL(currentIndexChanged(int)), |
109 this, |
105 this, |
110 SLOT(changeCharEncoding(int))); |
106 SLOT(changeCharEncoding(int))); |
111 |
107 |
112 //2. receiving service messages |
108 // 2. MMS Settings |
113 QStringList serviceMessagesList; |
|
114 serviceMessagesList << LOC_OFF << LOC_ON; |
|
115 |
|
116 index = int (receiveServiceMessages); |
|
117 int otherIndex = (receiveServiceMessages + 1) % serviceMessagesList.count(); |
|
118 |
|
119 HbDataFormModelItem *serviceMessagesItem = |
|
120 new HbDataFormModelItem(HbDataFormModelItem::ComboBoxItem, |
|
121 LOC_RECEIVING_SERVICE_MESSAGES, |
|
122 0); |
|
123 |
|
124 serviceMessagesItem->setContentWidgetData("items", serviceMessagesList); |
|
125 serviceMessagesItem->setContentWidgetData("currentIndex", index); |
|
126 |
|
127 settingsModel->appendDataFormItem(serviceMessagesItem, |
|
128 settingsModel->invisibleRootItem()); |
|
129 this->addConnection(serviceMessagesItem, |
|
130 SIGNAL(clicked()), |
|
131 this, |
|
132 SLOT(onPressedServiceMessages())); |
|
133 |
|
134 // 3. MMS Settings |
|
135 HbDataFormModelItem* mmsGroup = |
109 HbDataFormModelItem* mmsGroup = |
136 new HbDataFormModelItem(HbDataFormModelItem::GroupItem, |
110 new HbDataFormModelItem(HbDataFormModelItem::GroupItem, |
137 LOC_MMS_SETTINGS, |
111 LOC_MMS_SETTINGS, |
138 0); |
112 0); |
139 |
113 |
155 this->setModel(settingsModel); |
129 this->setModel(settingsModel); |
156 |
130 |
157 if (settingsView == MsgSettingsView::MMSView) |
131 if (settingsView == MsgSettingsView::MMSView) |
158 { |
132 { |
159 //set MMS Settings as expanded |
133 //set MMS Settings as expanded |
160 QModelIndex index_mms = settingsModel->indexFromItem(mmsGroup); |
134 expandGroup(mmsGroup,true); |
161 //TODO: dataform issue on expanding one group item |
135 } |
162 //this->setExpanded(index_mms, true); |
136 |
163 } |
|
164 else if(settingsView == MsgSettingsView::SMSView) |
|
165 { |
|
166 //expandSMSSettings(); |
|
167 } |
|
168 |
|
169 } |
137 } |
170 |
138 |
171 void MsgSettingsForm::refreshViewForm() |
139 void MsgSettingsForm::refreshViewForm() |
172 { |
140 { |
173 updateSmsMCGroupItem(mSmsMCGroup); |
141 updateSmsMCGroupItem(mSmsMCGroup); |
384 SIGNAL(clicked()), |
353 SIGNAL(clicked()), |
385 this, |
354 this, |
386 SLOT(onPressedCustomButton())); |
355 SLOT(onPressedCustomButton())); |
387 } |
356 } |
388 |
357 |
389 void MsgSettingsForm::onPressedServiceMessages() |
|
390 { |
|
391 HbPushButton *btn = qobject_cast<HbPushButton *> (sender()); |
|
392 |
|
393 if (btn) |
|
394 { |
|
395 QString btnText = btn->text(); |
|
396 |
|
397 //check if the button pressed was On or Off |
|
398 if (LOC_OFF == btnText) |
|
399 { |
|
400 mSettingEngine->setReceiveSerivceMessages(false); |
|
401 } |
|
402 else |
|
403 { |
|
404 mSettingEngine->setReceiveSerivceMessages(true); |
|
405 } |
|
406 } |
|
407 } |
|
408 |
|
409 void MsgSettingsForm::changeCharEncoding(int index) |
358 void MsgSettingsForm::changeCharEncoding(int index) |
410 { |
359 { |
411 //set the character encoding |
360 //set the character encoding |
412 mSettingEngine->setCharacterEncoding(MsgSettingEngine::CharacterEncoding(index)); |
361 mSettingEngine->setCharacterEncoding(MsgSettingEngine::CharacterEncoding(index)); |
413 } |
362 } |
446 QString btnText = btn->text(); |
395 QString btnText = btn->text(); |
447 |
396 |
448 //check if the button pressed was Yes or NO |
397 //check if the button pressed was Yes or NO |
449 if (LOC_MMS_NO == btnText) |
398 if (LOC_MMS_NO == btnText) |
450 { |
399 { |
|
400 mSettingEngine->setReceiveMMSAdverts(false); |
|
401 } |
|
402 else |
|
403 { |
451 mSettingEngine->setReceiveMMSAdverts(true); |
404 mSettingEngine->setReceiveMMSAdverts(true); |
452 } |
|
453 else |
|
454 { |
|
455 mSettingEngine->setReceiveMMSAdverts(false); |
|
456 } |
405 } |
457 } |
406 } |
458 } |
407 } |
459 |
408 |
460 void MsgSettingsForm::changeAccessPoint(int index) |
409 void MsgSettingsForm::changeAccessPoint(int index) |
487 { |
436 { |
488 //set into msg settings |
437 //set into msg settings |
489 mSettingEngine->setSMSMessageCenter(index); |
438 mSettingEngine->setSMSMessageCenter(index); |
490 } |
439 } |
491 |
440 |
492 void MsgSettingsForm::expandSMSSettings() |
441 void MsgSettingsForm::expandGroup(HbDataFormModelItem* group,bool expand) |
493 { |
442 { |
494 QModelIndex index_sms = settingsModel->indexFromItem(mSmsMCGroup); |
443 QModelIndex index = settingsModel->indexFromItem(group); |
495 |
444 |
496 this->setExpanded(index_sms, true); |
445 if(index.isValid()) |
|
446 { |
|
447 this->setExpanded(index, expand); |
|
448 } |
497 } |
449 } |
498 //EOF |
450 //EOF |