securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp
changeset 38 e0432375ea67
parent 37 7bad16cccaca
child 45 5d3e34b7618a
equal deleted inserted replaced
37:7bad16cccaca 38:e0432375ea67
   202     iNewPassword.Copy(_L(""));
   202     iNewPassword.Copy(_L(""));
   203 
   203 
   204     TBuf<0x80> iCaption;
   204     TBuf<0x80> iCaption;
   205     iCaption.Copy(_L("ChangePinL"));
   205     iCaption.Copy(_L("ChangePinL"));
   206     TInt iShowError = 1;
   206     TInt iShowError = 1;
   207     ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError);
   207     TInt err = ChangePinParamsL(iOldPassword, iNewPassword, iFlags, iCaption, iShowError);
   208     RDEBUG("0", 0);
   208     RDEBUG("err", err);
   209     }
   209     }
   210 
   210 
   211 //
   211 //
   212 // ----------------------------------------------------------
   212 // ----------------------------------------------------------
   213 // CSecuritySettings::ChangeUPinL()
   213 // CSecuritySettings::ChangeUPinL()
   224     iNewPassword.Copy(_L(""));
   224     iNewPassword.Copy(_L(""));
   225 
   225 
   226     TBuf<0x80> iCaption;
   226     TBuf<0x80> iCaption;
   227     iCaption.Copy(_L("ChangeUPinL"));
   227     iCaption.Copy(_L("ChangeUPinL"));
   228     TInt iShowError = 1;
   228     TInt iShowError = 1;
   229     ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
   229     TInt err = ChangeUPinParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
   230             iShowError);
   230             iShowError);
   231     RDEBUG("0", 0);
   231     RDEBUG("err", err);
   232 
   232 
   233     }
   233     }
   234 
   234 
   235 //
   235 //
   236 // ----------------------------------------------------------
   236 // ----------------------------------------------------------
   248     iNewPassword.Copy(_L(""));
   248     iNewPassword.Copy(_L(""));
   249 
   249 
   250     TBuf<0x80> iCaption;
   250     TBuf<0x80> iCaption;
   251     iCaption.Copy(_L("ChangePin2L"));
   251     iCaption.Copy(_L("ChangePin2L"));
   252     TInt iShowError = 1;
   252     TInt iShowError = 1;
   253     ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
   253     TInt err = ChangePin2ParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
   254             iShowError);
   254             iShowError);
   255     RDEBUG("0", 0);
   255     RDEBUG("err", err);
   256 
       
   257     }
   256     }
   258 //
   257 //
   259 // ----------------------------------------------------------
   258 // ----------------------------------------------------------
   260 // CSecuritySettings::ChangeSecCodeL()
   259 // CSecuritySettings::ChangeSecCodeL()
   261 // Changes security code 
   260 // Changes security code 
   271     iNewPassword.Copy(_L(""));
   270     iNewPassword.Copy(_L(""));
   272 
   271 
   273     TBuf<0x80> iCaption;
   272     TBuf<0x80> iCaption;
   274     iCaption.Copy(_L("ChangeSecCodeL"));
   273     iCaption.Copy(_L("ChangeSecCodeL"));
   275     TInt iShowError = 1;
   274     TInt iShowError = 1;
   276     ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
   275     TInt err = ChangeSecCodeParamsL(iOldPassword, iNewPassword, iFlags, iCaption,
   277             iShowError);
   276             iShowError);
   278     RDEBUG("0", 0);
   277     RDEBUG("err", err);
   279     }
   278     }
   280 //
   279 //
   281 // ----------------------------------------------------------
   280 // ----------------------------------------------------------
   282 // CSecuritySettings::ChangeAutoLockPeriodL()
   281 // CSecuritySettings::ChangeAutoLockPeriodL()
   283 // Changes autolock period
   282 // Changes autolock period
   355 // Note: if the RemoteMsg is cancelled, nevertheless the lock is activated. This is done because the code is askedirst, and the only way to do so is by enabling the lock.
   354 // Note: if the RemoteMsg is cancelled, nevertheless the lock is activated. This is done because the code is askedirst, and the only way to do so is by enabling the lock.
   356 // This is not a problem, because:
   355 // This is not a problem, because:
   357 // a) first the RemoteMsg is enable, and this function is used to change it
   356 // a) first the RemoteMsg is enable, and this function is used to change it
   358 // b) if lock was disabled, the "change RemoteMsg" menu is not available.
   357 // b) if lock was disabled, the "change RemoteMsg" menu is not available.
   359 // ----------------------------------------------------------
   358 // ----------------------------------------------------------
   360 // no qtdone
   359 // qtdone
   361 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode)
   360 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode)
   362     {
   361     {
   363 
   362 
   364     TInt retValue( KErrNone );
   363     TInt retValue( KErrNone );
   365 
   364 
   404                 RDEBUG( "WaitForRequestL", 0 );
   403                 RDEBUG( "WaitForRequestL", 0 );
   405                 TInt res = iWait->WaitForRequestL();
   404                 TInt res = iWait->WaitForRequestL();
   406                 RDEBUG( "WaitForRequestL res", res );
   405                 RDEBUG( "WaitForRequestL res", res );
   407 #ifdef __WINS__
   406 #ifdef __WINS__
   408                 if (res == KErrNotSupported || res == KErrTimedOut)
   407                 if (res == KErrNotSupported || res == KErrTimedOut)
   409                 res = 0xffffec50;	// TODO this means KErrGsm0707IncorrectPassword = incorrect code
   408                 res = KErrGsm0707IncorrectPassword;	// KErrGsm0707IncorrectPassword = incorrect code
   410 #endif
   409 #endif
   411 								RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword );
   410 								RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword );
   412                 if(res == KErrNone)
   411                 if(res == KErrNone)
   413                     {
   412                     {
   414                     // The message is also valid as a lock-code, this means that
   413                     // The message is also valid as a lock-code, this means that
   426 // ----------------------------------------------------------
   425 // ----------------------------------------------------------
   427 // CSecuritySettings::RemoteLockSetLockSettingL()
   426 // CSecuritySettings::RemoteLockSetLockSettingL()
   428 // Changes lock setting in domestic OS. Changing the domestic OS lock setting
   427 // Changes lock setting in domestic OS. Changing the domestic OS lock setting
   429 // requires user to enter the security code.
   428 // requires user to enter the security code.
   430 // ----------------------------------------------------------
   429 // ----------------------------------------------------------
   431 // no qtdone
   430 // qtdone
   432 TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting)
   431 TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting)
   433     {
   432     {
   434     TInt retValue( KErrNone );
   433     TInt retValue( KErrNone );
   435 		RDEBUG( "aLockSetting", aLockSetting );
   434 		RDEBUG( "aLockSetting", aLockSetting );
   436 
   435 
   619     iOldPassword.Copy(_L(""));
   618     iOldPassword.Copy(_L(""));
   620 
   619 
   621     TBuf<0x80> iCaption;
   620     TBuf<0x80> iCaption;
   622     iCaption.Copy(_L("ChangePinRequestL"));
   621     iCaption.Copy(_L("ChangePinRequestL"));
   623     TInt iShowError = 1;
   622     TInt iShowError = 1;
   624     ChangePinRequestParamsL(
   623     TInt err = ChangePinRequestParamsL(
   625             1/* it's imposible to know if we want to set or clear*/,
   624             1/* it's imposible to know if we want to set or clear*/,
   626             iOldPassword, iFlags, iCaption, iShowError);
   625             iOldPassword, iFlags, iCaption, iShowError);
   627     RDEBUG("0", 0);
   626     RDEBUG("err", err);
   628 
   627 		if(err==KErrNone)
   629     return ETrue;
   628     	return ETrue;
       
   629 		else
       
   630    		return EFalse;
   630     }
   631     }
   631 
   632 
   632 //
   633 //
   633 // ----------------------------------------------------------
   634 // ----------------------------------------------------------
   634 // CSecuritySettings::ChangeUPinRequestL()
   635 // CSecuritySettings::ChangeUPinRequestL()
  1648         res = KErrNone;
  1649         res = KErrNone;
  1649 #endif
  1650 #endif
  1650         if (res != KErrNone)
  1651         if (res != KErrNone)
  1651             {
  1652             {
  1652             ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
  1653             ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
  1653             return res; // TODO not sure if it's wise to exit now.
  1654             return res; // not sure if it's wise to exit now.
  1654             }
  1655             }
  1655 
  1656 
  1656         newPassword = _L("");
  1657         newPassword = _L("");
  1657         }
  1658         }
  1658     else
  1659     else
  2040 #endif
  2041 #endif
  2041     User::LeaveIfError(ret);
  2042     User::LeaveIfError(ret);
  2042 
  2043 
  2043     RDEBUG("codeInfo.iRemainingEntryAttempts",
  2044     RDEBUG("codeInfo.iRemainingEntryAttempts",
  2044             codeInfo.iRemainingEntryAttempts);
  2045             codeInfo.iRemainingEntryAttempts);
  2045     if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10
  2046     if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts)
  2046         codeInfo.iRemainingEntryAttempts = -1;
  2047         codeInfo.iRemainingEntryAttempts = -1;
  2047 
  2048 
  2048     /* request PIN using QT */
  2049     /* request PIN using QT */
  2049     queryAccepted = KErrCancel;
  2050     queryAccepted = KErrCancel;
  2050     CSecQueryUi *iSecQueryUi;
  2051     CSecQueryUi *iSecQueryUi;
  2522     TBool simRemoved(simState == ESimNotPresent);
  2523     TBool simRemoved(simState == ESimNotPresent);
  2523 
  2524 
  2524     if (simRemoved)
  2525     if (simRemoved)
  2525         {
  2526         {
  2526         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
  2527         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
  2527         return EFalse;
  2528         return KErrAccessDenied;
  2528         }
  2529         }
  2529 
  2530 
  2530     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
  2531     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
  2531     RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
  2532     RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
  2532     RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC;
  2533     RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockICC;
  2601         case KErrGsm0707OperationNotAllowed:
  2602         case KErrGsm0707OperationNotAllowed:
  2602             {
  2603             {
  2603             // not allowed with this sim
  2604             // not allowed with this sim
  2604             ShowResultNoteL(R_OPERATION_NOT_ALLOWED,
  2605             ShowResultNoteL(R_OPERATION_NOT_ALLOWED,
  2605                     CAknNoteDialog::EErrorTone);
  2606                     CAknNoteDialog::EErrorTone);
  2606             return EFalse;
  2607             return KErrGsm0707OperationNotAllowed;
  2607             }
  2608             }
  2608         case KErrGsm0707IncorrectPassword:
  2609         case KErrGsm0707IncorrectPassword:
  2609         case KErrAccessDenied:
  2610         case KErrAccessDenied:
  2610             {
  2611             {
  2611             // code was entered erroneously
  2612             // code was entered erroneously
  2613                     aCaption, aShowError);
  2614                     aCaption, aShowError);
  2614             }
  2615             }
  2615         case KErrGsmSSPasswordAttemptsViolation:
  2616         case KErrGsmSSPasswordAttemptsViolation:
  2616         case KErrLocked:
  2617         case KErrLocked:
  2617             {
  2618             {
  2618             return ETrue;
  2619             return KErrLocked;
  2619             }
  2620             }
  2620         case KErrAbort:
  2621         case KErrAbort:
  2621             {
  2622             {
  2622             return EFalse;
  2623             return KErrAbort;
  2623             }
  2624             }
  2624         default:
  2625         default:
  2625             {
  2626             {
  2626             return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags,
  2627             return ChangePinRequestParamsL(aEnable, aOldPassword, aFlags,
  2627                     aCaption, aShowError);
  2628                     aCaption, aShowError);
  2628             }
  2629             }
  2629         }
  2630         }
  2630     return ETrue;
  2631     return KErrNone;
  2631     }
  2632     }
  2632 
  2633 
  2633 //
  2634 //
  2634 // ----------------------------------------------------------
  2635 // ----------------------------------------------------------
  2635 // CSecuritySettings::AskSecCodeParamsL()
  2636 // CSecuritySettings::AskSecCodeParamsL()