91 // |
91 // |
92 EXPORT_C TInt CSecQueryUi::SecQueryDialog(const TDesC& aCaption, |
92 EXPORT_C TInt CSecQueryUi::SecQueryDialog(const TDesC& aCaption, |
93 TDes& aDataText, TInt aMinLength, TInt aMaxLength, TInt aMode) |
93 TDes& aDataText, TInt aMinLength, TInt aMaxLength, TInt aMode) |
94 { |
94 { |
95 RDEBUG("aCaption", 0); |
95 RDEBUG("aCaption", 0); |
96 RDebug::Print(aCaption); |
96 RDEBUGSTR(aCaption); |
97 RDEBUG("aMode", aMode); |
97 RDEBUG("aMode", aMode); |
98 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
98 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
99 TInt err = RProperty::Get(KPSUidSecurityUIs, |
99 TInt err = RProperty::Get(KPSUidSecurityUIs, |
100 KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
100 KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
101 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
101 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
168 TSecUi::UnInitializeLib(); // the counterpart is at DisplayDeviceDialogL |
168 TSecUi::UnInitializeLib(); // the counterpart is at DisplayDeviceDialogL |
169 TInt error = WaitUntilDeviceDialogClosed(); |
169 TInt error = WaitUntilDeviceDialogClosed(); |
170 RDEBUG("error", error); |
170 RDEBUG("error", error); |
171 User::LeaveIfError(error); |
171 User::LeaveIfError(error); |
172 RDEBUG("iPassword", 0); |
172 RDEBUG("iPassword", 0); |
173 RDebug::Print(iPassword); |
173 RDEBUGSTR(iPassword); |
174 aDataText.Copy(iPassword); |
174 aDataText.Copy(iPassword); |
175 |
175 |
176 err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
176 err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
177 ESecurityUIsSecUIOriginatedUninitialized); |
177 ESecurityUIsSecUIOriginatedUninitialized); |
178 RDEBUG("clearing secUiOriginatedQuery", |
178 RDEBUG("clearing secUiOriginatedQuery", |
353 RDEBUG("0", 0); |
353 RDEBUG("0", 0); |
354 if (acceptedVariantTop) |
354 if (acceptedVariantTop) |
355 { |
355 { |
356 TPtrC acceptedValueTop = *acceptedVariantTop->Value<TDesC> (); |
356 TPtrC acceptedValueTop = *acceptedVariantTop->Value<TDesC> (); |
357 RDEBUG("acceptedValueTop", 0); |
357 RDEBUG("acceptedValueTop", 0); |
358 RDebug::Print(acceptedValueTop); |
358 RDEBUGSTR(acceptedValueTop); |
359 iPassword.Copy(acceptedValueTop); |
359 iPassword.Copy(acceptedValueTop); |
360 |
360 |
361 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 |
362 { |
362 { |
363 _LIT(KInvalidNewLockCode, "invalidNewLockCode"); |
363 _LIT(KInvalidNewLockCode, "invalidNewLockCode"); |
364 _LIT(KInvalidNewLockCode0, "invalidNewLockCode#0"); |
364 _LIT(KInvalidNewLockCode0, "invalidNewLockCode$-1"); |
365 AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter |
365 AddParamL(KInvalidNewLockCode, KInvalidNewLockCode0); // for starter |
366 RSCPClient scpClient; |
366 RSCPClient scpClient; |
367 TSCPSecCode newCode; |
367 TSCPSecCode newCode; |
368 newCode.Copy(acceptedValueTop); |
368 newCode.Copy(acceptedValueTop); |
369 RDEBUG("scpClient.Connect", 0); |
369 RDEBUG("scpClient.Connect", 0); |
370 if (scpClient.Connect() == KErrNone) |
370 if (scpClient.Connect() == KErrNone) |
371 { |
371 { |
372 RArray<TDevicelockPolicies> aFailedPolicies; |
372 RArray<TDevicelockPolicies> aFailedPolicies; |
373 TDevicelockPolicies failedPolicy; |
373 TDevicelockPolicies failedPolicy; |
374 TInt retLockcode = KErrNone; |
374 TInt retLockcode = KErrNone; |
|
375 TInt nPoliciesFailed = 0; |
375 RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); |
376 RDEBUG( "scpClient.VerifyNewLockcodeAgainstPolicies", 0 ); |
376 retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); |
377 retLockcode = scpClient.VerifyNewLockcodeAgainstPolicies( newCode, aFailedPolicies ); |
377 RDEBUG( "retLockcode", retLockcode ); |
378 RDEBUG( "retLockcode", retLockcode ); |
378 RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); |
379 nPoliciesFailed = aFailedPolicies.Count(); |
379 for(TInt i=0; i<aFailedPolicies.Count(); i++) |
380 RDEBUG( "nPoliciesFailed", nPoliciesFailed ); |
380 { |
381 for(TInt i=0; i<nPoliciesFailed; i++) |
381 failedPolicy = aFailedPolicies[i]; |
382 { |
382 RDEBUG( "failedPolicy", failedPolicy ); |
383 failedPolicy = aFailedPolicies[i]; |
383 TBuf<0x100> KInvalidNewLockCodeX; KInvalidNewLockCodeX.Zero(); KInvalidNewLockCodeX.Append(_L("invalidNewLockCode")); KInvalidNewLockCodeX.Append(_L("#")); |
384 RDEBUG( "failedPolicy", failedPolicy ); |
384 KInvalidNewLockCodeX.AppendNum(failedPolicy); |
385 TBuf<0x100> KInvalidNewLockCodeX; KInvalidNewLockCodeX.Zero(); KInvalidNewLockCodeX.Append(_L("invalidNewLockCode")); KInvalidNewLockCodeX.Append(_L("$")); |
385 AddParamL( KInvalidNewLockCode, KInvalidNewLockCodeX ); |
386 KInvalidNewLockCodeX.AppendNum(failedPolicy); |
386 } |
387 AddParamL( KInvalidNewLockCode, KInvalidNewLockCodeX ); // it overwrites the previous one |
|
388 } |
387 // TODO this should be able to modify MinLenght, MaxLenght |
389 // TODO this should be able to modify MinLenght, MaxLenght |
388 scpClient.Close(); |
390 scpClient.Close(); |
389 } |
391 } |
390 RDEBUG("iDeviceDialog->Update", 0); |
392 RDEBUG("iDeviceDialog->Update", 0); |
391 iDeviceDialog->Update(*iVariantMap); |
393 iDeviceDialog->Update(*iVariantMap); |