22 #include <hbdataformmodel.h> |
22 #include <hbdataformmodel.h> |
23 #include <hbdataformmodelitem.h> |
23 #include <hbdataformmodelitem.h> |
24 #include <hbdataformviewitem.h> |
24 #include <hbdataformviewitem.h> |
25 #include <hbcheckbox.h> |
25 #include <hbcheckbox.h> |
26 #include <QString> |
26 #include <QString> |
27 #include <QApplication> |
|
28 #include <QLocale> |
|
29 #include <QTranslator> |
|
30 #include <hblineedit.h> |
27 #include <hblineedit.h> |
31 #include <hbcombobox.h> |
28 #include <hbcombobox.h> |
32 #include <hbdeviceprogressdialog.h> |
29 #include <hbdeviceprogressdialog.h> |
33 #include <cpitemdatahelper.h> |
30 #include <cpitemdatahelper.h> |
34 #include <sssettingswrapper.h> |
31 #include <sssettingswrapper.h> |
44 m_activeNoteId(0), |
41 m_activeNoteId(0), |
45 m_helper(helper) |
42 m_helper(helper) |
46 { |
43 { |
47 DPRINT << ": IN"; |
44 DPRINT << ": IN"; |
48 |
45 |
49 // Localization file loading |
|
50 QTranslator translator; |
|
51 QString lang = QLocale::system().name(); |
|
52 QString path = "z:/resource/qt/translations/"; |
|
53 DPRINT << ": loading translation: " << QString(path + "telephone_cp_" + lang); |
|
54 bool translatorLoaded = translator.load(path + "telephone_cp_" + lang); |
|
55 DPRINT << ": translator loaded: " << translatorLoaded; |
|
56 if (translatorLoaded) { |
|
57 qApp->installTranslator(&translator); |
|
58 DPRINT << ": translator installed"; |
|
59 } |
|
60 |
|
61 m_cpSettingsWrapper = new CpSettingsWrapper; |
46 m_cpSettingsWrapper = new CpSettingsWrapper; |
62 m_pSetWrapper = new PSetWrapper; |
47 m_pSetWrapper = new PSetWrapper; |
63 DPRINT << "PSetWrapper created"; |
48 DPRINT << "PSetWrapper created"; |
64 |
49 |
65 m_callWaitingWrapper = &m_pSetWrapper->callWaitingWrapper(); |
50 m_callWaitingWrapper = &m_pSetWrapper->callWaitingWrapper(); |
89 |
74 |
90 m_ssSettingsWrapper = new SsSettingsWrapper; |
75 m_ssSettingsWrapper = new SsSettingsWrapper; |
91 DPRINT << "SsSettingsWrapper created"; |
76 DPRINT << "SsSettingsWrapper created"; |
92 |
77 |
93 CpPhoneNotes *phoneNotes = CpPhoneNotes::instance(); |
78 CpPhoneNotes *phoneNotes = CpPhoneNotes::instance(); |
94 QObject::connect( |
|
95 this, |
|
96 SIGNAL(showBasicServiceList( |
|
97 const QString&, const QList<unsigned char> &)), |
|
98 phoneNotes, |
|
99 SLOT(showBasicServiceList( |
|
100 const QString&, const QList<unsigned char> &))); |
|
101 QObject::connect( |
79 QObject::connect( |
102 this, |
80 this, |
103 SIGNAL(showGlobalProgressNote(int &, const QString&)), |
81 SIGNAL(showGlobalProgressNote(int &, const QString&)), |
104 phoneNotes, |
82 phoneNotes, |
105 SLOT(showGlobalProgressNote(int &, const QString&))); |
83 SLOT(showGlobalProgressNote(int &, const QString&))); |
162 DPRINT << ": IN"; |
140 DPRINT << ": IN"; |
163 |
141 |
164 // Read show call duration value from Cenrep |
142 // Read show call duration value from Cenrep |
165 bool showCallDurationStatus = m_cpSettingsWrapper->showCallDuration(); |
143 bool showCallDurationStatus = m_cpSettingsWrapper->showCallDuration(); |
166 DPRINT << "showCallDurationStatus:" << showCallDurationStatus; |
144 DPRINT << "showCallDurationStatus:" << showCallDurationStatus; |
167 m_DataItemShowCallDuration = new CpSettingFormItemData( |
145 |
168 HbDataFormModelItem::CheckBoxItem, hbTrId("") ,this); |
146 m_DataItemShowCallDuration = |
169 m_DataItemShowCallDuration->setContentWidgetData( |
147 new CpSettingFormItemData( |
170 "text", QVariant(hbTrId("Show call duration"))); |
148 HbDataFormModelItem::ToggleValueItem, |
|
149 hbTrId("txt_phone_formlabel_show_call_duration"), |
|
150 this); |
|
151 |
171 if (showCallDurationStatus) { |
152 if (showCallDurationStatus) { |
172 m_DataItemShowCallDuration->setContentWidgetData( |
153 m_DataItemShowCallDuration->setContentWidgetData( |
173 "checkState", QVariant(Qt::Checked)); |
154 "text", QVariant(hbTrId("txt_phone_setlabel_val_yes"))); |
|
155 m_DataItemShowCallDuration->setContentWidgetData( |
|
156 "additionalText", QVariant(hbTrId("txt_phone_setlabel_val_no"))); |
174 } else { |
157 } else { |
175 m_DataItemShowCallDuration->setContentWidgetData( |
158 m_DataItemShowCallDuration->setContentWidgetData( |
176 "checkState", QVariant(Qt::Unchecked)); |
159 "text", QVariant(hbTrId("txt_phone_setlabel_val_no"))); |
177 } |
160 m_DataItemShowCallDuration->setContentWidgetData( |
|
161 "additionalText", QVariant(hbTrId("txt_phone_setlabel_val_yes"))); |
|
162 } |
|
163 |
178 appendChild( m_DataItemShowCallDuration ); |
164 appendChild( m_DataItemShowCallDuration ); |
179 |
|
180 DPRINT << ": OUT"; |
165 DPRINT << ": OUT"; |
181 } |
166 } |
182 |
167 |
183 /*! |
168 /*! |
184 CpCallsPluginGroup::createSoftRejectItem. |
169 CpCallsPluginGroup::createSoftRejectItem. |
245 { |
230 { |
246 DPRINT << ": IN"; |
231 DPRINT << ": IN"; |
247 |
232 |
248 m_DataItemCallWaiting = |
233 m_DataItemCallWaiting = |
249 new CpSettingFormItemData( |
234 new CpSettingFormItemData( |
250 HbDataFormModelItem::ComboBoxItem, |
235 HbDataFormModelItem::ToggleValueItem, |
251 hbTrId("txt_phone_setlabel_call_waiting"), |
236 hbTrId("txt_phone_setlabel_call_waiting"), |
252 this); |
237 this); |
253 QStringList list; |
238 |
254 QMapIterator<int, QString> mapIterator(m_callWaitingSettingMap); |
239 m_DataItemCallWaiting->setContentWidgetData( |
255 while (mapIterator.hasNext()) { |
240 "text", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_check_status"))); |
256 mapIterator.next(); |
241 m_DataItemCallWaiting->setContentWidgetData( |
257 list << mapIterator.value(); |
242 "additionalText", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_check_status"))); |
258 }; |
243 |
259 m_DataItemCallWaiting->setContentWidgetData("items", QVariant(list)); |
|
260 appendChild(m_DataItemCallWaiting); |
244 appendChild(m_DataItemCallWaiting); |
261 |
|
262 DPRINT << ": OUT"; |
245 DPRINT << ": OUT"; |
263 } |
246 } |
264 |
247 |
265 /*! |
248 /*! |
266 CpCallsPluginGroup::connectShowCallDurationItem. |
249 CpCallsPluginGroup::connectShowCallDurationItem. |
320 void CpCallsPluginGroup::connectCallWaitingItem() |
303 void CpCallsPluginGroup::connectCallWaitingItem() |
321 { |
304 { |
322 DPRINT << ": IN"; |
305 DPRINT << ": IN"; |
323 |
306 |
324 m_helper.addConnection( |
307 m_helper.addConnection( |
325 m_DataItemCallWaiting, SIGNAL(currentIndexChanged(int)), |
308 m_DataItemCallWaiting, SIGNAL(clicked()), |
326 this, SLOT(callWaitingCurrentIndexChanged(int))); |
309 this, SLOT(callWaitingCurrentIndexChanged())); |
327 |
310 |
328 DPRINT << ": OUT"; |
311 DPRINT << ": OUT"; |
329 } |
312 } |
330 |
313 |
331 /*! |
314 /*! |
332 CpCallsPluginGroup::showCallDurationStateChanged. |
315 CpCallsPluginGroup::showCallDurationStateChanged. |
333 */ |
316 */ |
334 void CpCallsPluginGroup::showCallDurationStateChanged(int state) |
317 void CpCallsPluginGroup::showCallDurationStateChanged() |
335 { |
318 { |
336 DPRINT << ": IN"; |
319 DPRINT << ": IN"; |
337 |
320 |
338 DPRINT << "state:" << state; |
321 QVariant text = m_DataItemShowCallDuration->contentWidgetData("text"); |
339 if (state == Qt::Checked) { |
322 QString showCallDurationText = text.toString(); |
|
323 |
|
324 if (showCallDurationText == hbTrId("txt_phone_setlabel_val_yes")) { |
340 m_cpSettingsWrapper->setShowCallDuration(true); |
325 m_cpSettingsWrapper->setShowCallDuration(true); |
|
326 } else if (showCallDurationText == hbTrId("txt_phone_setlabel_val_no")){ |
|
327 m_cpSettingsWrapper->setShowCallDuration(false); |
341 } else { |
328 } else { |
342 m_cpSettingsWrapper->setShowCallDuration(false); |
329 DPRINT << "nothing done"; |
343 } |
330 } |
344 |
331 |
345 DPRINT << ": OUT"; |
332 DPRINT << ": OUT"; |
346 } |
333 } |
347 |
334 |
352 { |
339 { |
353 DPRINT << ": IN"; |
340 DPRINT << ": IN"; |
354 |
341 |
355 QVariant text = m_DataItemSoftRejectTextEditor->contentWidgetData("text"); |
342 QVariant text = m_DataItemSoftRejectTextEditor->contentWidgetData("text"); |
356 QString softRejectText = text.toString(); |
343 QString softRejectText = text.toString(); |
357 if (!softRejectText.isNull()) { |
344 if (!softRejectText.isEmpty()) { |
358 DPRINT << "softRejectText:" << softRejectText; |
345 DPRINT << "softRejectText:" << softRejectText; |
359 m_cpSettingsWrapper->writeSoftRejectText(softRejectText, true); |
346 m_cpSettingsWrapper->writeSoftRejectText(softRejectText, true); |
360 } |
347 } |
361 |
348 |
362 DPRINT << ": OUT"; |
349 DPRINT << ": OUT"; |
363 } |
350 } |
364 |
351 |
365 /*! |
352 /*! |
366 CpCallsPluginGroup::callWaitingCurrentIndexChanged. |
353 CpCallsPluginGroup::callWaitingCurrentIndexChanged. |
367 */ |
354 */ |
368 void CpCallsPluginGroup::callWaitingCurrentIndexChanged(int index) |
355 void CpCallsPluginGroup::callWaitingCurrentIndexChanged() |
369 { |
356 { |
370 DPRINT << ": IN"; |
357 DPRINT << ": IN"; |
371 DPRINT << "index:" << index; |
358 |
372 |
359 QVariant text = m_DataItemCallWaiting->contentWidgetData("text"); |
373 if ( index >= 0 ) { |
360 QString callWaitingText = text.toString(); |
374 QString settingMapString = m_callWaitingSettingMap.value(index); |
361 |
375 DPRINT << "settingMapString:" << settingMapString; |
362 if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_check_status")) { |
376 switch (index) { |
363 // Clicked first time, user want to check feature status |
377 case PSetCallWaitingWrapper::ActivateCallWaiting: { |
364 DPRINT << "checking status"; |
378 DPRINT << "activate"; |
365 m_callWaitingWrapper->getCallWaitingStatus(); |
379 m_callWaitingWrapper->setCallWaiting( |
366 } |
380 PSetCallWaitingWrapper::ActivateCallWaiting, |
367 |
381 AllTeleAndBearer); |
368 else if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_on")) { |
382 } |
369 DPRINT << "activate"; |
383 break; |
370 // User want to activate call waiting feature |
384 case PSetCallWaitingWrapper::DeactivateCallWaiting: { |
371 m_callWaitingWrapper->setCallWaiting( |
385 DPRINT << "deactivate"; |
372 PSetCallWaitingWrapper::ActivateCallWaiting, |
386 m_callWaitingWrapper->setCallWaiting( |
373 AllTeleAndBearer); |
387 PSetCallWaitingWrapper::DeactivateCallWaiting, |
374 } |
388 AllTeleAndBearer); |
375 else if (callWaitingText == hbTrId("txt_phone_setlabel_call_waiting_val_off")) { |
389 } |
376 DPRINT << "deactivate"; |
390 break; |
377 // User want to deactivate call waiting feature |
391 case PSetCallWaitingWrapper::CheckCallWaitingStatus: { |
378 m_callWaitingWrapper->setCallWaiting( |
392 DPRINT << "check status"; |
379 PSetCallWaitingWrapper::DeactivateCallWaiting, |
393 m_callWaitingWrapper->getCallWaitingStatus(); |
380 AllTeleAndBearer); |
394 } |
381 } |
395 break; |
382 else { |
396 default: |
383 DPRINT << "nothing done"; |
397 DPRINT << "Error: unknown enum value"; |
384 } |
398 break; |
385 |
399 } |
|
400 } else { |
|
401 DPRINT << "Error: negative index!"; |
|
402 } |
|
403 |
|
404 DPRINT << ": OUT"; |
386 DPRINT << ": OUT"; |
405 } |
387 } |
406 |
388 |
407 /*! |
389 /*! |
408 CpCallsPluginGroup::cliCurrentIndexChanged. |
390 CpCallsPluginGroup::cliCurrentIndexChanged. |
432 |
414 |
433 m_cliSettingMap.insert(ClirNetworkDefault, hbTrId("txt_phone_setlabel_val_default")); |
415 m_cliSettingMap.insert(ClirNetworkDefault, hbTrId("txt_phone_setlabel_val_default")); |
434 m_cliSettingMap.insert(ClirExplicitSuppress, hbTrId("txt_phone_setlabel_val_yes")); |
416 m_cliSettingMap.insert(ClirExplicitSuppress, hbTrId("txt_phone_setlabel_val_yes")); |
435 m_cliSettingMap.insert(ClirExplicitInvoke, hbTrId("txt_phone_setlabel_val_no")); |
417 m_cliSettingMap.insert(ClirExplicitInvoke, hbTrId("txt_phone_setlabel_val_no")); |
436 |
418 |
437 m_callWaitingSettingMap.insert( |
|
438 PSetCallWaitingWrapper::ActivateCallWaiting, hbTrId("txt_phone_setlabel_call_waiting_val_on")); |
|
439 m_callWaitingSettingMap.insert( |
|
440 PSetCallWaitingWrapper::DeactivateCallWaiting, hbTrId("txt_phone_setlabel_call_waiting_val_off")); |
|
441 m_callWaitingSettingMap.insert( |
|
442 PSetCallWaitingWrapper::CheckCallWaitingStatus, hbTrId("Check status")); |
|
443 |
|
444 DPRINT << ": OUT"; |
419 DPRINT << ": OUT"; |
445 } |
420 } |
446 |
421 |
447 /*! |
422 /*! |
448 CpCallsPluginGroup::handleCallWaitingGetStatus. |
423 CpCallsPluginGroup::handleCallWaitingGetStatus. |
449 */ |
424 */ |
450 void CpCallsPluginGroup::handleCallWaitingGetStatus( |
425 void CpCallsPluginGroup::handleCallWaitingGetStatus( |
451 PSetCallWaitingWrapper::PsCallWaitingStatus status, |
426 PSetCallWaitingWrapper::PsCallWaitingStatus status, |
452 const QList<unsigned char> &basicServiceGroupIds) |
427 const QList<unsigned char> &basicServiceGroupIds) |
453 { |
428 { |
454 DPRINT << ": IN"; |
429 DPRINT << ": IN status: " << status; |
|
430 // This happens only in the very first time when clicked. |
|
431 |
455 emit cancelNote(m_activeNoteId); |
432 emit cancelNote(m_activeNoteId); |
456 |
433 |
|
434 bool alsCaseOnly = false; |
|
435 if (1 == basicServiceGroupIds.count() && |
|
436 AltTele == static_cast<BasicServiceGroups>(basicServiceGroupIds.at(0))) { |
|
437 DPRINT << "Status is only for als"; |
|
438 alsCaseOnly = true; |
|
439 } |
|
440 |
457 if (m_callWaitingDistinguishEnabled && |
441 if (m_callWaitingDistinguishEnabled && |
458 status == PSetCallWaitingWrapper::StatusNotProvisioned) { |
442 PSetCallWaitingWrapper::StatusNotProvisioned == status) { |
459 emit showGlobalNote(m_activeNoteId, |
443 DPRINT << ": not provisioned"; |
460 hbTrId("txt_phone_info_request_not_completed"), HbMessageBox::MessageTypeInformation); |
|
461 } else if (status != PSetCallWaitingWrapper::StatusActive) { |
|
462 emit showGlobalNote(m_activeNoteId, |
444 emit showGlobalNote(m_activeNoteId, |
463 hbTrId("txt_phone_info_call_waiting_deactivated"), HbMessageBox::MessageTypeInformation); |
445 hbTrId("txt_phone_info_request_not_completed"), |
|
446 HbMessageBox::MessageTypeInformation); |
|
447 } else if (PSetCallWaitingWrapper::StatusActive == status && !alsCaseOnly) { |
|
448 DPRINT << ": status active"; |
|
449 m_DataItemCallWaiting->setContentWidgetData( |
|
450 "text", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_on"))); |
|
451 m_DataItemCallWaiting->setContentWidgetData( |
|
452 "additionalText", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_off"))); |
|
453 |
464 } else { |
454 } else { |
465 emit showGlobalNote(m_activeNoteId, |
455 DPRINT << ": status not active"; |
466 hbTrId("txt_phone_info_call_waiting_activated"), HbMessageBox::MessageTypeInformation); |
456 m_DataItemCallWaiting->setContentWidgetData( |
467 } |
457 "text", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_off"))); |
468 |
458 m_DataItemCallWaiting->setContentWidgetData( |
|
459 "additionalText", QVariant(hbTrId("txt_phone_setlabel_call_waiting_val_on"))); |
|
460 } |
|
461 |
469 DPRINT << ": OUT"; |
462 DPRINT << ": OUT"; |
470 } |
463 } |
471 |
464 |
472 /*! |
465 /*! |
473 CpCallsPluginGroup::handleCallWaitingChanged. |
466 CpCallsPluginGroup::handleCallWaitingChanged. |