314 // ---------------------------------------------------------- |
314 // ---------------------------------------------------------- |
315 // no qtdone |
315 // no qtdone |
316 EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( |
316 EXPORT_C TInt CSecuritySettings::ChangeRemoteLockStatusL( |
317 TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod) |
317 TBool& aRemoteLockStatus, TDes& aRemoteLockCode, TInt aAutoLockPeriod) |
318 { |
318 { |
|
319 TInt retValue( KErrNone ); |
|
320 RDEBUG("aRemoteLockStatus", aRemoteLockStatus); |
|
321 RDEBUG("aAutoLockPeriod", aAutoLockPeriod); |
|
322 |
|
323 TInt currentItem( 0 ); |
|
324 |
|
325 if ( aRemoteLockStatus ) |
|
326 { |
|
327 currentItem = KRemoteLockSettingItemOn; |
|
328 } |
|
329 else |
|
330 { |
|
331 currentItem = KRemoteLockSettingItemOff; |
|
332 } |
|
333 RDEBUG("currentItem", currentItem); |
|
334 |
|
335 if ( currentItem == KRemoteLockSettingItemOn ) |
|
336 { |
|
337 RDEBUG("KRemoteLockSettingItemOn", KRemoteLockSettingItemOn); |
|
338 aRemoteLockStatus = ETrue; |
|
339 |
|
340 // If user wishes to enable remote lock |
|
341 // a new remote lock code is required. |
|
342 // RemoteLockCodeQueryL also |
|
343 retValue = RemoteLockCodeQueryL( aRemoteLockCode ); |
|
344 } |
|
345 else if ( currentItem == KRemoteLockSettingItemOff ) |
|
346 { |
|
347 RDEBUG("KRemoteLockSettingItemOff", KRemoteLockSettingItemOff); |
|
348 aRemoteLockStatus = EFalse; |
|
349 retValue = KErrNone; |
|
350 // TODO this should calculate aAutoLockPeriod itself, and not trust the input |
|
351 |
|
352 // Check whether AutoLock is enabled (timeout value greater |
|
353 // than zero) or not. If AutoLock is enabled the domestic OS |
|
354 // device lock should be left enabled. |
|
355 if ( aAutoLockPeriod == 0 ) |
|
356 { |
|
357 // Disable lock setting from domestic OS |
|
358 retValue = RemoteLockSetLockSettingL( EFalse ); |
|
359 } |
|
360 else |
|
361 { |
|
362 // If AutoLock is enabled, don't disable the DOS device lock |
|
363 // Re-set (enable) the domestic OS device lock because as a |
|
364 // side effect it requires the security code from the user |
|
365 retValue = RemoteLockSetLockSettingL( ETrue ); |
|
366 } |
|
367 } |
|
368 RDEBUG( "retValue", retValue ); |
|
369 return retValue; |
|
370 } |
|
371 // |
|
372 // ---------------------------------------------------------- |
|
373 // CSecuritySettings::RemoteLockCodeQueryL() |
|
374 // Pops up remote lock code query. Requires user to enter a new remote lock |
|
375 // code (RemoteMsg) twice and if they match enables the domestic OS device lock (which as |
|
376 // a side effect pops up security code query). |
|
377 // ---------------------------------------------------------- |
|
378 // no qtdone |
|
379 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) |
|
380 { |
319 #ifdef RD_REMOTELOCK |
381 #ifdef RD_REMOTELOCK |
320 TInt retValue( KErrNone ); |
382 TInt retValue( KErrNone ); |
321 |
383 |
322 #ifdef _DEBUG |
384 RDEBUG( "retValue", retValue ); |
323 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Enter, aRemoteLockStatus == %d, aAutoLockPeriod == %d" ), aRemoteLockStatus, aAutoLockPeriod ); |
|
324 #endif // _DEBUG |
|
325 CCoeEnv* coeEnv = CCoeEnv::Static(); |
|
326 CDesCArrayFlat* items = coeEnv->ReadDesC16ArrayResourceL( R_REMOTELOCK_LBX ); |
|
327 CleanupStack::PushL( items ); |
|
328 |
|
329 // Store the current remote lock setting |
|
330 TInt previousItem( 0 ); |
|
331 TInt currentItem( 0 ); |
|
332 |
|
333 if ( aRemoteLockStatus ) |
|
334 { |
|
335 previousItem = KRemoteLockSettingItemOn; |
|
336 currentItem = KRemoteLockSettingItemOn; |
|
337 } |
|
338 else |
|
339 { |
|
340 previousItem = KRemoteLockSettingItemOff; |
|
341 currentItem = KRemoteLockSettingItemOff; |
|
342 } |
|
343 |
|
344 // Create Remote Lock setting page for user to enable or disable remote locking |
|
345 CRemoteLockSettingPage* remoteLockSettingPage = new( ELeave ) CRemoteLockSettingPage( R_REMOTELOCK_SETTING_PAGE, currentItem, items ); |
|
346 |
|
347 #ifdef _DEBUG |
|
348 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Executing CRemoteLockSettingPage dialog" ) ); |
|
349 #endif // _DEBUG |
|
350 // Execute the remote lock enable/disable dialog |
|
351 TBool ret = remoteLockSettingPage->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ); |
|
352 |
|
353 // Setting page list box items (texts) no longer needed |
|
354 CleanupStack::PopAndDestroy( items ); |
|
355 |
|
356 if ( ret ) |
|
357 { |
|
358 if ( currentItem == KRemoteLockSettingItemOn ) |
|
359 { |
|
360 #ifdef _DEBUG |
|
361 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to ON" ) ); |
|
362 #endif // _DEBUG |
|
363 aRemoteLockStatus = ETrue; |
|
364 |
|
365 // If user wishes to enable remote lock |
|
366 // a new remote lock code is required. |
|
367 // RemoteLockCodeQueryL also |
|
368 retValue = RemoteLockCodeQueryL( aRemoteLockCode ); |
|
369 } |
|
370 else if ( currentItem == KRemoteLockSettingItemOff ) |
|
371 { |
|
372 #ifdef _DEBUG |
|
373 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Remote lock status set to OFF" ) ); |
|
374 #endif // _DEBUG |
|
375 aRemoteLockStatus = EFalse; |
|
376 retValue = KErrNone; |
|
377 |
|
378 // Check whether the status was already off |
|
379 // If not don't make the user enter the security code |
|
380 // (which occurs when setting the DOS lock setting) for no reason. |
|
381 if ( currentItem != previousItem ) |
|
382 { |
|
383 // Check whether AutoLock is enabled (timeout value greater |
|
384 // than zero) or not. If AutoLock is enabled the domestic OS |
|
385 // device lock should be left enabled. |
|
386 if ( aAutoLockPeriod == 0 ) |
|
387 { |
|
388 // Disable lock setting from domestic OS |
|
389 retValue = RemoteLockSetLockSettingL( EFalse ); |
|
390 } |
|
391 else |
|
392 { |
|
393 // If AutoLock is enabled, don't disable the DOS device lock |
|
394 // Re-set (enable) the domestic OS device lock because as a |
|
395 // side effect it requires the security code from the user |
|
396 retValue = RemoteLockSetLockSettingL( ETrue ); |
|
397 } |
|
398 } |
|
399 } |
|
400 else |
|
401 { |
|
402 // This should never happen. But if it does don't change anything |
|
403 retValue = KErrUnknown; |
|
404 } |
|
405 } |
|
406 else |
|
407 { |
|
408 // Something went wrong with the RemoteLockSettingPage dialog |
|
409 retValue = KErrGeneral; |
|
410 |
|
411 #ifdef _DEBUG |
|
412 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - CRemoteLockSettingPage::ExecuteLD() failed" ) ); |
|
413 #endif // _DEBUG |
|
414 } |
|
415 |
|
416 #ifdef _DEBUG |
|
417 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockStatusL() - Exit" ) ); |
|
418 #endif |
|
419 |
|
420 return retValue; |
|
421 #else //! RD_REMOTELOCK |
|
422 return KErrNotSupported; |
|
423 #endif //RD_REMOTELOCK |
|
424 } |
|
425 // |
|
426 // ---------------------------------------------------------- |
|
427 // CSecuritySettings::RemoteLockCodeQueryL() |
|
428 // Pops up remote lock code query. Requires user to enter a new remote lock |
|
429 // code twice and if they match enables the domestic OS device lock (which as |
|
430 // a side effect pops up security code query). |
|
431 // ---------------------------------------------------------- |
|
432 // no qtdone |
|
433 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) |
|
434 { |
|
435 #ifdef RD_REMOTELOCK |
|
436 TInt retValue( KErrNone ); |
|
437 |
|
438 #ifdef _DEBUG |
|
439 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Enter" ) ); |
|
440 #endif // _DEBUG |
|
441 // Clear the remote lock code buffer |
|
442 aRemoteLockCode.Zero(); |
385 aRemoteLockCode.Zero(); |
443 |
386 |
444 // ----- Remote lock code query ------------------------------------------- |
387 TInt queryAccepted = KErrCancel; |
445 |
388 queryAccepted = KErrCancel; |
446 // Execute Remote Lock code query |
389 CSecQueryUi * iSecQueryUi; |
447 #ifdef _DEBUG |
390 iSecQueryUi = CSecQueryUi::NewL(); |
448 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code query" ) ); |
391 // this queries both, and verifies itself |
449 #endif // _DEBUG |
392 queryAccepted = iSecQueryUi->SecQueryDialog( |
450 // Load the query prompt from resources |
393 _L("RemoteMsg-New|RemoteMsg-Ver"), aRemoteLockCode, |
451 CCodeQueryDialog* codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
394 SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, |
452 TInt buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
395 ESecUiAlphaSupported | ESecUiCancelSupported |
453 if ( buttonId == EEikBidOk ) |
396 | ESecUiEmergencyNotSupported | ESecUiNone); |
454 { |
397 RDEBUG("aRemoteLockCode", 0); |
455 // Ok was pressed and the remote lock code seems fine |
398 RDebug::Print(aRemoteLockCode); |
456 retValue = KErrNone; |
399 RDEBUG("queryAccepted", queryAccepted); |
457 } |
400 delete iSecQueryUi; |
458 else |
401 if (queryAccepted != KErrNone) |
459 { |
402 return KErrAbort; |
460 // User pressed Cancel |
403 |
461 // Set the code length to zero leaving no trash for possible retry |
404 // TODO it should ask first for the code, and _later_ for the RemoteMsg |
462 aRemoteLockCode.Zero(); |
405 |
463 retValue = KErrAbort; |
|
464 } |
|
465 |
|
466 if ( retValue != KErrNone ) |
|
467 { |
|
468 #ifdef _DEBUG |
|
469 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit, Remote lock code error" ) ); |
|
470 #endif // _DEBUG |
|
471 // Can't continue beyond this |
|
472 return retValue; |
|
473 } |
|
474 |
|
475 // ----- Remote lock code confirm query ----------------------------------- |
|
476 |
|
477 // Confirm the code by asking it again |
|
478 #ifdef _DEBUG |
|
479 RDebug::Print( _L( "(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Executing remote lock code verify query" ) ); |
|
480 #endif // _DEBUG |
|
481 // Buffer for the confirmation code |
|
482 TBuf<KRLockMaxLockCodeLength> confirmCode; |
|
483 |
|
484 // Load the confirmation query prompt from resources |
|
485 CCodeQueryDialog* codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
486 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
487 |
|
488 if ( buttonId == EEikBidOk ) |
|
489 { |
|
490 // Compare codes. Compare returns zero if descriptors have |
|
491 // the same length and the same content |
|
492 while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) |
|
493 { |
|
494 //Codes didn't match; zero the bufffers and show the dialog again |
|
495 aRemoteLockCode.Zero(); |
|
496 confirmCode.Zero(); |
|
497 // Codes don't match. Notify user |
|
498 ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); |
|
499 codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
500 buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
501 //Unless user pressed Cancel show the verification query |
|
502 if(buttonId == EEikBidOk) |
|
503 { |
|
504 codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
505 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
506 } |
|
507 |
|
508 } |
|
509 //User pressed cancel |
|
510 if(buttonId != EEikBidOk) |
|
511 { |
|
512 // Set the code length to zero leaving no trash for possible retry |
|
513 // Report error and let the user try again |
|
514 aRemoteLockCode.Zero(); |
|
515 confirmCode.Zero(); |
|
516 retValue = KErrAbort; |
|
517 } |
|
518 else |
|
519 { |
|
520 // Codes match |
|
521 confirmCode.Zero(); |
|
522 |
|
523 // ----- Check against security code ------------------------------ |
406 // ----- Check against security code ------------------------------ |
524 |
407 |
525 // Check that the new remote lock code doesn't match the security |
408 // Check that the new remote lock code doesn't match the security |
526 // code of the device. |
409 // code of the device. |
527 |
410 |
528 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
411 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
529 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
412 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
530 RMobilePhone::TMobilePassword securityCode; |
413 RMobilePhone::TMobilePassword securityCode; |
531 RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
414 RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
532 |
415 |
533 if ( aRemoteLockCode.Length() <= RMobilePhone::KMaxMobilePasswordSize ) |
416 RDEBUG( "RMobilePhone::KMaxMobilePasswordSize", RMobilePhone::KMaxMobilePasswordSize ); |
534 { |
417 |
535 securityCode = aRemoteLockCode; |
418 securityCode = aRemoteLockCode; |
536 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
419 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
537 RDEBUG( "VerifySecurityCode", 0 ); |
420 RDEBUG( "VerifySecurityCode", 0 ); |
538 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
421 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
539 RDEBUG( "WaitForRequestL", 0 ); |
422 RDEBUG( "WaitForRequestL", 0 ); |
541 RDEBUG( "WaitForRequestL res", res ); |
424 RDEBUG( "WaitForRequestL res", res ); |
542 #ifdef __WINS__ |
425 #ifdef __WINS__ |
543 if (res == KErrNotSupported || res == KErrTimedOut) |
426 if (res == KErrNotSupported || res == KErrTimedOut) |
544 res = KErrNone; |
427 res = KErrNone; |
545 #endif |
428 #endif |
546 // The remote lock code matches the security code |
429 if(res != KErrNone) |
547 // and that is not allowed |
|
548 while ( (res == KErrNone) && (buttonId == EEikBidOk)) |
|
549 { |
430 { |
550 #ifdef _DEBUG |
431 // The remote lock code matches the security code |
551 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Unacceptable remote lock code" ) ); |
432 // and that is not allowed |
552 #endif // _DEBUG |
433 RDEBUG( "res", res ); |
553 aRemoteLockCode.Zero(); |
434 return res; |
554 confirmCode.Zero(); |
|
555 |
|
556 ShowResultNoteL( R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone ); |
|
557 |
|
558 codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
559 buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
560 //Unless user pressed Cancel show the verification query |
|
561 if(buttonId == EEikBidOk) |
|
562 { |
|
563 codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
564 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
565 |
|
566 // Compare codes. Compare returns zero if descriptors have |
|
567 // the same length and the same content |
|
568 while ( (aRemoteLockCode.CompareF( confirmCode ) != 0) && (buttonId == EEikBidOk)) |
|
569 { |
|
570 //Codes didn't match; zero the bufffers and show the dialog again |
|
571 aRemoteLockCode.Zero(); |
|
572 confirmCode.Zero(); |
|
573 // Codes don't match. Notify user |
|
574 ShowResultNoteL( R_REMOTELOCK_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone ); |
|
575 codeQuery = new( ELeave ) CCodeQueryDialog( aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH,SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
576 buttonId = codeQuery->ExecuteLD( R_REMOTELOCK_CODE_QUERY ); |
|
577 //Unless user pressed Cancel show the verification query |
|
578 if(buttonId == EEikBidOk) |
|
579 { |
|
580 codeConfirmQuery = new( ELeave ) CCodeQueryDialog( confirmCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiNone, ETrue ); |
|
581 buttonId = codeConfirmQuery->ExecuteLD( R_VERIFY_REMOTELOCK_CODE_QUERY); |
|
582 } |
|
583 |
|
584 } |
|
585 //User pressed cancel |
|
586 if(buttonId != EEikBidOk) |
|
587 { |
|
588 // Set the code length to zero leaving no trash for possible retry |
|
589 // Report error and let the user try again |
|
590 aRemoteLockCode.Zero(); |
|
591 confirmCode.Zero(); |
|
592 retValue = KErrAbort; |
|
593 } |
|
594 else //Check against security code |
|
595 |
|
596 { |
|
597 securityCode = aRemoteLockCode; |
|
598 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
|
599 RDEBUG( "VerifySecurityCode", 0 ); |
|
600 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
|
601 RDEBUG( "WaitForRequestL", 0 ); |
|
602 res = iWait->WaitForRequestL(); |
|
603 #ifdef __WINS__ |
|
604 if (res == KErrNotSupported || res == KErrTimedOut) |
|
605 res = KErrNone; |
|
606 #endif |
|
607 RDEBUG( "WaitForRequestL res", res ); |
|
608 } |
|
609 } |
|
610 |
|
611 } |
435 } |
612 //User pressed cancel |
|
613 if(buttonId != EEikBidOk) |
|
614 { |
|
615 // Set the code length to zero leaving no trash for possible retry |
|
616 // Report error and let the user try again |
|
617 aRemoteLockCode.Zero(); |
|
618 confirmCode.Zero(); |
|
619 retValue = KErrAbort; |
|
620 } |
|
621 } |
|
622 |
436 |
623 // ----- Enable DOS device lock (Security code query) ------------- |
437 // ----- Enable DOS device lock (Security code query) ------------- |
624 |
|
625 if ( retValue == KErrNone ) |
438 if ( retValue == KErrNone ) |
626 { |
439 { |
627 // Enable lock setting in domestic OS. It is safe to enable the |
440 // Enable lock setting in domestic OS. It is safe to enable the |
628 // lock setting since RemoteLock API requires remote locking to |
441 // lock setting since RemoteLock API requires remote locking to |
629 // be enabled when changing or setting the remote lock message. |
442 // be enabled when changing or setting the remote lock message. |
630 retValue = RemoteLockSetLockSettingL( ETrue ); |
443 retValue = RemoteLockSetLockSettingL( ETrue ); |
631 } |
444 } |
632 } |
445 RDEBUG( "retValue", retValue ); |
633 } |
|
634 else //User pressed Cancel |
|
635 |
|
636 { |
|
637 // Set the code length to zero leaving no trash for possible retry |
|
638 aRemoteLockCode.Zero(); |
|
639 confirmCode.Zero(); |
|
640 retValue = KErrAbort; |
|
641 } |
|
642 |
|
643 #ifdef _DEBUG |
446 #ifdef _DEBUG |
644 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); |
447 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); |
645 #endif // _DEBUG |
448 #endif // _DEBUG |
646 return retValue; |
449 return retValue; |
647 #else //! RD_REMOTELOCK |
450 #else //! RD_REMOTELOCK |
2763 status = KErrNone; |
2538 status = KErrNone; |
2764 #endif |
2539 #endif |
2765 switch (status) |
2540 switch (status) |
2766 { |
2541 { |
2767 case KErrNone: |
2542 case KErrNone: |
2768 #if defined(_DEBUG) |
|
2769 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() KErrNone")); |
|
2770 #endif |
|
2771 break; |
2543 break; |
2772 case KErrGsmSSPasswordAttemptsViolation: |
2544 case KErrGsmSSPasswordAttemptsViolation: |
2773 case KErrLocked: |
2545 case KErrLocked: |
2774 #if defined(_DEBUG) |
2546 RDEBUG("KErrLocked", KErrLocked); |
2775 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() PasswordAttemptsViolation")); |
|
2776 #endif |
|
2777 ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2547 ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2778 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, |
2548 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, |
2779 aFlags, aCaption, aShowError); // ask again |
2549 aFlags, aCaption, aShowError); // ask again |
2780 case KErrGsm0707IncorrectPassword: |
2550 case KErrGsm0707IncorrectPassword: |
2781 case KErrAccessDenied: |
2551 case KErrAccessDenied: |
2782 #if defined(_DEBUG) |
2552 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
2783 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() IncorrectPassword")); |
|
2784 #endif |
|
2785 // code was entered erroneously |
2553 // code was entered erroneously |
2786 ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2554 ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2787 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, |
2555 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, |
2788 aFlags, aCaption, aShowError); // ask again |
2556 aFlags, aCaption, aShowError); // ask again |
2789 case KErrAbort: |
2557 case KErrAbort: |
2790 // User pressed "cancel" in the code query dialog. |
2558 // User pressed "cancel" in the code query dialog. |
2791 return oldPeriod; |
2559 return oldPeriod; |
2792 default: |
2560 default: |
2793 #if defined(_DEBUG) |
2561 RDEBUG("default", status); |
2794 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() default")); |
|
2795 #endif |
|
2796 ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2562 ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages |
2797 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, |
2563 return ChangeAutoLockPeriodParamsL(oldPeriod, aOldPassword, |
2798 aFlags, aCaption, aShowError); // ask again |
2564 aFlags, aCaption, aShowError); // ask again |
2799 } |
2565 } |
2800 #if defined(_DEBUG) |
2566 RDEBUG("aPeriod", aPeriod); |
2801 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeAutoLockPeriodL() END")); |
|
2802 #endif |
|
2803 return aPeriod; |
2567 return aPeriod; |
2804 } |
2568 } |
2805 /*****************************/ |
2569 /*****************************/ |
2806 // qtdone |
2570 // qtdone |
2807 EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, |
2571 EXPORT_C TInt CSecuritySettings::ChangePinRequestParamsL(TInt aEnable, |
2808 RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, |
2572 RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, |
2809 TDes& aCaption, TInt aShowError) |
2573 TDes& aCaption, TInt aShowError) |
2810 { |
2574 { |
2811 RDEBUG("aEnable", aEnable); |
2575 RDEBUG("aEnable", aEnable); |
2812 RDEBUG("aFlags", aFlags); |
2576 RDEBUG("aFlags", aFlags); |
2813 /***************************************************** |
|
2814 * Series 60 Customer / ETel |
|
2815 * Series 60 ETel API |
|
2816 *****************************************************/ |
|
2817 #if defined(_DEBUG) |
|
2818 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL()")); |
|
2819 #endif |
|
2820 TInt simState = 0; |
2577 TInt simState = 0; |
2821 TInt lEnable = aEnable; |
2578 TInt lEnable = aEnable; |
2822 TInt err(KErrGeneral); |
2579 TInt err(KErrGeneral); |
2823 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
2580 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
2824 User::LeaveIfError(err); |
2581 User::LeaveIfError(err); |