securitydialogs/SecUi/Src/SecUiSecuritySettings.cpp
changeset 66 67b3e3c1fc87
parent 63 989397f9511c
equal deleted inserted replaced
63:989397f9511c 66:67b3e3c1fc87
    17  */
    17  */
    18 
    18 
    19 #include <etelmm.h>
    19 #include <etelmm.h>
    20 #include <exterror.h>
    20 #include <exterror.h>
    21 #include <textresolver.h>
    21 #include <textresolver.h>
    22 #include <aknnotedialog.h>
       
    23 #include <mmtsy_names.h>
    22 #include <mmtsy_names.h>
    24 #include <centralrepository.h> 
    23 #include <centralrepository.h> 
    25 #include <gsmerror.h>
    24 #include <gsmerror.h>
    26 #include <SCPClient.h>
    25 #include <SCPClient.h>
    27 #include <StringLoader.h>
    26 #include <StringLoader.h>
    34 #include "secui.hrh"
    33 #include "secui.hrh"
    35 #include "secuisecurityhandler.h"
    34 #include "secuisecurityhandler.h"
    36 #include "secuicodequerydialog.h"
    35 #include "secuicodequerydialog.h"
    37 #include "SecUiWait.h"
    36 #include "SecUiWait.h"
    38 #include <hb/hbcore/hbtextresolversymbian.h>
    37 #include <hb/hbcore/hbtextresolversymbian.h>
    39 #include <aknnotewrappers.h>
       
    40 #include <StringLoader.h>
    38 #include <StringLoader.h>
    41 #include <RemoteLockSettings.h>
    39 #include <RemoteLockSettings.h>
    42 #include <featmgr.h>
    40 #include <featmgr.h>
    43 #include <hb/hbwidgets/restricted/hbdevicedialogsextensionsymbian_r.h>
    41 #include <hb/hbwidgets/restricted/hbdevicedialogsextensionsymbian_r.h>
    44 #include "SecQueryUi.h"
    42 #include "SecQueryUi.h"
   130     User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo));
   128     User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo));
   131     User::LeaveIfError(iPhone.Open(iServer, PhoneInfo.iName));
   129     User::LeaveIfError(iPhone.Open(iServer, PhoneInfo.iName));
   132     User::LeaveIfError(iCustomPhone.Open(iPhone));
   130     User::LeaveIfError(iCustomPhone.Open(iPhone));
   133 
   131 
   134     iSecurityHandler = new (ELeave) CSecurityHandler(iPhone);
   132     iSecurityHandler = new (ELeave) CSecurityHandler(iPhone);
       
   133 
   135     _LIT(KFileName, "secui_");
   134     _LIT(KFileName, "secui_");
   136     _LIT(KPath, "z:/resource/qt/translations/");
   135     _LIT(KPath, "z:/resource/qt/translations/");
   137     RDEBUG("HbTextResolverSymbian", 0);
   136     RDEBUG("HbTextResolverSymbian", 0);
   138     TBool result = HbTextResolverSymbian::Init(KFileName, KPath);
   137     TBool result = HbTextResolverSymbian::Init(KFileName, KPath);
   139     RDEBUG("result", result);
   138     RDEBUG("result", result);
   140 
       
   141     }
   139     }
   142 //
   140 //
   143 // ----------------------------------------------------------
   141 // ----------------------------------------------------------
   144 // CSecuritySettings::~CSecuritySettings()
   142 // CSecuritySettings::~CSecuritySettings()
   145 // Destructor
   143 // Destructor
   375     CSecQueryUi * iSecQueryUi;
   373     CSecQueryUi * iSecQueryUi;
   376     iSecQueryUi = CSecQueryUi::NewL();
   374     iSecQueryUi = CSecQueryUi::NewL();
   377     // this queries both, and verifies itself
   375     // this queries both, and verifies itself
   378     TBuf<0x100> title;
   376     TBuf<0x100> title;
   379     title.Zero();
   377     title.Zero();
   380     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_rem_code"));
   378     HBufC* stringHolder = TranslateLC(_L("txt_device_dialog_new_locking_message"),0);	// old txt_pin_code_dialog_new_rem_code
   381     title.Append(stringHolder->Des());
   379     title.Append(stringHolder->Des());
   382     CleanupStack::PopAndDestroy(stringHolder);
   380     CleanupStack::PopAndDestroy(stringHolder);
   383     title.Append(_L("|"));
   381     title.Append(_L("|"));
   384     HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
   382     HBufC* stringHolder2 = TranslateLC(_L("txt_device_dialog_retype_locking_message"),0);
   385     title.Append(stringHolder2->Des());
   383     title.Append(stringHolder2->Des());
   386     CleanupStack::PopAndDestroy(stringHolder2);
   384     CleanupStack::PopAndDestroy(stringHolder2);
   387     queryAccepted = iSecQueryUi->SecQueryDialog(title, aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiAlphaSupported
   385     queryAccepted = iSecQueryUi->SecQueryDialog(title, aRemoteLockCode, SEC_REMOTELOCK_CODE_MIN_LENGTH, SEC_REMOTELOCK_CODE_MAX_LENGTH, ESecUiAlphaSupported
   388             | ESecUiCancelSupported | ESecUiEmergencyNotSupported | ESecUiNone);
   386             | ESecUiCancelSupported | ESecUiEmergencyNotSupported | ESecUiNone);
   389     RDEBUG("aRemoteLockCode", 0);
   387     RDEBUG("aRemoteLockCode", 0);
   409     RSCPClient scpClient;
   407     RSCPClient scpClient;
   410     TInt ret = scpClient.Connect();
   408     TInt ret = scpClient.Connect();
   411     RDEBUG("ret", ret);
   409     RDEBUG("ret", ret);
   412     retLockcode = scpClient.VerifyCurrentLockcode(aRemoteLockCode, aISACode, aFailedPolicies, scpFlags);
   410     retLockcode = scpClient.VerifyCurrentLockcode(aRemoteLockCode, aISACode, aFailedPolicies, scpFlags);
   413     RDEBUG("retLockcode", retLockcode);
   411     RDEBUG("retLockcode", retLockcode);
       
   412     retLockcode=retLockcode;
   414  	  scpClient.Close();
   413  	  scpClient.Close();
   415 
   414 
   416     RDEBUG("aISACode", 0);
   415     RDEBUG("aISACode", 0);
   417     RDEBUGSTR(aISACode);
   416     RDEBUGSTR(aISACode);
   418 
   417 
   433         {
   432         {
   434         // The message is also valid as a lock-code, this means that
   433         // The message is also valid as a lock-code, this means that
   435         // remote lock code matches the security code 
   434         // remote lock code matches the security code 
   436         // and that is not allowed
   435         // and that is not allowed
   437         RDEBUG( "return KErrCancel because msg matches code", KErrCancel );
   436         RDEBUG( "return KErrCancel because msg matches code", KErrCancel );
   438         ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone);
   437         ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, EErrorTone);
   439         return KErrCancel;
   438         return KErrCancel;
   440         }
   439         }
   441 
   440 
   442     RDEBUG( "retValue", retValue );
   441     RDEBUG( "retValue", retValue );
   443     return retValue;
   442     return retValue;
   519             break;
   518             break;
   520 
   519 
   521         default:
   520         default:
   522             break;
   521             break;
   523         }
   522         }
   524 
   523 		// This doesn't loop
   525     RDEBUG( "retValue", retValue );
   524     RDEBUG( "retValue", retValue );
   526     return retValue;
   525     return retValue;
   527     }
   526     }
   528 
   527 
   529 //
   528 //
   581     RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk);
   580     RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk);
   582 				CWait* newWait = NULL;
   581 				CWait* newWait = NULL;
   583         newWait = CWait::NewL();
   582         newWait = CWait::NewL();
   584     RDEBUG("newWait SetLockSetting", 0);
   583     RDEBUG("newWait SetLockSetting", 0);
   585     iPhone.SetLockSetting(newWait->iStatus, lockType, lockChangeSetting); // this invokes the handler
   584     iPhone.SetLockSetting(newWait->iStatus, lockType, lockChangeSetting); // this invokes the handler
   586         RDEBUG("newWait WaitForRequestL",
   585         RDEBUG("newWait WaitForRequestL", 0);
   587                 0);
       
   588         status = newWait->WaitForRequestL();
   586         status = newWait->WaitForRequestL();
   589         RDEBUG("newWait WaitForRequestL status",
   587         RDEBUG("newWait WaitForRequestL status", status);
   590                 status);
       
   591         delete newWait;
   588         delete newWait;
   592 
       
   593 /*
       
   594     iWait->SetRequestType(EMobilePhoneSetLockSetting);
       
   595     RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk);
       
   596     RDEBUG("SetLockSetting", 0);
       
   597     iPhone.SetLockSetting(iWait->iStatus, lockType, lockChangeSetting); // this invokes the handler
       
   598     RDEBUG("WaitForRequestL", 0);
       
   599     status = iWait->WaitForRequestL();
       
   600     RDEBUG("WaitForRequestL status", status);
       
   601 */
       
   602 #ifdef __WINS__
   589 #ifdef __WINS__
   603     if (status == KErrNotSupported || status == KErrTimedOut)
   590     if (status == KErrNotSupported || status == KErrTimedOut)
   604         status = KErrNone;
   591         status = KErrNone;
   605 #endif
   592 #endif
   606 
   593 
   690         User::LeaveIfError(err);
   677         User::LeaveIfError(err);
   691         TBool simRemoved(simState == ESimNotPresent);
   678         TBool simRemoved(simState == ESimNotPresent);
   692 
   679 
   693         if (simRemoved)
   680         if (simRemoved)
   694             {
   681             {
   695             ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
   682             ShowResultNoteL(R_INSERT_SIM, EErrorTone);
   696             return EFalse;
   683             return EFalse;
   697             }
   684             }
   698 
   685 
   699         RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
   686         RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
   700         RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
   687         RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
   757                 break;
   744                 break;
   758                 }
   745                 }
   759             case KErrGsm0707OperationNotAllowed:
   746             case KErrGsm0707OperationNotAllowed:
   760                 {
   747                 {
   761                 // not allowed with this sim
   748                 // not allowed with this sim
   762                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
   749                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
   763                 return EFalse;
   750                 return EFalse;
   764                 }
   751                 }
   765             case KErrGsm0707IncorrectPassword:
   752             case KErrGsm0707IncorrectPassword:
   766             case KErrAccessDenied:
   753             case KErrAccessDenied:
   767                 {
   754                 {
   812         User::LeaveIfError(err);
   799         User::LeaveIfError(err);
   813         TBool simRemoved(simState == ESimNotPresent);
   800         TBool simRemoved(simState == ESimNotPresent);
   814 
   801 
   815         if (simRemoved)
   802         if (simRemoved)
   816             {
   803             {
   817             ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
   804             ShowResultNoteL(R_INSERT_SIM, EErrorTone);
   818             return EFalse;
   805             return EFalse;
   819             }
   806             }
   820 
   807 
   821         RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin;
   808         RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockUniversalPin;
   822         RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced;
   809         RMobilePhone::TMobilePhoneLockSetting lockChangeSetting = RMobilePhone::ELockReplaced;
   861         if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
   848         if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
   862             {
   849             {
   863 
   850 
   864             if (activeCode != RMobilePhone::ESecurityUniversalPin)
   851             if (activeCode != RMobilePhone::ESecurityUniversalPin)
   865                 {
   852                 {
   866                 ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
   853                 ShowResultNoteL(R_UPIN_NOT_ALLOWED, EErrorTone);
   867                 }
   854                 }
   868             else
   855             else
   869                 {
   856                 {
   870                 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
   857                 ShowResultNoteL(R_PIN_NOT_ALLOWED, EErrorTone);
   871                 }
   858                 }
   872             return EFalse;
   859             return EFalse;
   873             }
   860             }
   874 
   861 
   875         iCustomPhone.GetActivePin(activeCode);
   862         iCustomPhone.GetActivePin(activeCode);
   916                 break;
   903                 break;
   917                 }
   904                 }
   918             case KErrGsm0707OperationNotAllowed:
   905             case KErrGsm0707OperationNotAllowed:
   919                 {
   906                 {
   920                 // not allowed with this sim
   907                 // not allowed with this sim
   921                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
   908                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
   922                 return EFalse;
   909                 return EFalse;
   923                 }
   910                 }
   924             case KErrGsm0707IncorrectPassword:
   911             case KErrGsm0707IncorrectPassword:
   925             case KErrAccessDenied:
   912             case KErrAccessDenied:
   926                 {
   913                 {
  1030             case KErrGsm0707SIMPuk2Required:
  1017             case KErrGsm0707SIMPuk2Required:
  1031                 break;
  1018                 break;
  1032             case KErrGsmSSPasswordAttemptsViolation:
  1019             case KErrGsmSSPasswordAttemptsViolation:
  1033             case KErrLocked:
  1020             case KErrLocked:
  1034                 // Pin2 features blocked permanently!
  1021                 // Pin2 features blocked permanently!
  1035                 ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
  1022                 ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone);
  1036                 break;
  1023                 break;
  1037             case KErrGsm0707SimNotInserted:
  1024             case KErrGsm0707SimNotInserted:
  1038                 // not allowed with this sim
  1025                 // not allowed with this sim
  1039                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1026                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  1040                 break;
  1027                 break;
  1041             default:
  1028             default:
  1042                 ShowErrorNoteL(retPhone);
  1029                 ShowErrorNoteL(retPhone);
  1043                 break;
  1030                 break;
  1044             }
  1031             }
  1069     queryAccepted = KErrCancel;
  1056     queryAccepted = KErrCancel;
  1070     CSecQueryUi *iSecQueryUi;
  1057     CSecQueryUi *iSecQueryUi;
  1071     iSecQueryUi = CSecQueryUi::NewL();
  1058     iSecQueryUi = CSecQueryUi::NewL();
  1072     TBuf<0x100> title;
  1059     TBuf<0x100> title;
  1073     title.Zero();
  1060     title.Zero();
  1074     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code"));
  1061     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin2_code"),0);
  1075     title.Append(stringHolder->Des());
  1062     title.Append(stringHolder->Des());
  1076     CleanupStack::PopAndDestroy(stringHolder);
  1063     CleanupStack::PopAndDestroy(stringHolder);
  1077     title.Append(_L("$"));
  1064     title.Append(_L("$"));
  1078     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1065     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1079     queryAccepted = iSecQueryUi->SecQueryDialog(title, password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1066     queryAccepted = iSecQueryUi->SecQueryDialog(title, password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1103         case KErrNone:
  1090         case KErrNone:
  1104             break;
  1091             break;
  1105         case KErrGsm0707IncorrectPassword:
  1092         case KErrGsm0707IncorrectPassword:
  1106         case KErrAccessDenied:
  1093         case KErrAccessDenied:
  1107             // code was entered erroneously
  1094             // code was entered erroneously
  1108             ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1095             ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1109             return AskPin2L();
  1096             return AskPin2L();
  1110         case KErrGsm0707OperationNotAllowed:
  1097         case KErrGsm0707OperationNotAllowed:
  1111             // not allowed with this sim
  1098             // not allowed with this sim
  1112             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1099             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  1113             return EFalse;
  1100             return EFalse;
  1114         case KErrGsmSSPasswordAttemptsViolation:
  1101         case KErrGsmSSPasswordAttemptsViolation:
  1115         case KErrLocked:
  1102         case KErrLocked:
  1116             // code was blocked
  1103             // code was blocked
  1117             ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1104             ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1118             return EFalse;
  1105             return EFalse;
  1119         default:
  1106         default:
  1120             ShowErrorNoteL(retPhone);
  1107             ShowErrorNoteL(retPhone);
  1121             return AskPin2L();
  1108             return AskPin2L();
  1122         }
  1109         }
  1153             case KErrGsm0707SIMPuk2Required:
  1140             case KErrGsm0707SIMPuk2Required:
  1154                 break;
  1141                 break;
  1155             case KErrGsmSSPasswordAttemptsViolation:
  1142             case KErrGsmSSPasswordAttemptsViolation:
  1156             case KErrLocked:
  1143             case KErrLocked:
  1157                 // Pin2 features blocked permanently!
  1144                 // Pin2 features blocked permanently!
  1158                 ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
  1145                 ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone);
  1159                 break;
  1146                 break;
  1160             case KErrGsm0707SimNotInserted:
  1147             case KErrGsm0707SimNotInserted:
  1161                 // not allowed with this sim
  1148                 // not allowed with this sim
  1162                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1149                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  1163                 break;
  1150                 break;
  1164             default:
  1151             default:
  1165                 ShowErrorNoteL(ret);
  1152                 ShowErrorNoteL(ret);
  1166                 break;
  1153                 break;
  1167             }
  1154             }
  1212             break;
  1199             break;
  1213         case KErrAbort:
  1200         case KErrAbort:
  1214             break;
  1201             break;
  1215         case KErrGsm0707OperationNotAllowed:
  1202         case KErrGsm0707OperationNotAllowed:
  1216             // not allowed with this sim
  1203             // not allowed with this sim
  1217             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1204             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  1218             break;
  1205             break;
  1219         default:
  1206         default:
  1220             ShowErrorNoteL(status);
  1207             ShowErrorNoteL(status);
  1221             break;
  1208             break;
  1222         }
  1209         }
  1245 // qtdone
  1232 // qtdone
  1246 void CSecuritySettings::ShowErrorNoteL(TInt aError)
  1233 void CSecuritySettings::ShowErrorNoteL(TInt aError)
  1247     {
  1234     {
  1248     RDEBUG("aError", aError);
  1235     RDEBUG("aError", aError);
  1249 
  1236 
  1250     ShowResultNoteL(aError, CAknNoteDialog::EErrorTone);
  1237     ShowResultNoteL(aError, EErrorTone);
  1251     }
  1238     }
  1252 
  1239 
  1253 //
  1240 //
  1254 // ----------------------------------------------------------
  1241 // ----------------------------------------------------------
  1255 // CSecuritySettings::ShowResultNoteL()
  1242 // CSecuritySettings::ShowResultNoteL()
  1256 // Shows result note
  1243 // Shows result note
  1257 // ----------------------------------------------------------
  1244 // ----------------------------------------------------------
  1258 // qtdone
  1245 // qtdone
  1259 void CSecuritySettings::ShowResultNoteL(TInt aResourceID, CAknNoteDialog::TTone aTone)
  1246 void CSecuritySettings::ShowResultNoteL(TInt aResourceID, TInt aTone)
  1260     {
  1247     {
  1261     RDEBUG("aResourceID", aResourceID);
  1248     RDEBUG("aResourceID", aResourceID);
  1262 
  1249 
  1263     CHbDeviceMessageBoxSymbian* messageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
  1250     CHbDeviceMessageBoxSymbian* messageBox = CHbDeviceMessageBoxSymbian::NewL(CHbDeviceMessageBoxSymbian::EWarning);
  1264     const TInt KCriticalLevel = 2;
  1251     const TInt KCriticalLevel = 2;
  1310         case KErrNotSupported:
  1297         case KErrNotSupported:
  1311             titleTr.Append(_L("txt_pin_code_dpopinfo_operation_not_supported"));
  1298             titleTr.Append(_L("txt_pin_code_dpopinfo_operation_not_supported"));
  1312             title.Append(_L("Not Supported"));
  1299             title.Append(_L("Not Supported"));
  1313             break;
  1300             break;
  1314         case R_SEC_BLOCKED:
  1301         case R_SEC_BLOCKED:
  1315             titleTr.Append(_L("txt_pin_code_dpopinfo_security_blocked"));
  1302             titleTr.Append(_L("txt_devicelocking_dpophead_lock_code_is_blocked"));	// txt_pin_code_dpopinfo_security_blocked
  1316             title.Append(_L("BLOCKED"));
  1303             title.Append(_L("BLOCKED"));
  1317             break;
  1304             break;
  1318         case R_CODE_ERROR:
  1305         case R_CODE_ERROR:
  1319             titleTr.Append(_L("R_CODE_ERROR"));
  1306             titleTr.Append(_L("R_CODE_ERROR"));
  1320             title.Append(_L("ERROR"));
  1307             title.Append(_L("ERROR"));
  1327             titleTr.Append(_L("R_CONFIRMATION_NOTE"));
  1314             titleTr.Append(_L("R_CONFIRMATION_NOTE"));
  1328             title.Append(_L("CONFIRMED"));
  1315             title.Append(_L("CONFIRMED"));
  1329             satisfactoryIcon = 1;
  1316             satisfactoryIcon = 1;
  1330             break;
  1317             break;
  1331         case R_CODES_DONT_MATCH:
  1318         case R_CODES_DONT_MATCH:
  1332             titleTr.Append(_L("R_CODES_DONT_MATCH"));
  1319             titleTr.Append(_L("txt_devicelocking_dpophead_codes_do_not_match"));
  1333             title.Append(_L("CODES DONT MATCH"));
  1320             title.Append(_L("CODES DONT MATCH"));
  1334             break;
  1321             break;
  1335         case R_PIN_CODE_CHANGED_NOTE:
  1322         case R_PIN_CODE_CHANGED_NOTE:
  1336             titleTr.Append(_L("txt_pin_code_dpopinfo_code_chaged")); // note the spelling mistake "chaged"
  1323             titleTr.Append(_L("txt_pin_code_dpopinfo_code_chaged")); // note the spelling mistake "chaged"
  1337             title.Append(_L("PIN CODE CHANGED"));
  1324             title.Append(_L("PIN CODE CHANGED"));
  1494             // txt_pin_code_dpopinfo_if_failed_be_ready_with_puk
  1481             // txt_pin_code_dpopinfo_if_failed_be_ready_with_puk
  1495         }
  1482         }
  1496 
  1483 
  1497     HBufC* stringHolder;
  1484     HBufC* stringHolder;
  1498     RDEBUG("titleTr", 1);
  1485     RDEBUG("titleTr", 1);
  1499     stringHolder = HbTextResolverSymbian::LoadLC(titleTr); // titleTr  should I    TRAP( err,    ?
  1486     stringHolder = TranslateLC(titleTr,0); // titleTr  should I    TRAP( err,    ?
  1500     RDEBUG("got stringHolder", 1);
  1487     if(!stringHolder)
       
  1488     	{
       
  1489     	RDEBUG("not got stringHolder", 0);
       
  1490     	}
       
  1491   	else
       
  1492   		{
       
  1493     	RDEBUG("got stringHolder", 1);
       
  1494   		}
  1501     messageBox->SetTextL(stringHolder->Des()); // title
  1495     messageBox->SetTextL(stringHolder->Des()); // title
  1502     RDEBUG("aResourceID", aResourceID);
  1496     RDEBUG("aResourceID", aResourceID);
       
  1497     RDEBUG("titleTr", 0);
  1503     RDEBUGSTR(titleTr);
  1498     RDEBUGSTR(titleTr);
       
  1499     RDEBUG("stringHolder->Des()", 0);
       
  1500     RDEBUGSTR(stringHolder->Des());
  1504     _LIT(KIconNameWondering, "qtg_small_smiley_wondering");
  1501     _LIT(KIconNameWondering, "qtg_small_smiley_wondering");
  1505     _LIT(KIconNameSmile, "qtg_small_smiley_smile");
  1502     _LIT(KIconNameSmile, "qtg_small_smiley_smile");
  1506     if (satisfactoryIcon==1)
  1503     if (satisfactoryIcon==1)
  1507         messageBox->SetIconNameL(KIconNameSmile);
  1504         messageBox->SetIconNameL(KIconNameSmile);
  1508     else
  1505     else
  1509         messageBox->SetIconNameL(KIconNameWondering);
  1506         messageBox->SetIconNameL(KIconNameWondering);
  1510 
  1507 
  1511     if (aTone == CAknNoteDialog::EErrorTone) // another case is EConfirmationTone
  1508     if (aTone == EErrorTone) // another case is EConfirmationTone
  1512         {
  1509         {
  1513         messageBox->SetTimeout(messageBox->Timeout() * 2); // errors are displayed double time
  1510         messageBox->SetTimeout(messageBox->Timeout() * 2); // errors are displayed double time
  1514         }
  1511         }
  1515     // messageBox->ShowL();
  1512     // messageBox->ShowL();
  1516     RDEBUG("calling ExecL", 0);
  1513     RDEBUG("calling ExecL", 0);
  1517     CHbDeviceMessageBoxSymbian::TButtonId selection = messageBox->ExecL();	// this guarantees that it waits for the dismiss/timeout
  1514     CHbDeviceMessageBoxSymbian::TButtonId selection = messageBox->ExecL();	// this guarantees that it waits for the dismiss/timeout
  1518     RDEBUG("called ExecL.selection", selection);
  1515     RDEBUG("called ExecL.selection", selection);
       
  1516 
  1519     CleanupStack::PopAndDestroy(stringHolder);
  1517     CleanupStack::PopAndDestroy(stringHolder);
  1520     CleanupStack::PopAndDestroy(); // messageBox
  1518     CleanupStack::PopAndDestroy(); // messageBox
  1521 
  1519 
       
  1520 		RDEBUG("0x99", 0x99);
  1522     }
  1521     }
  1523 
  1522 
  1524 //
  1523 //
  1525 // ----------------------------------------------------------
  1524 // ----------------------------------------------------------
  1526 // CSecuritySettings::IsUpinSupportedL()
  1525 // CSecuritySettings::IsUpinSupportedL()
  1626     RDEBUG("aNewPassword", 0);
  1625     RDEBUG("aNewPassword", 0);
  1627     RDEBUGSTR(aNewPassword);
  1626     RDEBUGSTR(aNewPassword);
  1628     RDEBUG("aCaption", 0);
  1627     RDEBUG("aCaption", 0);
  1629     RDEBUGSTR(aCaption);
  1628     RDEBUGSTR(aCaption);
  1630     RDEBUG("aShowError", aShowError);
  1629     RDEBUG("aShowError", aShowError);
       
  1630     (void)aFlags;
       
  1631     (void)aCaption;
       
  1632     (void)aShowError;
  1631 
  1633 
  1632     /*****************************************************
  1634     /*****************************************************
  1633      *    Series 60 Customer / ETel
  1635      *    Series 60 Customer / ETel
  1634      *    Series 60  ETel API
  1636      *    Series 60  ETel API
  1635      *****************************************************/
  1637      *****************************************************/
  1641     TBool simRemoved(simState == ESimNotPresent);
  1643     TBool simRemoved(simState == ESimNotPresent);
  1642 
  1644 
  1643     RDEBUG("simRemoved", simRemoved);
  1645     RDEBUG("simRemoved", simRemoved);
  1644     if (simRemoved)
  1646     if (simRemoved)
  1645         {
  1647         {
  1646         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
  1648         ShowResultNoteL(R_INSERT_SIM, EErrorTone);
  1647         return KErrAccessDenied;
  1649         return KErrAccessDenied;
  1648         }
  1650         }
  1649     RMobilePhone::TMobilePhoneSecurityCode secCodeType;
  1651     RMobilePhone::TMobilePhoneSecurityCode secCodeType;
  1650     secCodeType = RMobilePhone::ESecurityCodePin1;
  1652     secCodeType = RMobilePhone::ESecurityCodePin1;
  1651 
  1653 
  1691 
  1693 
  1692     if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
  1694     if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
  1693         {
  1695         {
  1694         RDEBUG("RMobilePhone::ELockSetDisabled",
  1696         RDEBUG("RMobilePhone::ELockSetDisabled",
  1695                 RMobilePhone::ELockSetDisabled);
  1697                 RMobilePhone::ELockSetDisabled);
  1696         ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1698         ShowResultNoteL(R_PIN_NOT_ALLOWED, EErrorTone);
  1697         return KErrAccessDenied;
  1699         return KErrAccessDenied;
  1698         }
  1700         }
  1699 
  1701 
  1700     RDEBUG("0", 0);
  1702     RDEBUG("0", 0);
  1701     iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
  1703     iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
  1726         queryAccepted = KErrCancel;
  1728         queryAccepted = KErrCancel;
  1727         CSecQueryUi *iSecQueryUi;
  1729         CSecQueryUi *iSecQueryUi;
  1728         iSecQueryUi = CSecQueryUi::NewL();
  1730         iSecQueryUi = CSecQueryUi::NewL();
  1729         TBuf<0x100> title;
  1731         TBuf<0x100> title;
  1730         title.Zero();
  1732         title.Zero();
  1731         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code"));
  1733         HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin_code"),0);
  1732         title.Append(stringHolder->Des());
  1734         title.Append(stringHolder->Des());
  1733         CleanupStack::PopAndDestroy(stringHolder);
  1735         CleanupStack::PopAndDestroy(stringHolder);
  1734         title.Append(_L("$"));
  1736         title.Append(_L("$"));
  1735         title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1737         title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1736         queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1738         queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1753         if (res == KErrNotSupported)
  1755         if (res == KErrNotSupported)
  1754             res = KErrNone;
  1756             res = KErrNone;
  1755 #endif
  1757 #endif
  1756         if (res != KErrNone)
  1758         if (res != KErrNone)
  1757             {
  1759             {
  1758             ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
  1760             ShowResultNoteL(res, EErrorTone);
  1759 		        newPassword = _L("");
  1761 		        newPassword = _L("");
  1760 		        oldPassword = _L("");
  1762 		        oldPassword = _L("");
  1761             goto askChangePinParamsL;
  1763             goto askChangePinParamsL;
  1762             }
  1764             }
  1763 
  1765 
  1773     while (newPassword.Length() == 0)
  1775     while (newPassword.Length() == 0)
  1774         {
  1776         {
  1775         // this is not needed because the dialog won't allow to close, unless codes match
  1777         // this is not needed because the dialog won't allow to close, unless codes match
  1776         // codes do not match -> note -> ask new pin and verification codes again
  1778         // codes do not match -> note -> ask new pin and verification codes again
  1777         // if(newPassword.Length()>0)
  1779         // if(newPassword.Length()>0)
  1778         //  ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone);
  1780         //  ShowResultNoteL(R_CODES_DONT_MATCH, EErrorTone);
  1779 
  1781 
  1780         newPassword = _L("");
  1782         newPassword = _L("");
  1781 
  1783 
  1782         // new pin code query
  1784         // new pin code query
  1783         if (aOldPassword.Length() == 0) // only if input parameters are empty
  1785         if (aOldPassword.Length() == 0) // only if input parameters are empty
  1786             CSecQueryUi *iSecQueryUi;
  1788             CSecQueryUi *iSecQueryUi;
  1787             iSecQueryUi = CSecQueryUi::NewL();
  1789             iSecQueryUi = CSecQueryUi::NewL();
  1788             // this queries both, and verifies itself
  1790             // this queries both, and verifies itself
  1789             TBuf<0x100> title;
  1791             TBuf<0x100> title;
  1790             title.Zero();
  1792             title.Zero();
  1791             HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code"));
  1793             HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin_code"),0);
  1792             title.Append(stringHolder->Des());
  1794             title.Append(stringHolder->Des());
  1793             CleanupStack::PopAndDestroy(stringHolder);
  1795             CleanupStack::PopAndDestroy(stringHolder);
  1794             title.Append(_L("|"));
  1796             title.Append(_L("|"));
  1795             HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code"));
  1797             HBufC* stringHolder2 = TranslateLC(_L("txt_pin_code_dialog_verify_new_pin_code"),0);
  1796             title.Append(stringHolder2->Des());
  1798             title.Append(stringHolder2->Des());
  1797             CleanupStack::PopAndDestroy(stringHolder2);
  1799             CleanupStack::PopAndDestroy(stringHolder2);
  1798             queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1800             queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1799                     | ESecUiEmergencyNotSupported | secCodeType);
  1801                     | ESecUiEmergencyNotSupported | secCodeType);
  1800             RDEBUG("newPassword", 1);
  1802             RDEBUG("newPassword", 1);
  1828     switch (res)
  1830     switch (res)
  1829         {
  1831         {
  1830         case KErrNone:
  1832         case KErrNone:
  1831             {
  1833             {
  1832             // code changed 
  1834             // code changed 
  1833             ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  1835             ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, EConfirmationTone);
  1834             break;
  1836             break;
  1835             }
  1837             }
  1836         case KErrGsm0707IncorrectPassword:
  1838         case KErrGsm0707IncorrectPassword:
  1837         case KErrAccessDenied:
  1839         case KErrAccessDenied:
  1838             {
  1840             {
  1839             // code was entered erroneously. This is strange, because it was verified before
  1841             // code was entered erroneously. This is strange, because it was verified before
  1840             ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1842             ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1841             goto askChangePinParamsL;
  1843             goto askChangePinParamsL;
  1842             }
  1844             }
  1843         case KErrGsmSSPasswordAttemptsViolation:
  1845         case KErrGsmSSPasswordAttemptsViolation:
  1844         case KErrLocked:
  1846         case KErrLocked:
  1845             {
  1847             {
  1847             return KErrLocked;
  1849             return KErrLocked;
  1848             }
  1850             }
  1849         case KErrGsm0707OperationNotAllowed:
  1851         case KErrGsm0707OperationNotAllowed:
  1850             {
  1852             {
  1851             // not allowed with this sim
  1853             // not allowed with this sim
  1852             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1854             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  1853             return KErrGsm0707OperationNotAllowed;
  1855             return KErrGsm0707OperationNotAllowed;
  1854             }
  1856             }
  1855         case KErrAbort:
  1857         case KErrAbort:
  1856             {
  1858             {
  1857             break;
  1859             break;
  1895     User::LeaveIfError(err);
  1897     User::LeaveIfError(err);
  1896     TBool simRemoved(simState == ESimNotPresent);
  1898     TBool simRemoved(simState == ESimNotPresent);
  1897 
  1899 
  1898     if (simRemoved)
  1900     if (simRemoved)
  1899         {
  1901         {
  1900         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
  1902         ShowResultNoteL(R_INSERT_SIM, EErrorTone);
  1901         return KErrAccessDenied;
  1903         return KErrAccessDenied;
  1902         }
  1904         }
  1903 
  1905 
  1904     RMobilePhone::TMobilePhoneSecurityCode secCodeType;
  1906     RMobilePhone::TMobilePhoneSecurityCode secCodeType;
  1905     secCodeType = RMobilePhone::ESecurityUniversalPin;
  1907     secCodeType = RMobilePhone::ESecurityUniversalPin;
  1934 
  1936 
  1935     RDEBUG("lockInfo.iSetting", lockInfo.iSetting);
  1937     RDEBUG("lockInfo.iSetting", lockInfo.iSetting);
  1936     RDEBUG("RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled);
  1938     RDEBUG("RMobilePhone::ELockSetDisabled", RMobilePhone::ELockSetDisabled);
  1937     if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
  1939     if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
  1938         {
  1940         {
  1939         ShowResultNoteL(R_UPIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  1941         ShowResultNoteL(R_UPIN_NOT_ALLOWED, EErrorTone);
  1940         return KErrAccessDenied;
  1942         return KErrAccessDenied;
  1941         }
  1943         }
  1942 
  1944 
  1943     iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
  1945     iWait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
  1944     RDEBUG("GetSecurityCodeInfo", 0);
  1946     RDEBUG("GetSecurityCodeInfo", 0);
  1963     queryAccepted = KErrCancel;
  1965     queryAccepted = KErrCancel;
  1964     CSecQueryUi *iSecQueryUi;
  1966     CSecQueryUi *iSecQueryUi;
  1965     iSecQueryUi = CSecQueryUi::NewL();
  1967     iSecQueryUi = CSecQueryUi::NewL();
  1966     TBuf<0x100> title;
  1968     TBuf<0x100> title;
  1967     title.Zero();
  1969     title.Zero();
  1968     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code"));
  1970     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_upin_code"),0);
  1969     title.Append(stringHolder->Des());
  1971     title.Append(stringHolder->Des());
  1970     CleanupStack::PopAndDestroy(stringHolder);
  1972     CleanupStack::PopAndDestroy(stringHolder);
  1971     title.Append(_L("$"));
  1973     title.Append(_L("$"));
  1972     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1974     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1973     queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1975     queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1986         iSecQueryUi = CSecQueryUi::NewL();
  1988         iSecQueryUi = CSecQueryUi::NewL();
  1987         // this queries both, and verifies itself
  1989         // this queries both, and verifies itself
  1988         TBuf<0x100> title;
  1990         TBuf<0x100> title;
  1989         title.Zero();
  1991         title.Zero();
  1990 
  1992 
  1991         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code"));
  1993         HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_upin_code"),0);
  1992         title.Append(stringHolder->Des());
  1994         title.Append(stringHolder->Des());
  1993         CleanupStack::PopAndDestroy(stringHolder);
  1995         CleanupStack::PopAndDestroy(stringHolder);
  1994         title.Append(_L("|"));
  1996         title.Append(_L("|"));
  1995         HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_retype_upin_code"));
  1997         HBufC* stringHolder2 = TranslateLC(_L("txt_pin_code_dialog_retype_upin_code"),0);
  1996         title.Append(stringHolder2->Des());
  1998         title.Append(stringHolder2->Des());
  1997         CleanupStack::PopAndDestroy(stringHolder2);
  1999         CleanupStack::PopAndDestroy(stringHolder2);
  1998         queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  2000         queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1999                 | ESecUiEmergencyNotSupported | secCodeType);
  2001                 | ESecUiEmergencyNotSupported | secCodeType);
  2000         RDEBUG("newPassword", 0);
  2002         RDEBUG("newPassword", 0);
  2020     switch (res)
  2022     switch (res)
  2021         {
  2023         {
  2022         case KErrNone:
  2024         case KErrNone:
  2023             {
  2025             {
  2024             // code changed 
  2026             // code changed 
  2025             ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  2027             ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, EConfirmationTone);
  2026             break;
  2028             break;
  2027             }
  2029             }
  2028         case KErrGsm0707IncorrectPassword:
  2030         case KErrGsm0707IncorrectPassword:
  2029         case KErrAccessDenied:
  2031         case KErrAccessDenied:
  2030             {
  2032             {
  2031             // code was entered erroneously
  2033             // code was entered erroneously
  2032             ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  2034             ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  2033             ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError);
  2035             ChangeUPinParamsL(_L(""), _L(""), aFlags, aCaption, aShowError);
  2034             break;
  2036             break;
  2035             }
  2037             }
  2036         case KErrGsmSSPasswordAttemptsViolation:
  2038         case KErrGsmSSPasswordAttemptsViolation:
  2037         case KErrLocked:
  2039         case KErrLocked:
  2039             return KErrLocked;
  2041             return KErrLocked;
  2040             }
  2042             }
  2041         case KErrGsm0707OperationNotAllowed:
  2043         case KErrGsm0707OperationNotAllowed:
  2042             {
  2044             {
  2043             // not allowed with this sim
  2045             // not allowed with this sim
  2044             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  2046             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  2045             return KErrGsm0707OperationNotAllowed;
  2047             return KErrGsm0707OperationNotAllowed;
  2046             }
  2048             }
  2047         case KErrAbort:
  2049         case KErrAbort:
  2048             {
  2050             {
  2049             break;
  2051             break;
  2078     User::LeaveIfError(err);
  2080     User::LeaveIfError(err);
  2079     TBool simRemoved(simState == ESimNotPresent);
  2081     TBool simRemoved(simState == ESimNotPresent);
  2080 
  2082 
  2081     if (simRemoved)
  2083     if (simRemoved)
  2082         {
  2084         {
  2083         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
  2085         ShowResultNoteL(R_INSERT_SIM, EErrorTone);
  2084         return KErrAccessDenied;
  2086         return KErrAccessDenied;
  2085         }
  2087         }
  2086 
  2088 
  2087     RMmCustomAPI::TSecurityCodeType secCodeType;
  2089     RMmCustomAPI::TSecurityCodeType secCodeType;
  2088     RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType;
  2090     RMobilePhone::TMobilePhoneSecurityCode EtelsecCodeType;
  2116             case KErrGsm0707SIMPuk2Required:
  2118             case KErrGsm0707SIMPuk2Required:
  2117                 break;
  2119                 break;
  2118             case KErrGsmSSPasswordAttemptsViolation:
  2120             case KErrGsmSSPasswordAttemptsViolation:
  2119             case KErrLocked:
  2121             case KErrLocked:
  2120                 // Pin2 features blocked permanently!
  2122                 // Pin2 features blocked permanently!
  2121                 ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
  2123                 ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone);
  2122                 break;
  2124                 break;
  2123             case KErrGsm0707SimNotInserted:
  2125             case KErrGsm0707SimNotInserted:
  2124                 // not allowed with this sim
  2126                 // not allowed with this sim
  2125                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  2127                 ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  2126                 break;
  2128                 break;
  2127             default:
  2129             default:
  2128                 ShowErrorNoteL(ret);
  2130                 ShowErrorNoteL(ret);
  2129                 break;
  2131                 break;
  2130             }
  2132             }
  2158     queryAccepted = KErrCancel;
  2160     queryAccepted = KErrCancel;
  2159     CSecQueryUi *iSecQueryUi;
  2161     CSecQueryUi *iSecQueryUi;
  2160     iSecQueryUi = CSecQueryUi::NewL();
  2162     iSecQueryUi = CSecQueryUi::NewL();
  2161     TBuf<0x100> title;
  2163     TBuf<0x100> title;
  2162     title.Zero();
  2164     title.Zero();
  2163     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code"));
  2165     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin2_code"),0);
  2164     title.Append(stringHolder->Des());
  2166     title.Append(stringHolder->Des());
  2165     CleanupStack::PopAndDestroy(stringHolder);
  2167     CleanupStack::PopAndDestroy(stringHolder);
  2166     title.Append(_L("$"));
  2168     title.Append(_L("$"));
  2167     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  2169     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  2168     queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  2170     queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  2181         CSecQueryUi * iSecQueryUi;
  2183         CSecQueryUi * iSecQueryUi;
  2182         iSecQueryUi = CSecQueryUi::NewL();
  2184         iSecQueryUi = CSecQueryUi::NewL();
  2183         // this queries both, and verifies itself
  2185         // this queries both, and verifies itself
  2184         TBuf<0x100> title;
  2186         TBuf<0x100> title;
  2185         title.Zero();
  2187         title.Zero();
  2186         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code"));
  2188         HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin2_code"),0);
  2187         title.Append(stringHolder->Des());
  2189         title.Append(stringHolder->Des());
  2188         CleanupStack::PopAndDestroy(stringHolder);
  2190         CleanupStack::PopAndDestroy(stringHolder);
  2189         title.Append(_L("|"));
  2191         title.Append(_L("|"));
  2190         HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
  2192         HBufC* stringHolder2 = TranslateLC(_L("Verify"),0);
  2191         title.Append(stringHolder2->Des());
  2193         title.Append(stringHolder2->Des());
  2192         CleanupStack::PopAndDestroy(stringHolder2);
  2194         CleanupStack::PopAndDestroy(stringHolder2);
  2193         queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  2195         queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  2194                 | ESecUiEmergencyNotSupported | secCodeType);
  2196                 | ESecUiEmergencyNotSupported | secCodeType);
  2195         RDEBUG("newPassword", 0);
  2197         RDEBUG("newPassword", 0);
  2216     switch (res)
  2218     switch (res)
  2217         {
  2219         {
  2218         case KErrNone:
  2220         case KErrNone:
  2219             {
  2221             {
  2220             // code changed 
  2222             // code changed 
  2221             ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  2223             ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, EConfirmationTone);
  2222             break;
  2224             break;
  2223             }
  2225             }
  2224         case KErrGsm0707IncorrectPassword:
  2226         case KErrGsm0707IncorrectPassword:
  2225         case KErrAccessDenied:
  2227         case KErrAccessDenied:
  2226             {
  2228             {
  2227             ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  2229             ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  2228             ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError);
  2230             ChangePin2ParamsL(_L(""), _L(""), aFlags, aCaption, aShowError);
  2229             break;
  2231             break;
  2230             }
  2232             }
  2231         case KErrGsmSSPasswordAttemptsViolation:
  2233         case KErrGsmSSPasswordAttemptsViolation:
  2232         case KErrLocked:
  2234         case KErrLocked:
  2233             {
  2235             {
  2234             // Pin2 blocked!
  2236             // Pin2 blocked!
  2235             ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone);
  2237             ShowResultNoteL(KErrLocked, EErrorTone);
  2236             CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone);
  2238             CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone);
  2237             CleanupStack::PushL(handler);
  2239             CleanupStack::PushL(handler);
  2238             handler->HandleEventL(RMobilePhone::EPuk2Required);
  2240             handler->HandleEventL(RMobilePhone::EPuk2Required);
  2239             CleanupStack::PopAndDestroy(handler); // handler    
  2241             CleanupStack::PopAndDestroy(handler); // handler    
  2240             return KErrLocked;
  2242             return KErrLocked;
  2241             }
  2243             }
  2242         case KErrGsm0707OperationNotAllowed:
  2244         case KErrGsm0707OperationNotAllowed:
  2243             {
  2245             {
  2244             // not allowed with this sim
  2246             // not allowed with this sim
  2245             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  2247             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  2246             return KErrGsm0707OperationNotAllowed;
  2248             return KErrGsm0707OperationNotAllowed;
  2247             }
  2249             }
  2248         case KErrAbort:
  2250         case KErrAbort:
  2249             {
  2251             {
  2250             break;
  2252             break;
  2264         TInt aShowError)
  2266         TInt aShowError)
  2265     {
  2267     {
  2266     askChangeSecCodeParamsL:
  2268     askChangeSecCodeParamsL:
  2267     RDEBUG("aFlags", aFlags);
  2269     RDEBUG("aFlags", aFlags);
  2268     RDEBUG("aShowError", aShowError);
  2270     RDEBUG("aShowError", aShowError);
       
  2271     (void)aCaption;
       
  2272     (void)aFlags;
       
  2273     (void)aShowError;
  2269     /*****************************************************
  2274     /*****************************************************
  2270      *    Series 60 Customer / ETel
  2275      *    Series 60 Customer / ETel
  2271      *    Series 60  ETel API
  2276      *    Series 60  ETel API
  2272      *****************************************************/
  2277      *****************************************************/
  2273     TInt res = KErrNone;
  2278     TInt res = KErrNone;
  2305 		       res = KErrTDevicelockPolicies + failedPolicy;
  2310 		       res = KErrTDevicelockPolicies + failedPolicy;
  2306 		       }
  2311 		       }
  2307 	     	 scpClient.Close();
  2312 	     	 scpClient.Close();
  2308 	     	 if(res!=KErrNone)
  2313 	     	 if(res!=KErrNone)
  2309 	     	 		{
  2314 	     	 		{
  2310 	     	 		ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
  2315 	     	 		ShowResultNoteL(res, EErrorTone);
  2311      	 	 		return res;
  2316      	 	 		return res;
  2312      	 	 		}
  2317      	 	 		}
  2313 				}
  2318 				}
  2314 			else
  2319 			else
  2315 				{
  2320 				{
  2325         queryAccepted = KErrCancel;
  2330         queryAccepted = KErrCancel;
  2326         CSecQueryUi *iSecQueryUi;
  2331         CSecQueryUi *iSecQueryUi;
  2327         iSecQueryUi = CSecQueryUi::NewL();
  2332         iSecQueryUi = CSecQueryUi::NewL();
  2328         TBuf<0x100> title;
  2333         TBuf<0x100> title;
  2329         title.Zero();
  2334         title.Zero();
  2330         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code"));
  2335         HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_lock_code"),0);
  2331         title.Append(stringHolder->Des());
  2336         title.Append(stringHolder->Des());
  2332         CleanupStack::PopAndDestroy(stringHolder);
  2337         CleanupStack::PopAndDestroy(stringHolder);
  2333         queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported
  2338         queryAccepted = iSecQueryUi->SecQueryDialog(title, oldPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiAlphaSupported
  2334                 | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType);
  2339                 | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType);
  2335         RDEBUG("oldPassword", 0);
  2340         RDEBUG("oldPassword", 0);
  2358     TInt scpCurrFlags = 0;
  2363     TInt scpCurrFlags = 0;
  2359     RDEBUG("scpClient.VerifyCurrentLockcode", 0);
  2364     RDEBUG("scpClient.VerifyCurrentLockcode", 0);
  2360     // this validate on ISA . No need to do iPhone.VerifySecurityCode
  2365     // this validate on ISA . No need to do iPhone.VerifySecurityCode
  2361     retCurrLockcode = scpCurrClient.VerifyCurrentLockcode(oldPassword, aCurrISACode, aCurrFailedPolicies, scpCurrFlags);
  2366     retCurrLockcode = scpCurrClient.VerifyCurrentLockcode(oldPassword, aCurrISACode, aCurrFailedPolicies, scpCurrFlags);
  2362     RDEBUG("retCurrLockcode", retCurrLockcode);
  2367     RDEBUG("retCurrLockcode", retCurrLockcode);
  2363 
  2368 		retCurrLockcode=retCurrLockcode;
  2364     RDEBUG("aCurrISACode", 0);
  2369     RDEBUG("aCurrISACode", 0);
  2365     RDEBUGSTR(aCurrISACode);
  2370     RDEBUGSTR(aCurrISACode);
  2366     scpCurrClient.Close();
  2371     scpCurrClient.Close();
  2367     RDEBUG("PopAndDestroy", 0);
  2372     RDEBUG("PopAndDestroy", 0);
  2368     CleanupStack::PopAndDestroy(); //scpCurrClient
  2373     CleanupStack::PopAndDestroy(); //scpCurrClient
  2379         res = KErrNone;
  2384         res = KErrNone;
  2380 #endif
  2385 #endif
  2381 
  2386 
  2382     if (res != KErrNone)
  2387     if (res != KErrNone)
  2383         {
  2388         {
  2384         ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
  2389         ShowResultNoteL(res, EErrorTone);
  2385         return res;
  2390         return res;
  2386         }
  2391         }
  2387 
  2392 
  2388     while (newPassword.Length() == 0)
  2393     while (newPassword.Length() == 0)
  2389         {
  2394         {
  2390         // codes do not match -> note -> ask new pin and verification codes again  
  2395         // codes do not match -> note -> ask new pin and verification codes again  
  2391         // note that this never happens because the dialog doesn't dismiss until both codes match
  2396         // note that this never happens because the dialog doesn't dismiss until both codes match
  2392         if (newPassword.Length() > 0)
  2397         if (newPassword.Length() > 0)
  2393             ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone);
  2398             ShowResultNoteL(R_CODES_DONT_MATCH, EErrorTone);
  2394 
  2399 
  2395             {
  2400             {
  2396             queryAccepted = KErrCancel;
  2401             queryAccepted = KErrCancel;
  2397             CSecQueryUi *iSecQueryUi;
  2402             CSecQueryUi *iSecQueryUi;
  2398             iSecQueryUi = CSecQueryUi::NewL();
  2403             iSecQueryUi = CSecQueryUi::NewL();
  2400             // mix, max , alpha is handled using TARM params, in the dialog itself
  2405             // mix, max , alpha is handled using TARM params, in the dialog itself
  2401             TInt lType = ESecUiAlphaSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType;
  2406             TInt lType = ESecUiAlphaSupported | ESecUiCancelSupported | ESecUiEmergencyNotSupported | secCodeType;
  2402             RDEBUG("lType", lType);
  2407             RDEBUG("lType", lType);
  2403             TBuf<0x100> title;
  2408             TBuf<0x100> title;
  2404             title.Zero();
  2409             title.Zero();
  2405             HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_sec_code"));
  2410             HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_new_lock_code"),0);
  2406             title.Append(stringHolder->Des());
  2411             title.Append(stringHolder->Des());
  2407             CleanupStack::PopAndDestroy(stringHolder);
  2412             CleanupStack::PopAndDestroy(stringHolder);
  2408             title.Append(_L("|"));
  2413             title.Append(_L("|"));
  2409             HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
  2414             HBufC* stringHolder2 = TranslateLC(_L("txt_devicelocking_dialog_retype_new_lock_code"),0);
  2410             title.Append(stringHolder2->Des());
  2415             title.Append(stringHolder2->Des());
  2411             CleanupStack::PopAndDestroy(stringHolder2);
  2416             CleanupStack::PopAndDestroy(stringHolder2);
  2412             queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType);
  2417             queryAccepted = iSecQueryUi->SecQueryDialog(title, newPassword, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType);
  2413             RDEBUG("newPassword", 0);
  2418             RDEBUG("newPassword", 0);
  2414             RDEBUGSTR(newPassword);
  2419             RDEBUGSTR(newPassword);
  2467 	        RDEBUG("scpClient.StoreLockcode", 0);
  2472 	        RDEBUG("scpClient.StoreLockcode", 0);
  2468 	        // this is the old method. Obsolete now
  2473 	        // this is the old method. Obsolete now
  2469 	        // scpClient.StoreCode( newCode );
  2474 	        // scpClient.StoreCode( newCode );
  2470 	        RArray<TDevicelockPolicies> aFailedPolicies;
  2475 	        RArray<TDevicelockPolicies> aFailedPolicies;
  2471 	        TDevicelockPolicies failedPolicy;
  2476 	        TDevicelockPolicies failedPolicy;
       
  2477 	        failedPolicy = failedPolicy;
  2472 	        RDEBUG("newScpCode", 0);
  2478 	        RDEBUG("newScpCode", 0);
  2473 	        RDEBUGSTR( newScpCode );
  2479 	        RDEBUGSTR( newScpCode );
  2474 	        RDEBUG("oldScpCode", 0);
  2480 	        RDEBUG("oldScpCode", 0);
  2475 	        RDEBUGSTR( oldScpCode );
  2481 	        RDEBUGSTR( oldScpCode );
  2476 	        RDEBUG( "StoreLockcode", 0 );
  2482 	        RDEBUG( "StoreLockcode", 0 );
  2492 	      	switch (res)
  2498 	      	switch (res)
  2493 		        {
  2499 		        {
  2494 		        case KErrNone:
  2500 		        case KErrNone:
  2495 		            {
  2501 		            {
  2496 	            	RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE );
  2502 	            	RDEBUG( "showing R_SECURITY_CODE_CHANGED_NOTE", R_SECURITY_CODE_CHANGED_NOTE );
  2497 	            	ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  2503 	            	ShowResultNoteL(R_SECURITY_CODE_CHANGED_NOTE, EConfirmationTone);
  2498 		            break;
  2504 		            break;
  2499 		          	}
  2505 		          	}
  2500 		        case KErrAccessDenied:	// TARM has wrong UID
  2506 		        case KErrAccessDenied:	// TARM has wrong UID
  2501 		            {
  2507 		            {
  2502 	          		res = KErrTDevicelockPolicies+EDevicelockTotalPolicies+1;
  2508 	          		res = KErrTDevicelockPolicies+EDevicelockTotalPolicies+1;
  2503 	          		RDEBUG( "res", res );
  2509 	          		RDEBUG( "res", res );
  2504 	          		ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone);
  2510 	          		ShowResultNoteL(res, EConfirmationTone);
  2505 	          		res = KErrAccessDenied;	// no reason for retry, as it will fail again and again
  2511 	          		res = KErrAccessDenied;	// no reason for retry, as it will fail again and again
  2506 	          		break;
  2512 	          		break;
  2507 	          		}
  2513 	          		}
  2508 		        case KErrGsmSSPasswordAttemptsViolation:
  2514 		        case KErrGsmSSPasswordAttemptsViolation:
  2509 		        case KErrLocked:
  2515 		        case KErrLocked:
  2510 		            {
  2516 		            {
  2511 	          		RDEBUG( "KErrLocked", KErrLocked );
  2517 	          		RDEBUG( "KErrLocked", KErrLocked );
  2512 		            ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone);
  2518 		            ShowResultNoteL(R_SEC_BLOCKED, EErrorTone);
  2513 		            goto askChangeSecCodeParamsL;
  2519 		            goto askChangeSecCodeParamsL;
  2514 		            // break;
  2520 		            // break;
  2515 		            }
  2521 		            }
  2516 		        case KErrGsm0707IncorrectPassword:
  2522 		        case KErrGsm0707IncorrectPassword:
  2517 		            {
  2523 		            {
  2518 		            // code was entered erroneously
  2524 		            // code was entered erroneously
  2519 	          		RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword );
  2525 	          		RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword );
  2520 		            ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  2526 		            ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  2521 		            goto askChangeSecCodeParamsL;
  2527 		            goto askChangeSecCodeParamsL;
  2522 		            // break;
  2528 		            // break;
  2523 		            }
  2529 		            }
  2524 		        case KErrAbort:
  2530 		        case KErrAbort:
  2525 		            {
  2531 		            {
  2546 EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError)
  2552 EXPORT_C TInt CSecuritySettings::ChangeAutoLockPeriodParamsL(TInt aPeriod, RMobilePhone::TMobilePassword aOldPassword, TInt aFlags, TDes& aCaption, TInt aShowError)
  2547     {
  2553     {
  2548     askChangeAutoLockPeriodParamsL:
  2554     askChangeAutoLockPeriodParamsL:
  2549     RDEBUG("aPeriod", aPeriod);
  2555     RDEBUG("aPeriod", aPeriod);
  2550     RDEBUG("aFlags", aFlags);
  2556     RDEBUG("aFlags", aFlags);
       
  2557     (void)aOldPassword;
       
  2558     (void)aCaption;
       
  2559     (void)aShowError;
       
  2560     (void)aFlags;
  2551     /*****************************************************
  2561     /*****************************************************
  2552      *    Series 60 Customer / ETel
  2562      *    Series 60 Customer / ETel
  2553      *    Series 60  ETel API
  2563      *    Series 60  ETel API
  2554      *****************************************************/
  2564      *****************************************************/
  2555 
  2565 
  2556     RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled);
  2566     RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled);
  2557     RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice;
  2567     RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice;
  2558     TInt oldPeriod = aPeriod;
  2568     TInt oldPeriod = aPeriod;
       
  2569     oldPeriod=oldPeriod;
  2559 
  2570 
  2560     TInt maxPeriod = 0;
  2571     TInt maxPeriod = 0;
  2561     if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw))
  2572     if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw))
  2562         {
  2573         {
  2563         // Retrieve the current autolock period max. value from the SCP server, 
  2574         // Retrieve the current autolock period max. value from the SCP server, 
  2598         {
  2609         {
  2599         if ((aPeriod == 0) && (maxPeriod > 0))
  2610         if ((aPeriod == 0) && (maxPeriod > 0))
  2600             {
  2611             {
  2601             RDEBUG("The period is not allowed by TARM", aPeriod);
  2612             RDEBUG("The period is not allowed by TARM", aPeriod);
  2602             RDEBUG( "maxPeriod", maxPeriod );
  2613             RDEBUG( "maxPeriod", maxPeriod );
  2603             ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, CAknNoteDialog::EErrorTone);
  2614             ShowResultNoteL(R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE, EErrorTone);
  2604             return R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE; // don't ask again. Settings will roll-back
  2615             return R_SECUI_TEXT_AUTOLOCK_MUST_BE_ACTIVE; // don't ask again. Settings will roll-back
  2605           	}
  2616           	}
  2606         }
  2617         }
  2607 
  2618 
  2608     if (aPeriod == 0)
  2619     if (aPeriod == 0)
  2663         {
  2674         {
  2664         case KErrNone:
  2675         case KErrNone:
  2665             break;
  2676             break;
  2666         case KErrGsmSSPasswordAttemptsViolation:
  2677         case KErrGsmSSPasswordAttemptsViolation:
  2667         case KErrLocked:
  2678         case KErrLocked:
  2668             RDEBUG("KErrLocked", KErrLocked)
  2679             RDEBUG("KErrLocked", KErrLocked);
  2669             ;
  2680             // ShowResultNoteL(KErrLocked, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it.
  2670             ShowResultNoteL(KErrLocked, CAknNoteDialog::EErrorTone); // the old code didn't show messages
       
  2671             goto askChangeAutoLockPeriodParamsL; // ask again
  2681             goto askChangeAutoLockPeriodParamsL; // ask again
  2672         case KErrGsm0707IncorrectPassword:
  2682         case KErrGsm0707IncorrectPassword:
  2673             RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword)
  2683             RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword)
  2674             ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // the old code didn't show messages
  2684             // ShowResultNoteL(R_CODE_ERROR, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it.
  2675             goto askChangeAutoLockPeriodParamsL; // ask again
  2685             goto askChangeAutoLockPeriodParamsL; // ask again
  2676         case KErrAccessDenied:
  2686         case KErrAccessDenied:
  2677             RDEBUG("KErrAccessDenied", KErrAccessDenied)
  2687             RDEBUG("KErrAccessDenied", KErrAccessDenied)
  2678             ;
  2688             ;
  2679             // code was entered erroneously
  2689             // code was entered erroneously
  2680             ShowResultNoteL(KErrAccessDenied, CAknNoteDialog::EErrorTone); // the old code didn't show messages
  2690             // ShowResultNoteL(KErrAccessDenied, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it.
  2681             goto askChangeAutoLockPeriodParamsL; // ask again
  2691             goto askChangeAutoLockPeriodParamsL; // ask again
  2682         case KErrAbort:
  2692         case KErrAbort:
  2683             // User pressed "cancel" in the code query dialog.
  2693             // User pressed "cancel" in the code query dialog.
  2684             RDEBUG("KErrAbort", KErrAbort)
  2694             RDEBUG("KErrAbort", KErrAbort)
  2685             return KErrAbort;
  2695             return KErrAbort;
  2686         default:
  2696         default:
  2687             RDEBUG("default", status)
  2697             RDEBUG("default", status)
  2688             ;
  2698             ;
  2689             ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // the old code didn't show messages
  2699             // ShowResultNoteL(status, EErrorTone); // the old code didn't show messages. PassPhraseRequiredL does it.
  2690             goto askChangeAutoLockPeriodParamsL; // ask again
  2700             goto askChangeAutoLockPeriodParamsL; // ask again
  2691         }
  2701         }
  2692     RDEBUG("aPeriod", aPeriod);
  2702     RDEBUG("aPeriod", aPeriod);
  2693     return aPeriod;
  2703     return aPeriod;
  2694     }
  2704     }
  2705     User::LeaveIfError(err);
  2715     User::LeaveIfError(err);
  2706     TBool simRemoved(simState == ESimNotPresent);
  2716     TBool simRemoved(simState == ESimNotPresent);
  2707 
  2717 
  2708     if (simRemoved)
  2718     if (simRemoved)
  2709         {
  2719         {
  2710         ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone);
  2720         ShowResultNoteL(R_INSERT_SIM, EErrorTone);
  2711         return KErrAccessDenied;
  2721         return KErrAccessDenied;
  2712         }
  2722         }
  2713 
  2723 
  2714     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
  2724     RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
  2715     RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
  2725     RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
  2780             break;
  2790             break;
  2781             }
  2791             }
  2782         case KErrGsm0707OperationNotAllowed:
  2792         case KErrGsm0707OperationNotAllowed:
  2783             {
  2793             {
  2784             // not allowed with this sim
  2794             // not allowed with this sim
  2785             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, CAknNoteDialog::EErrorTone);
  2795             ShowResultNoteL(R_OPERATION_NOT_ALLOWED, EErrorTone);
  2786             return KErrGsm0707OperationNotAllowed;
  2796             return KErrGsm0707OperationNotAllowed;
  2787             }
  2797             }
  2788         case KErrGsm0707IncorrectPassword:
  2798         case KErrGsm0707IncorrectPassword:
  2789         case KErrAccessDenied:
  2799         case KErrAccessDenied:
  2790             {
  2800             {
  2819     {
  2829     {
  2820     RDEBUG("aFlags", aFlags);
  2830     RDEBUG("aFlags", aFlags);
  2821     RDEBUG("aShowError", aShowError);
  2831     RDEBUG("aShowError", aShowError);
  2822     RDEBUG("This doesn't do anything", 0);
  2832     RDEBUG("This doesn't do anything", 0);
  2823     RDEBUG("aFlags", aFlags);
  2833     RDEBUG("aFlags", aFlags);
       
  2834     (void)aCaption;
       
  2835     (void)aFlags;
       
  2836     (void)aShowError;
  2824 
  2837 
  2825     // the password parameters are not used
  2838     // the password parameters are not used
  2826     if (aOldPassword.Length() > 0)
  2839     if (aOldPassword.Length() > 0)
  2827         RDEBUGSTR(aOldPassword);
  2840         RDEBUGSTR(aOldPassword);
  2828 
  2841 
  2829     return EFalse;
  2842     return EFalse;
  2830     }
  2843     }
       
  2844 //
       
  2845 // ----------------------------------------------------------
       
  2846 // CSecuritySettings::TranslateLC()
       
  2847 // ----------------------------------------------------------
       
  2848 // qtdone
       
  2849 HBufC* CSecuritySettings::TranslateLC(const TDesC& aMessageId, TInt aFlags)
       
  2850     {
       
  2851     RDEBUG("aFlags", aFlags);
       
  2852     RDEBUG("aMessageId", 1);
       
  2853     (void)aFlags;
       
  2854 
       
  2855     _LIT(KPath, "z:/resource/qt/translations/");
       
  2856 
       
  2857 		TBool result=EFalse;
       
  2858 		result=result;
       
  2859     TBuf<0x100> title;
       
  2860     title.Zero();
       
  2861 		HBufC* stringHolder;
       
  2862     RDEBUG("before stringHolder", 0);
       
  2863 		stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2864     RDEBUG("got stringHolder", 1);
       
  2865 		title.Append(stringHolder->Des());
       
  2866     RDEBUG("title", 0);
       
  2867     RDEBUGSTR(title);
       
  2868 		RDEBUG("searched in default", 1);
       
  2869 		// this doesn't work because an error in HbTextResolverSymbian::Init
       
  2870 		int doDoubleTranslations = 0;
       
  2871 		RDEBUG("doDoubleTranslations", doDoubleTranslations);
       
  2872 		if(doDoubleTranslations && !title.CompareF(aMessageId))
       
  2873 			{
       
  2874 			// not translated. Now check in common
       
  2875 			// CleanupStack::PopAndDestroy(stringHolder);
       
  2876 				RDEBUG("1", 1);
       
  2877 			title.Zero();
       
  2878 				RDEBUG("1", 1);
       
  2879     	_LIT(KFileNameSecUi, "secui_");
       
  2880 				RDEBUG("1", 1);
       
  2881 	    result = HbTextResolverSymbian::Init(KFileNameSecUi, KPath);
       
  2882 				RDEBUG("1", 1);
       
  2883 	    RDEBUG("bool result", result);
       
  2884 				RDEBUG("1", 1);
       
  2885 			stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2886 				RDEBUG("1", 1);
       
  2887 			title.Append(stringHolder->Des());
       
  2888 				RDEBUG("1", 1);
       
  2889 			RDEBUG("searched in KFileNameSecUi", 1);
       
  2890 			// RDEBUGSTR(aMessageId);
       
  2891 			}
       
  2892 				RDEBUG("1", 1);
       
  2893 		if(doDoubleTranslations && !title.CompareF(aMessageId))
       
  2894 			{
       
  2895 				RDEBUG("1", 1);
       
  2896 			// not translated. Now check in common
       
  2897 			// CleanupStack::PopAndDestroy(stringHolder);
       
  2898 				RDEBUG("1", 1);
       
  2899 			title.Zero();
       
  2900 				RDEBUG("1", 1);
       
  2901     	_LIT(KFileNameCommon, "common_");
       
  2902 				RDEBUG("1", 1);
       
  2903 	    result = HbTextResolverSymbian::Init(KFileNameCommon, KPath);
       
  2904 	    RDEBUG("bool result", result);
       
  2905 			stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2906 				RDEBUG("1", 1);
       
  2907 			title.Append(stringHolder->Des());
       
  2908 			RDEBUG("searched in KFileNameCommon", 1);
       
  2909 			// RDEBUGSTR(aMessageId);
       
  2910 			}
       
  2911 		if(doDoubleTranslations && !title.CompareF(aMessageId))
       
  2912 			{
       
  2913 			// not translated. Now check in devicelocking
       
  2914 				RDEBUG("1", 1);
       
  2915 			CleanupStack::PopAndDestroy(stringHolder);
       
  2916 				RDEBUG("1", 1);
       
  2917 			title.Zero();
       
  2918 				RDEBUG("1", 1);
       
  2919     	_LIT(KFileNameDevicelocking, "devicelocking_");
       
  2920 				RDEBUG("1", 1);
       
  2921 	    result = HbTextResolverSymbian::Init(KFileNameDevicelocking, KPath);
       
  2922 	    RDEBUG("bool result", result);
       
  2923 			stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2924 				RDEBUG("1", 1);
       
  2925 			title.Append(stringHolder->Des());
       
  2926 			RDEBUG("searched in KFileNameDevicelocking", 1);
       
  2927 			// RDEBUGSTR(aMessageId);
       
  2928 			}
       
  2929 		// this is done by the caller: CleanupStack::PopAndDestroy(stringHolder);
       
  2930 		RDEBUG("0x99", 0x99);
       
  2931 		return stringHolder;
       
  2932     }
  2831 
  2933 
  2832 // End of file
  2934 // End of file