56 ***************************************************************** |
56 ***************************************************************** |
57 */ |
57 */ |
58 CpDeviceLockPluginView::CpDeviceLockPluginView(QGraphicsItem *parent /*= 0*/) |
58 CpDeviceLockPluginView::CpDeviceLockPluginView(QGraphicsItem *parent /*= 0*/) |
59 : CpBaseSettingView(0,parent) |
59 : CpBaseSettingView(0,parent) |
60 { |
60 { |
|
61 RDEBUG("0", 0); |
|
62 processingRequest=0; |
61 QTranslator *translator = new QTranslator(); |
63 QTranslator *translator = new QTranslator(); |
62 QString lang = QLocale::system().name(); |
64 QString lang = QLocale::system().name(); |
63 QString path = "Z:/resource/qt/translations/"; |
65 QString path = "Z:/resource/qt/translations/"; |
64 bool fine = translator->load("devicelocking_en.qm", path); |
66 bool fine = translator->load("devicelocking_en.qm", path); |
65 if (fine) |
67 if (fine) |
79 mRemoteLockSettingClicked = false; |
81 mRemoteLockSettingClicked = false; |
80 mHack = 0; |
82 mHack = 0; |
81 HbDataForm *form = qobject_cast<HbDataForm*> (widget()); |
83 HbDataForm *form = qobject_cast<HbDataForm*> (widget()); |
82 if (form) |
84 if (form) |
83 { |
85 { |
|
86 RDEBUG("0", 0); |
84 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( |
87 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( |
85 Qt::Vertical); |
88 Qt::Vertical); |
86 QList<HbAbstractViewItem *> protoTypeList = form->itemPrototypes(); |
89 QList<HbAbstractViewItem *> protoTypeList = form->itemPrototypes(); |
87 protoTypeList.append(new CpRemoteLockDataFormViewItem()); |
90 protoTypeList.append(new CpRemoteLockDataFormViewItem()); |
88 form->setItemPrototypes(protoTypeList); |
91 form->setItemPrototypes(protoTypeList); |
101 lockCodeItem->setContentWidgetData("text", "1234"); |
104 lockCodeItem->setContentWidgetData("text", "1234"); |
102 lockCodeItem->setContentWidgetData("readonly", true); |
105 lockCodeItem->setContentWidgetData("readonly", true); |
103 form->addConnection(lockCodeItem, SIGNAL(clicked()), this, |
106 form->addConnection(lockCodeItem, SIGNAL(clicked()), this, |
104 SLOT(onLockCodeClicked())); |
107 SLOT(onLockCodeClicked())); |
105 formModel->appendDataFormItem(lockCodeItem); |
108 formModel->appendDataFormItem(lockCodeItem); |
|
109 RDEBUG("0", 0); |
106 |
110 |
107 //Autolock period |
111 //Autolock period |
108 mAutolockPeriodItem = new HbDataFormModelItem( |
112 mAutolockPeriodItem = new HbDataFormModelItem( |
109 HbDataFormModelItem::ComboBoxItem, hbTrId( |
113 HbDataFormModelItem::ComboBoxItem, hbTrId( |
110 "txt_devicelocking_formlabel_automatic_locking")); |
114 "txt_devicelocking_formlabel_automatic_locking")); |
205 hbTrId("txt_devicelocking_formlabel_locking_message")); |
209 hbTrId("txt_devicelocking_formlabel_locking_message")); |
206 mRemoteLockMessageItem->setContentWidgetData("echoMode", |
210 mRemoteLockMessageItem->setContentWidgetData("echoMode", |
207 HbLineEdit::Password); |
211 HbLineEdit::Password); |
208 mRemoteLockMessageItem->setContentWidgetData("text", "1111"); |
212 mRemoteLockMessageItem->setContentWidgetData("text", "1111"); |
209 mRemoteLockMessageItem->setContentWidgetData("readOnly", true); |
213 mRemoteLockMessageItem->setContentWidgetData("readOnly", true); |
|
214 RDEBUG("0", 0); |
210 |
215 |
211 if (mPrevRemLockData.toString() == hbTrId( |
216 if (mPrevRemLockData.toString() == hbTrId( |
212 "txt_devicelocking_button_remote_on")) |
217 "txt_devicelocking_button_remote_on")) |
213 mRemoteLockMessageItem->setEnabled(true); |
218 mRemoteLockMessageItem->setEnabled(true); |
214 else |
219 else |
248 ***************************************************************** |
255 ***************************************************************** |
249 */ |
256 */ |
250 void CpDeviceLockPluginView::onLockCodeClicked() |
257 void CpDeviceLockPluginView::onLockCodeClicked() |
251 { |
258 { |
252 Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Enter")); |
259 Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Enter")); |
253 RDEBUG("0", 0); |
260 RDEBUG("processingRequest", processingRequest); |
254 mUiSecuSettings->ChangeSecCodeL(); |
261 if(!processingRequest) |
|
262 mUiSecuSettings->ChangeSecCodeL(); |
|
263 processingRequest=0; |
255 Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Exit")); |
264 Dprint(_L("CpDeviceLockPluginView::onLockCodeClicked()..Exit")); |
256 } |
265 } |
257 |
266 |
258 |
267 |
259 /* |
268 /* |
266 */ |
275 */ |
267 void CpDeviceLockPluginView::onAutoLockChanged(int index) |
276 void CpDeviceLockPluginView::onAutoLockChanged(int index) |
268 { |
277 { |
269 Dprint(_L("CpDeviceLockPluginView::onAutoLockChanged()..Enter")); |
278 Dprint(_L("CpDeviceLockPluginView::onAutoLockChanged()..Enter")); |
270 RDEBUG("index", index); |
279 RDEBUG("index", index); |
|
280 RDEBUG("processingRequest", processingRequest); |
271 if (index != mThemeComboPrevIndex) |
281 if (index != mThemeComboPrevIndex) |
272 { |
282 { |
273 //TODO: need to set user entered/selected value |
283 //TODO: need to set user entered/selected value |
274 TInt lockValue = GetValueAtIndex(index); |
284 TInt lockValue = GetValueAtIndex(index); |
275 TInt newAutoLockVal = mUiSecuSettings->ChangeAutoLockPeriodL( |
285 TInt newAutoLockVal = mUiSecuSettings->ChangeAutoLockPeriodL( |
309 ************************************************************************** |
319 ************************************************************************** |
310 */ |
320 */ |
311 void CpDeviceLockPluginView::onLockMessageClicked() |
321 void CpDeviceLockPluginView::onLockMessageClicked() |
312 { |
322 { |
313 Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..Exit")); |
323 Dprint(_L("CpDeviceLockPluginView::onLockMessageClicked()..Exit")); |
314 RDEBUG("0", 0); |
324 RDEBUG("processingRequest", processingRequest); |
315 TBuf<KRLockMaxLockCodeLength> remoteLockCode; |
325 TBuf<KRLockMaxLockCodeLength> remoteLockCode; |
316 TBool remoteLockStatus(EFalse); |
326 TBool remoteLockStatus(EFalse); |
317 TInt retVal = KErrNone; |
327 TInt retVal = KErrNone; |
318 TInt autoLockVal = -1; |
328 TInt autoLockVal = -1; |
319 retVal = mUiSecuSettings->ChangeRemoteLockStatusL(remoteLockStatus, |
329 retVal = mUiSecuSettings->ChangeRemoteLockStatusL(remoteLockStatus, |
350 |
360 |
351 #if 0 |
361 #if 0 |
352 void CpDeviceLockPluginView::onAutoTextChanged(const QString& aText) |
362 void CpDeviceLockPluginView::onAutoTextChanged(const QString& aText) |
353 { |
363 { |
354 Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Enter")); |
364 Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Enter")); |
355 RDEBUG("0", 0); |
365 RDEBUG("processingRequest", processingRequest); |
356 //TBool ret = DisplaySecurityDialog(); |
366 //TBool ret = DisplaySecurityDialog(); |
357 Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Exit")); |
367 Dprint(_L("CpDeviceLockPluginView::onAutoTextChanged()..Exit")); |
358 RDEBUG("0", 0); |
368 RDEBUG("99", 0x99); |
359 } |
369 } |
360 #endif |
370 #endif |
361 |
371 |
362 /* |
372 /* |
363 ************************************************************************* |
373 ************************************************************************* |
369 */ |
379 */ |
370 void CpDeviceLockPluginView::onRemoteLockDataChanged(QModelIndex aStartIn,QModelIndex aEndIn) |
380 void CpDeviceLockPluginView::onRemoteLockDataChanged(QModelIndex aStartIn,QModelIndex aEndIn) |
371 { |
381 { |
372 Q_UNUSED(aEndIn); |
382 Q_UNUSED(aEndIn); |
373 Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..Enter")); |
383 Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..Enter")); |
374 RDEBUG("0", 0); |
384 RDEBUG("processingRequest", processingRequest); |
375 HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); |
385 HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); |
376 |
386 |
377 if ((item->type() == HbDataFormModelItem::ToggleValueItem) |
387 if ((item->type() == HbDataFormModelItem::ToggleValueItem) |
378 && (item->data(HbDataFormModelItem::LabelRole).toString() |
388 && (item->data(HbDataFormModelItem::LabelRole).toString() |
379 == hbTrId("txt_devicelocking_subhead_remote_locking"))) |
389 == hbTrId("txt_devicelocking_subhead_remote_locking"))) |
388 } |
398 } |
389 else |
399 else |
390 { |
400 { |
391 mHack++; |
401 mHack++; |
392 } |
402 } |
393 /****************************************************************************************************************/ |
403 ****************************************************************************************************************/ |
394 TInt autoLockVal; |
404 TInt autoLockVal; |
395 TInt retVal = KErrNone; |
405 TInt retVal = KErrNone; |
396 TBuf<KRLockMaxLockCodeLength> remoteLockCode; |
406 TBuf<KRLockMaxLockCodeLength> remoteLockCode; |
397 TBool remoteLockStatus(EFalse); |
407 TBool remoteLockStatus(EFalse); |
398 CRemoteLockSettings *remoteLockSetting = CRemoteLockSettings::NewL(); |
408 CRemoteLockSettings *remoteLockSetting = CRemoteLockSettings::NewL(); |
421 RDEBUG("remoteLockStatus", remoteLockStatus); |
431 RDEBUG("remoteLockStatus", remoteLockStatus); |
422 if (remoteLockStatus) |
432 if (remoteLockStatus) |
423 { |
433 { |
424 if (remoteLockSetting->SetEnabledL(remoteLockCode)) |
434 if (remoteLockSetting->SetEnabledL(remoteLockCode)) |
425 { |
435 { |
426 Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL success")); |
436 RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL success",1); |
427 RDEBUG("success", 1); |
437 RDEBUG("success", 1); |
428 mPrevRemLockData |
438 mPrevRemLockData |
429 = mDeviceRemoteLockItem->contentWidgetData( |
439 = mDeviceRemoteLockItem->contentWidgetData( |
430 QString("text")); |
440 QString("text")); |
431 mRemoteLockMessageItem->setEnabled(true); |
441 RDEBUG("calling setEnabled", 0); |
|
442 mRemoteLockMessageItem->setEnabled(true); |
432 } |
443 } |
433 else |
444 else |
434 { |
445 { |
435 RollbackRemoteLockSettingState(); |
446 RollbackRemoteLockSettingState(); |
436 Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL failed")); |
447 RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetEnabledL failed",0); |
437 RDEBUG("failed", 0); |
448 RDEBUG("failed", 0); |
438 } |
449 } |
439 } |
450 } |
440 else |
451 else |
441 { |
452 { |
442 if (mRemoteLockSettings->SetDisabled()) |
453 if (mRemoteLockSettings->SetDisabled()) |
443 { |
454 { |
444 Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled success")); |
455 RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled success",1); |
445 RDEBUG("success", 1); |
456 RDEBUG("success", 1); |
446 mPrevRemLockData |
457 mPrevRemLockData |
447 = mDeviceRemoteLockItem->contentWidgetData( |
458 = mDeviceRemoteLockItem->contentWidgetData( |
448 QString("text")); |
459 QString("text")); |
|
460 RDEBUG("calling setEnabled", 0); |
|
461 mRemoteLockMessageItem->setEnabled(false); // this calls onSIMLockDataChanged ? |
449 } |
462 } |
450 else |
463 else |
451 { |
464 { |
452 RollbackRemoteLockSettingState(); |
465 RollbackRemoteLockSettingState(); |
453 Dprint(_L("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled failed")); |
466 RDEBUG("CpDeviceLockPluginView::onRemoteLockDataChanged..remoteLockSetting->SetDisabled failed",0); |
454 RDEBUG("failed", 0); |
467 RDEBUG("failed", 0); |
455 } |
468 } |
456 } |
469 } |
457 } |
470 } |
458 else |
471 else |
478 ************************************************************************** |
491 ************************************************************************** |
479 */ |
492 */ |
480 void CpDeviceLockPluginView::onSIMLockDataChanged(QModelIndex aStartIn, QModelIndex aEndIn) |
493 void CpDeviceLockPluginView::onSIMLockDataChanged(QModelIndex aStartIn, QModelIndex aEndIn) |
481 { |
494 { |
482 Q_UNUSED(aEndIn); |
495 Q_UNUSED(aEndIn); |
|
496 RDEBUG("processingRequest", processingRequest); |
483 HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); |
497 HbDataFormModelItem *item = formModel->itemFromIndex(aStartIn); |
484 |
498 |
485 if ((item->type() == HbDataFormModelItem::ToggleValueItem) |
499 if ((item->type() == HbDataFormModelItem::ToggleValueItem) |
486 && (item->data(HbDataFormModelItem::LabelRole).toString() |
500 && (item->data(HbDataFormModelItem::LabelRole).toString() |
487 == hbTrId( |
501 == hbTrId( |
488 "txt_devicelocking_formlabel_lock_when_sim_changed"))) |
502 "txt_devicelocking_formlabel_lock_when_sim_changed"))) |
489 { |
503 { |
490 RDEBUG("mHack", mHack); |
504 RDEBUG("mHack", mHack); |
491 //The following If-Else condition should be removed once orbit team fix the issue with datachanged() signal |
505 //The following If-Else condition should be removed once orbit team fix the issue with datachanged() signal |
492 /****************************************************************************************************************/ |
506 /**************************************************************************************************************** |
493 if ((mHack % 2) == 0) //need to capture second datachanged() signal , not first one. |
507 if ((mHack % 2) == 0) //need to capture second datachanged() signal , not first one. |
494 { |
508 { |
495 mHack++; |
509 mHack++; |
496 return; |
510 return; |
497 } |
511 } |
498 else |
512 else |
499 { |
513 { |
500 mHack++; |
514 mHack++; |
501 } |
515 } |
502 /****************************************************************************************************************/ |
516 ****************************************************************************************************************/ |
503 |
517 |
504 TBool ret = mUiSecuSettings->ChangeSimSecurityL(); |
518 TBool ret = mUiSecuSettings->ChangeSimSecurityL(); |
505 RDEBUG("ret", ret); |
519 RDEBUG("ret", ret); |
506 if (!ret) |
520 if (!ret) |
507 { |
521 { |
527 */ |
541 */ |
528 connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), |
542 connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), |
529 this, SLOT(onSIMLockDataChanged(QModelIndex,QModelIndex))); |
543 this, SLOT(onSIMLockDataChanged(QModelIndex,QModelIndex))); |
530 } |
544 } |
531 } |
545 } |
|
546 else |
|
547 { |
|
548 RDEBUG("Nothing to do", 0); |
|
549 } |
|
550 RDEBUG("99", 0x99); |
532 } |
551 } |
533 |
552 |
534 |
553 |
535 /* |
554 /* |
536 ************************************************************************* |
555 ************************************************************************* |
637 * Now connect back to datachanged() signal . |
656 * Now connect back to datachanged() signal . |
638 */ |
657 */ |
639 connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, |
658 connect(formModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), this, |
640 SLOT(onRemoteLockDataChanged(QModelIndex,QModelIndex))); |
659 SLOT(onRemoteLockDataChanged(QModelIndex,QModelIndex))); |
641 |
660 |
|
661 RDEBUG("0", 0); |
642 if (mPrevRemLockData.toString() == hbTrId( |
662 if (mPrevRemLockData.toString() == hbTrId( |
643 "txt_devicelocking_button_remote_on")) |
663 "txt_devicelocking_button_remote_on")) |
644 mRemoteLockMessageItem->setEnabled(true); |
664 mRemoteLockMessageItem->setEnabled(true); |
645 else |
665 else |
646 mRemoteLockMessageItem->setEnabled(false); |
666 mRemoteLockMessageItem->setEnabled(false); |
647 RDEBUG("0", 0); |
667 RDEBUG("99", 0x99); |
648 } |
668 } |
|
669 |