253 RDEBUG("1", 1); |
253 RDEBUG("1", 1); |
254 } |
254 } |
255 |
255 |
256 // ---------------------------------------------------------------------------- |
256 // ---------------------------------------------------------------------------- |
257 // SecUiNotificationDialog::constructDialog() |
257 // SecUiNotificationDialog::constructDialog() |
|
258 // This is be called many times, because every key is sent (for checking Emergency and TARM repeat-characters policy). In these cases, the dialog is not created. It returns half-way. |
258 // ---------------------------------------------------------------------------- |
259 // ---------------------------------------------------------------------------- |
259 // |
260 // |
260 bool SecUiNotificationDialog::constructDialog(const QVariantMap ¶meters) |
261 bool SecUiNotificationDialog::constructDialog(const QVariantMap ¶meters) |
261 { |
262 { |
262 RDEBUG("0", 0); |
263 RDEBUG("0", 0); |
263 RDEBUG("mMyId", mMyId); |
264 RDEBUG("mMyId", mMyId); |
264 setTimeout(HbPopup::NoTimeout); |
265 setTimeout(HbPopup::NoTimeout); |
265 setDismissPolicy(HbPopup::NoDismiss); |
266 setDismissPolicy(HbPopup::NoDismiss); |
266 setModal(true); |
267 setModal(true); |
267 mShowEventReceived = false; |
268 mShowEventReceived = false; |
268 subscriberKSecurityUIsDismissDialog = NULL; |
|
269 titleWidget = NULL; |
269 titleWidget = NULL; |
270 RDEBUG("subscriberKSecurityUIsDismissDialog NULL", 0); |
|
271 |
|
272 subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this); |
|
273 if(subscriberKSecurityUIsDismissDialog) |
|
274 { |
|
275 RDEBUG("subscriberKSecurityUIsDismissDialog created", 1); |
|
276 } |
|
277 else |
|
278 { |
|
279 RDEBUG("subscriberKSecurityUIsDismissDialog not created", 0); |
|
280 } |
|
281 connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); |
|
282 RDEBUG("subscriberKSecurityUIsDismissDialog", 1); |
|
283 |
270 |
284 // Title |
271 // Title |
285 // this is also done later in the widget |
272 // this is also done later in the widget |
286 // For now, it only says "Security" |
273 // For now, it only says "Security" |
287 if (parameters.contains(KDialogTitle)) { |
274 if (parameters.contains(KDialogTitle)) { |
303 } |
290 } |
304 titleText = hbTrId("Security Query"); // this is the header, for any potential later error which needs to be displayed |
291 titleText = hbTrId("Security Query"); // this is the header, for any potential later error which needs to be displayed |
305 // This is created only if needed (i.e. errors for NewLockCode) |
292 // This is created only if needed (i.e. errors for NewLockCode) |
306 // titleWidget = new HbLabel(titleText); |
293 // titleWidget = new HbLabel(titleText); |
307 // setHeadingWidget(titleWidget); |
294 // setHeadingWidget(titleWidget); |
308 } |
295 } // KDialogTitle |
309 |
296 |
310 if (parameters.contains(KEmergency)) { |
297 if (parameters.contains(KEmergency)) { |
311 RDEBUG("KEmergency", 1); |
298 RDEBUG("KEmergency", 1); |
312 QString emergencyText = parameters.value(KEmergency).toString(); |
299 QString emergencyText = parameters.value(KEmergency).toString(); |
313 RDEBUGQT("emergencyText", emergencyText); |
300 RDEBUGQT("emergencyText", emergencyText); |
315 { |
302 { |
316 RDEBUG("emergencyYes", 1); |
303 RDEBUG("emergencyYes", 1); |
317 isEmergency = 1; |
304 isEmergency = 1; |
318 okAction->setEnabled(true); |
305 okAction->setEnabled(true); |
319 okAction->setText(hbTrId("Call")); |
306 okAction->setText(hbTrId("Call")); |
|
307 if (queryType & ESecUiSecretSupported) |
|
308 { |
|
309 RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); |
|
310 codeTop->setEchoMode(HbLineEdit::Normal); |
|
311 QString codeTopText = codeTop->text(); |
|
312 RDEBUGQT("codeTop->text()", codeTop->text()); |
|
313 codeTop->setText(codeTopText); // this time, display the characters . Not use "Emergency" because 1123 will need to restore from 112. |
|
314 // note that this is not needed. 112 will soh. However, this will move the cursor to the end, as expected. |
|
315 } |
320 return true; |
316 return true; |
321 } |
317 } |
322 if(!emergencyText.compare("emergencyNo")) |
318 if(!emergencyText.compare("emergencyNo")) |
323 { |
319 { |
324 RDEBUG("emergencyNo", 1); |
320 RDEBUG("emergencyNo", 1); |
325 isEmergency = 0; |
321 isEmergency = 0; |
326 okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength |
322 okAction->setEnabled(false); // 112 -> 1122 (=password) . This is handled by < lMinLength |
327 okAction->setText(hbTrId("Ok")); |
323 okAction->setText(hbTrId("Ok")); |
|
324 if (queryType & ESecUiSecretSupported) |
|
325 { |
|
326 RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); |
|
327 codeTop->setEchoMode(HbLineEdit::Password); |
|
328 } |
|
329 else |
|
330 { |
|
331 RDEBUG("ESecUiSecretNotSupported", ESecUiSecretNotSupported); |
|
332 codeTop->setEchoMode(HbLineEdit::Normal); |
|
333 } |
328 return true; |
334 return true; |
329 } |
335 } |
330 } |
336 } // KEmergency |
331 // after TARM validation. |
337 // after TARM validation. |
332 if (parameters.contains(KInvalidNewLockCode)) { |
338 if (parameters.contains(KInvalidNewLockCode)) { |
333 RDEBUG("KInvalidNewLockCode", 0); |
339 RDEBUG("KInvalidNewLockCode", 0); |
334 QString invalidText = parameters.value(KInvalidNewLockCode).toString(); |
340 QString invalidText = parameters.value(KInvalidNewLockCode).toString(); |
335 RDEBUGQT("invalidText", invalidText); |
341 RDEBUGQT("invalidText", invalidText); |
455 codeBottom->setText(""); |
461 codeBottom->setText(""); |
456 okAction->setText(hbTrId("Ok")); |
462 okAction->setText(hbTrId("Ok")); |
457 } |
463 } |
458 // need to return because all objects are already created |
464 // need to return because all objects are already created |
459 return true; |
465 return true; |
460 } |
466 } // KInvalidNewLockCode |
461 |
467 |
|
468 subscriberKSecurityUIsDismissDialog = NULL; |
|
469 RDEBUG("subscriberKSecurityUIsDismissDialog NULL", 0); |
|
470 |
|
471 subscriberKSecurityUIsDismissDialog = new QValueSpaceSubscriber("/KPSUidSecurityUIs/KSecurityUIsDismissDialog", this); |
|
472 if(subscriberKSecurityUIsDismissDialog) |
|
473 { |
|
474 RDEBUG("subscriberKSecurityUIsDismissDialog created", 1); |
|
475 } |
|
476 else |
|
477 { |
|
478 RDEBUG("subscriberKSecurityUIsDismissDialog not created", 0); |
|
479 } |
|
480 connect(subscriberKSecurityUIsDismissDialog, SIGNAL(contentsChanged()), this, SLOT(subscriberKSecurityUIsDismissDialogChanged())); |
|
481 RDEBUG("subscriberKSecurityUIsDismissDialog", 1); |
|
482 |
462 // Content |
483 // Content |
463 SecUiNotificationContentWidget *content = new SecUiNotificationContentWidget(); |
484 SecUiNotificationContentWidget *content = new SecUiNotificationContentWidget(); |
464 content->constructFromParameters(parameters); |
485 content->constructFromParameters(parameters); |
465 setContentWidget(content); |
486 setContentWidget(content); |
466 |
487 |
652 // |
673 // |
653 void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) |
674 void SecUiNotificationDialog::handleCodeTopChanged(const QString &text) |
654 { |
675 { |
655 RDEBUG("0", 0); |
676 RDEBUG("0", 0); |
656 RDEBUGQT("text", text); |
677 RDEBUGQT("text", text); |
|
678 RDEBUGQT("codeTop->text()", codeTop->text()); |
|
679 RDEBUGQT("codeTopTextPrev", codeTopTextPrev); |
|
680 if(!codeTopTextPrev.compare(text)) |
|
681 { |
|
682 RDEBUG("Strings are same. Nothing to do. return", 0); |
|
683 return; |
|
684 } |
|
685 codeTopTextPrev = text; |
657 if(queryDual) |
686 if(queryDual) |
658 { |
687 { |
659 codeBottom->setText(""); // any change resets the verification. |
688 codeBottom->setText(""); // any change resets the verification. |
660 if( (queryType & ESecUiMaskType) == 0x000004 ) // new codeLock |
689 if( (queryType & ESecUiMaskType) == 0x000004 ) // new codeLock |
661 { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword |
690 { // ChangeSecCodeParamsL change RMobilePhone::ESecurityCodePhonePassword |
667 else if(text.length() < lMinLength ) |
696 else if(text.length() < lMinLength ) |
668 { |
697 { |
669 RDEBUGQT("too short text", text); |
698 RDEBUGQT("too short text", text); |
670 okAction->setEnabled(false); |
699 okAction->setEnabled(false); |
671 RDEBUG("lEmergencySupported", lEmergencySupported); |
700 RDEBUG("lEmergencySupported", lEmergencySupported); |
672 if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits |
701 if( lEmergencySupported && text.length() <= 2 ) |
|
702 { |
|
703 if (queryType & ESecUiSecretSupported) |
|
704 { |
|
705 RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); |
|
706 codeTop->setEchoMode(HbLineEdit::Password); |
|
707 } |
|
708 } |
|
709 else if( lEmergencySupported && text.length() > 2 ) // emergency numbers need at least 3 digits |
673 { // check whether it's a emergency number |
710 { // check whether it's a emergency number |
674 QVariant codeTopVar(text); |
711 QVariant codeTopVar(text); |
675 mResultMap.insert(KCodeTopIndex, codeTopVar); |
712 mResultMap.insert(KCodeTopIndex, codeTopVar); |
676 sendResult(KErrAbort); // send the current password back to the client. Perhaps it's an emergency number and decides to Ok->Call |
713 sendResult(KErrAbort); // send the current password back to the client. Perhaps it's an emergency number and decides to Ok->Call |
677 } |
714 } |
679 else if (text.length() >= lMinLength) |
716 else if (text.length() >= lMinLength) |
680 { |
717 { |
681 // might use a flag to avoid re-setting. But this complicates things if there's another initial verification |
718 // might use a flag to avoid re-setting. But this complicates things if there's another initial verification |
682 RDEBUGQT("long enough text", text); |
719 RDEBUGQT("long enough text", text); |
683 okAction->setText(hbTrId("Ok")); |
720 okAction->setText(hbTrId("Ok")); |
|
721 RDEBUG("queryDual", queryDual); |
|
722 RDEBUG("isEmergency", isEmergency); |
684 if(queryDual==0) // only if Bottom is not used |
723 if(queryDual==0) // only if Bottom is not used |
685 okAction->setEnabled(true); |
724 { |
|
725 if (isEmergency == 1) // transition emergencyYes->emergencyNo |
|
726 { |
|
727 RDEBUG("new isEmergency", isEmergency); |
|
728 if (queryType & ESecUiSecretSupported) |
|
729 { |
|
730 RDEBUG("ESecUiSecretSupported", ESecUiSecretSupported); |
|
731 codeTop->setEchoMode(HbLineEdit::Password); |
|
732 } |
|
733 else |
|
734 { |
|
735 RDEBUG("ESecUiSecretNotSupported", ESecUiSecretNotSupported); |
|
736 codeTop->setEchoMode(HbLineEdit::Normal); |
|
737 } |
|
738 } |
|
739 isEmergency = 0; |
|
740 okAction->setEnabled(true); // 112 -> 1122 (=password) . This is handled by < lMinLength |
|
741 okAction->setText(hbTrId("Ok")); |
|
742 } |
686 } |
743 } |
687 QVariant codeTopVar(text); |
744 QVariant codeTopVar(text); |
688 mResultMap.insert(KCodeTopIndex, codeTopVar); |
745 mResultMap.insert(KCodeTopIndex, codeTopVar); |
689 } |
746 } |
690 // ---------------------------------------------------------------------------- |
747 // ---------------------------------------------------------------------------- |
785 QString codeTopText = codeTop->text(); |
842 QString codeTopText = codeTop->text(); |
786 RDEBUG("codeTopText", 0); |
843 RDEBUG("codeTopText", 0); |
787 RDEBUGQT("codeTopText", codeTopText); |
844 RDEBUGQT("codeTopText", codeTopText); |
788 codeTopText = codeTopText + "5" ; |
845 codeTopText = codeTopText + "5" ; |
789 RDEBUGQT("codeTopText+5", codeTopText); |
846 RDEBUGQT("codeTopText+5", codeTopText); |
790 codeTop->setEchoMode(HbLineEdit::PasswordEchoOnEdit); |
847 codeTop->setEchoMode(HbLineEdit::Password); |
791 RDEBUGQT("codeTopText", codeTopText); |
848 RDEBUGQT("codeTopText", codeTopText); |
792 codeTop->setText(codeTopText); |
849 codeTop->setText(codeTopText); |
793 RDEBUG("setFocus", 0); |
850 RDEBUG("setFocus", 0); |
794 codeTop->setFocus(); |
851 codeTop->setFocus(); |
795 RDEBUG("1", 1); |
852 RDEBUG("1", 1); |