20 #include <hb/hbcore/hbdevicedialogsymbian.h> // CHbDeviceDialogSymbian |
20 #include <hb/hbcore/hbdevicedialogsymbian.h> // CHbDeviceDialogSymbian |
21 #include <hb/hbcore/hbsymbianvariant.h> // CHbSymbianVariantMap |
21 #include <hb/hbcore/hbsymbianvariant.h> // CHbSymbianVariantMap |
22 #include <apgicnfl.h> // CApaMaskedBitmap |
22 #include <apgicnfl.h> // CApaMaskedBitmap |
23 #include <securityuisprivatepskeys.h> |
23 #include <securityuisprivatepskeys.h> |
24 |
24 |
25 #include <CPhCltEmergencyCall.h> |
25 #include <cphcltemergencycall.h> |
26 #include <SCPClient.h> |
26 #include <SCPClient.h> |
27 #include "SecUiWait.h" |
27 #include "SecUi.h" |
28 |
|
29 // Variant map keys for notification device dialog |
|
30 _LIT( KNotifDeviceDialogKeyTimeOut, "timeout" ); |
|
31 _LIT( KNotifDeviceDialogKeyIconName, "iconName" ); |
|
32 _LIT( KNotifDeviceDialogKeyText, "text" ); |
|
33 _LIT( KNotifDeviceDialogKeyTitle, "title" ); |
|
34 _LIT( KNotifDeviceDialogKeyTouchActivation, "touchActivation" ); |
|
35 _LIT( KNotifDeviceDialogKeyActivated, "result" ); |
|
36 _LIT( KNotifDeviceDialogKeyActivatedValue, "activated" ); |
|
37 _LIT( KNotifDeviceDialogKeyTitleTextWrapping, "titleTextWrapping" ); |
|
38 |
28 |
39 const TUid KSWInstHelpUid = |
29 const TUid KSWInstHelpUid = |
40 { |
30 { |
41 0x101F8512 |
31 0x101F8512 |
42 }; // TODO |
32 }; // TODO |
107 RDEBUG("aMode", aMode); |
97 RDEBUG("aMode", aMode); |
108 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
98 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
109 TInt err = RProperty::Get(KPSUidSecurityUIs, |
99 TInt err = RProperty::Get(KPSUidSecurityUIs, |
110 KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
100 KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
111 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
101 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
112 if (secUiOriginatedQuery != ESecurityUIsSecUIOriginatedUninitialized) |
102 if (secUiOriginatedQuery == ESecurityUIsSecUIOriginatedUninitialized ) // && ) |
113 { |
|
114 // The query is already shown. This is valid for ESecurityUIsSecUIOriginated, and maybe for ESecurityUIsETelAPIOriginated |
|
115 // For ESecurityUIsSystemLockOriginated it means that the "lock" dialog is already present. |
|
116 // What to do? Can't dismiss the dialog because it's not owned. Can't device-unlock without asking code. Only can disable keyguard |
|
117 RDEBUG("!!!! warning: secUiOriginatedQuery", secUiOriginatedQuery); |
|
118 } |
|
119 else |
|
120 { |
103 { |
121 // set only if not set |
104 // set only if not set |
122 err = RProperty::Set(KPSUidSecurityUIs, |
105 err = RProperty::Set(KPSUidSecurityUIs, |
123 KSecurityUIsSecUIOriginatedQuery, |
106 KSecurityUIsSecUIOriginatedQuery, |
124 ESecurityUIsETelAPIOriginated); |
107 ESecurityUIsETelAPIOriginated); |
125 RDEBUG("setting secUiOriginatedQuery", ESecurityUIsETelAPIOriginated); |
108 RDEBUG("setting secUiOriginatedQuery", ESecurityUIsETelAPIOriginated); |
126 } |
109 } |
127 |
110 else if ( secUiOriginatedQuery != ESecurityUIsSecUIOriginated ) |
|
111 { |
|
112 RDEBUG("!!!! warning: secUiOriginatedQuery", secUiOriginatedQuery); |
|
113 // The query is already shown. This is valid for ESecurityUIsSecUIOriginated, and maybe for ESecurityUIsETelAPIOriginated |
|
114 // For ESecurityUIsSystemLockOriginated it means that the "lock" dialog is already present. |
|
115 // Try to dismiss the dialog. Do same as CSecurityHandler::CancelSecCodeQuery |
|
116 TInt aDismissDialog = -1; |
|
117 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsDismissDialog, aDismissDialog); |
|
118 // it might happen that the dialog is already dismissing. Well, it won't harm to try again. |
|
119 RDEBUG("aDismissDialog", aDismissDialog); |
|
120 RDEBUG("err", err); |
|
121 RDEBUG("set KSecurityUIsDismissDialog", ESecurityUIsDismissDialogOn); |
|
122 err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn); |
|
123 RDEBUG("err", err); |
|
124 } |
|
125 RDEBUG("calling ClearParamsAndSetNoteTypeL aMode", aMode); |
128 ClearParamsAndSetNoteTypeL(aMode); |
126 ClearParamsAndSetNoteTypeL(aMode); |
129 AddParamL(_L("KSecQueryUiApplicationName"), aCaption); |
127 AddParamL(_L("KSecQueryUiApplicationName"), aCaption); |
130 |
128 |
131 _LIT(KTitle, "title"); |
129 _LIT(KTitle, "title"); |
132 // _LIT(KTitleValue1, "Enter PIN"); |
130 // _LIT(KTitleValue1, "Enter PIN"); |
133 AddParamL(KTitle, aCaption); |
131 AddParamL(KTitle, aCaption); |
134 AddParamL(_L("MinLength"), aMinLength); |
132 AddParamL(_L("MinLength"), aMinLength); |
135 AddParamL(_L("MaxLength"), aMaxLength); |
133 AddParamL(_L("MaxLength"), aMaxLength); |
136 |
134 |
137 _LIT(KCodeTop, "codeTop"); |
135 switch (aMode & ESecUiBasicTypeMask) { |
138 _LIT(KCodeTopValue, "codeTop"); |
136 case ESecUiBasicTypeCheck: |
139 AddParamL(KCodeTop, KCodeTopValue); |
137 _LIT(KChecboxDialog, "ChecboxDialog"); |
|
138 _LIT(KChecbox, "ChecboxDialog"); |
|
139 AddParamL(KChecboxDialog,KChecbox); |
|
140 break; |
|
141 case ESecUiBasicTypeMultiCheck: |
|
142 _LIT(KMultiChecboxDialog, "MultiChecboxDialog"); |
|
143 _LIT(KMultiChecbox, "MultiChecboxDialog"); |
|
144 AddParamL(KMultiChecboxDialog,KMultiChecbox); |
|
145 break; |
|
146 default: |
|
147 _LIT(KCodeTop, "codeTop"); |
|
148 _LIT(KCodeTopValue, "codeTop"); |
|
149 AddParamL(KCodeTop, KCodeTopValue); |
|
150 } |
140 |
151 |
141 if (aCaption.Find(_L("|")) > 0) |
152 if (aCaption.Find(_L("|")) > 0) |
142 { |
153 { |
143 RDEBUG("codeBottom aMode", aMode); |
154 RDEBUG("codeBottom aMode", aMode); |
144 _LIT(KCodeBottom, "codeBottom"); |
155 _LIT(KCodeBottom, "codeBottom"); |
152 AddParamL(KDefaultCode, aDataText); |
163 AddParamL(KDefaultCode, aDataText); |
153 } |
164 } |
154 |
165 |
155 RDEBUG("0", 0); |
166 RDEBUG("0", 0); |
156 DisplayDeviceDialogL(); |
167 DisplayDeviceDialogL(); |
|
168 TSecUi::UnInitializeLib(); // the counterpart is at DisplayDeviceDialogL |
157 TInt error = WaitUntilDeviceDialogClosed(); |
169 TInt error = WaitUntilDeviceDialogClosed(); |
158 RDEBUG("error", error); |
170 RDEBUG("error", error); |
159 User::LeaveIfError(error); |
171 User::LeaveIfError(error); |
160 |
172 RDEBUG("iPassword", 0); |
|
173 RDebug::Print(iPassword); |
161 aDataText.Copy(iPassword); |
174 aDataText.Copy(iPassword); |
162 |
175 |
163 err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
176 err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
164 ESecurityUIsSecUIOriginatedUninitialized); |
177 ESecurityUIsSecUIOriginatedUninitialized); |
165 RDEBUG("clearing secUiOriginatedQuery", |
178 RDEBUG("clearing secUiOriginatedQuery", |
347 |
360 |
348 if (iReturnValue == KErrCompletion) // the user didn't OK. It was send automatically because validating new lock code through TARM |
361 if (iReturnValue == KErrCompletion) // the user didn't OK. It was send automatically because validating new lock code through TARM |
349 { |
362 { |
350 _LIT(KInvalidNewLockCode, "invalidNewLockCode"); |
363 _LIT(KInvalidNewLockCode, "invalidNewLockCode"); |
351 _LIT(KInvalidNewLockCode0, "invalidNewLockCode#0"); |
364 _LIT(KInvalidNewLockCode0, "invalidNewLockCode#0"); |
352 _LIT(KInvalidNewLockCode1, "invalidNewLockCode#1"); |
|
353 _LIT(KInvalidNewLockCode2, "invalidNewLockCode#2"); |
|
354 AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter |
365 AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter |
355 RSCPClient scpClient; |
366 RSCPClient scpClient; |
356 TSCPSecCode newCode; |
367 TSCPSecCode newCode; |
357 newCode.Copy(acceptedValueTop); |
368 newCode.Copy(acceptedValueTop); |
358 RDEBUG("scpClient.Connect", 0); |
369 RDEBUG("scpClient.Connect", 0); |
359 if (scpClient.Connect() == KErrNone) |
370 if (scpClient.Connect() == KErrNone) |
360 { |
371 { |
361 /* |
|
362 RArray<TDevicelockPolicies> aFailedPolicies; |
372 RArray<TDevicelockPolicies> aFailedPolicies; |
363 TDevicelockPolicies failedPolicy; |
373 TDevicelockPolicies failedPolicy; |
364 TInt retLockcode = KErrNone; |
374 TInt retLockcode = KErrNone; |
365 RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); |
375 RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); |
366 retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); |
376 retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); |
532 CHbSymbianVariant* variant = NULL; |
541 CHbSymbianVariant* variant = NULL; |
533 variant = CHbSymbianVariant::NewL(&aValue, CHbSymbianVariant::EDes); |
542 variant = CHbSymbianVariant::NewL(&aValue, CHbSymbianVariant::EDes); |
534 iVariantMap->Add(aKey, variant); |
543 iVariantMap->Add(aKey, variant); |
535 } |
544 } |
536 |
545 |
537 TInt strlen(const char* aStr) |
|
538 { |
|
539 TInt len = 0; |
|
540 while (*aStr++ != 0) |
|
541 ++len; |
|
542 return len; |
|
543 } |
|
544 |
|
545 // --------------------------------------------------------------------------- |
546 // --------------------------------------------------------------------------- |
546 // CSecQueryUi::DisplayDeviceDialogL() |
547 // CSecQueryUi::DisplayDeviceDialogL() |
547 // --------------------------------------------------------------------------- |
548 // --------------------------------------------------------------------------- |
548 // |
549 // |
549 void CSecQueryUi::DisplayDeviceDialogL() |
550 void CSecQueryUi::DisplayDeviceDialogL() |
550 { |
551 { |
551 RDEBUG("0", 0); |
552 RDEBUG("0", 0); |
|
553 TInt err = KErrNone; |
|
554 RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); |
552 if (iDeviceDialog && iIsDisplayingDialog) |
555 if (iDeviceDialog && iIsDisplayingDialog) |
553 { |
556 { |
|
557 RDEBUG("iDeviceDialog", 1); |
554 iDeviceDialog->Update(*iVariantMap); |
558 iDeviceDialog->Update(*iVariantMap); |
555 } |
559 } |
556 else |
560 else |
557 { |
561 { |
|
562 RDEBUG("!iDeviceDialog", 0); |
558 if (!iDeviceDialog) |
563 if (!iDeviceDialog) |
559 { |
564 { |
|
565 RDEBUG("new iDeviceDialog", 0); |
560 iDeviceDialog = CHbDeviceDialogSymbian::NewL(); |
566 iDeviceDialog = CHbDeviceDialogSymbian::NewL(); |
561 } |
567 } |
562 _LIT(KSecQueryUiDeviceDialog, "com.nokia.secuinotificationdialog/1.0"); |
568 _LIT(KSecQueryUiDeviceDialog, "com.nokia.secuinotificationdialog/1.0"); |
563 RDEBUG("Show", 0); |
569 RDEBUG("Show", 0); |
564 iDeviceDialog->Show(KSecQueryUiDeviceDialog, *iVariantMap, this); |
570 err = iDeviceDialog->Show(KSecQueryUiDeviceDialog, *iVariantMap, this); |
|
571 RDEBUG("err", err); |
|
572 TSecUi::InitializeLibL(); |
565 RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); |
573 RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); |
566 iIsDisplayingDialog = ETrue; |
574 iIsDisplayingDialog = ETrue; |
567 RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); |
575 RDEBUG("iIsDisplayingDialog", iIsDisplayingDialog); |
568 } |
576 } |
569 RDEBUG("0", 0); |
577 RDEBUG("0", 0); |