securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp
changeset 66 67b3e3c1fc87
parent 63 989397f9511c
equal deleted inserted replaced
63:989397f9511c 66:67b3e3c1fc87
    14  * Description:  Provides api for handling security events.
    14  * Description:  Provides api for handling security events.
    15  *
    15  *
    16  *
    16  *
    17  */
    17  */
    18 #include <e32notif.h>
    18 #include <e32notif.h>
    19 #include <aknnotedialog.h>
    19 // #include <aknnotedialog.h>
    20 #include <etelmm.h>
    20 #include <etelmm.h>
    21 // #include <SecUi.rsg>
    21 // #include <SecUi.rsg>
    22 #include <exterror.h>
    22 #include <exterror.h>
    23 #include <textresolver.h>
    23 #include <textresolver.h>
    24 
    24 
    25 #ifdef __COVER_DISPLAY
       
    26 #include <aknmediatorfacade.h>
       
    27 #endif //__COVER_DISPLAY
       
    28 #include <centralrepository.h> 
    25 #include <centralrepository.h> 
    29 #include <e32property.h>
    26 #include <e32property.h>
    30 
    27 
    31 #include <PSVariables.h>   // Property values
    28 #include <PSVariables.h>   // Property values
    32 #include <coreapplicationuisdomainpskeys.h>
    29 #include <coreapplicationuisdomainpskeys.h>
    33 #include <startupdomainpskeys.h>
    30 #include <startupdomainpskeys.h>
    34 // #include <uikon/eiksrvui.h>
    31 // #include <uikon/eiksrvui.h>
    35 #include <settingsinternalcrkeys.h>
    32 #include <settingsinternalcrkeys.h>
    36 #include <securityuisprivatepskeys.h>
    33 #include <securityuisprivatepskeys.h>
    37 // #include <AknNotiferAppServerApplication.h>
       
    38 
    34 
    39 #include <SCPClient.h>
    35 #include <SCPClient.h>
    40 #include <securitynotification.h>
    36 #include <securitynotification.h>
    41 #include "secui.hrh"
    37 #include "secui.hrh"
    42 #include "SecUi.h"
    38 #include "SecUi.h"
    67 // CSecurityHandler::CSecurityHandler()
    63 // CSecurityHandler::CSecurityHandler()
    68 // C++ constructor
    64 // C++ constructor
    69 // ----------------------------------------------------------
    65 // ----------------------------------------------------------
    70 // qtdone
    66 // qtdone
    71 EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone) :
    67 EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone) :
    72     iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL)
    68     iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL)
    73     {
    69     {
    74     RDEBUG("0", 0);
    70     RDEBUG("0", 0);
    75 
    71 
    76     TInt result = iCustomPhone.Open(aPhone);
    72     TInt result = iCustomPhone.Open(aPhone);
    77     RDEBUG("result", result);
    73     RDEBUG("result", result);
    78     TRAP_IGNORE(FeatureManager::InitializeLibL()); //Shouldn't this panic if FM does not initialise??
    74     TRAP_IGNORE(FeatureManager::InitializeLibL()); //Shouldn't this panic if FM does not initialise??
    79 
    75 
    80     _LIT(KFileName, "secui_");
    76     _LIT(KFileName, "secui_");
    81     _LIT(KPath, "z:/resource/qt/translations/");
    77     _LIT(KPath, "z:/resource/qt/translations/");
    82     RDEBUG("HbTextResolverSymbian", 0);
    78     RDEBUG("HbTextResolverSymbian", 0);
    83     result = HbTextResolverSymbian::Init(KFileName, KPath);
    79     TBool resultResolver = HbTextResolverSymbian::Init(KFileName, KPath);
    84     RDEBUG("result", result);
    80     RDEBUG("resultResolver", resultResolver);
       
    81 
       
    82 		RDEBUG("0x99", 0x99);
    85     }
    83     }
    86 
    84 
    87 //
    85 //
    88 // ----------------------------------------------------------
    86 // ----------------------------------------------------------
    89 // CSecurityHandler::~CSecurityHandler()
    87 // CSecurityHandler::~CSecurityHandler()
   261         iQueryCanceled = EFalse;
   259         iQueryCanceled = EFalse;
   262         lAlphaSupported = ESecUiAlphaSupported;
   260         lAlphaSupported = ESecUiAlphaSupported;
   263         lCancelSupported = ESecUiCancelSupported;
   261         lCancelSupported = ESecUiCancelSupported;
   264         TBuf<0x100> title;
   262         TBuf<0x100> title;
   265         title.Zero();
   263         title.Zero();
   266         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code"));
   264         HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_lock_code"),0);	// old txt_pin_code_dialog_sec_code. Perhaps txt_devicelocking_dialog_lock_code_unlock
   267         title.Append(stringHolder->Des());
   265         title.Append(stringHolder->Des());
   268         CleanupStack::PopAndDestroy(stringHolder);
   266         CleanupStack::PopAndDestroy(stringHolder);
   269         title.Append(_L("$"));
   267         title.Append(_L("$"));
   270         title.AppendNum(-1);	// Don't know the number of remaining attempts
   268         title.AppendNum(-1);	// Don't know the number of remaining attempts
   271         queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported
   269         queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported
   292 
   290 
   293     CleanupClosePushL(scpClient);
   291     CleanupClosePushL(scpClient);
   294 
   292 
   295     RArray<TDevicelockPolicies> aFailedPolicies;
   293     RArray<TDevicelockPolicies> aFailedPolicies;
   296     TInt retLockcode = KErrNone;
   294     TInt retLockcode = KErrNone;
       
   295     retLockcode = retLockcode;
   297     RMobilePhone::TMobilePassword aISACode;
   296     RMobilePhone::TMobilePassword aISACode;
   298     TInt scpFlags = 0;
   297     TInt scpFlags = 0;
   299     RDEBUG("scpClient.VerifyCurrentLockcode", 0);
   298     RDEBUG("scpClient.VerifyCurrentLockcode", 0);
   300     // this validate on ISA . No need to do iPhone.VerifySecurityCode
   299     // this validate on ISA . No need to do iPhone.VerifySecurityCode
   301     retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, scpFlags);
   300     retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, scpFlags);
   361                 }
   360                 }
   362             case KErrGsmSSPasswordAttemptsViolation:
   361             case KErrGsmSSPasswordAttemptsViolation:
   363             case KErrLocked:
   362             case KErrLocked:
   364                 {
   363                 {
   365                 // security code blocked! 
   364                 // security code blocked! 
   366                 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone);
   365                 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, EErrorTone);
   367                 break;
   366                 break;
   368                 }
   367                 }
   369             case KErrGsm0707IncorrectPassword:
   368             case KErrGsm0707IncorrectPassword:
   370             case KErrAccessDenied:
   369             case KErrAccessDenied:
   371                 {
   370                 {
   372                 // code was entered erroneusly
   371                 // code was entered erroneusly
   373                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
   372                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
   374                 break;
   373                 break;
   375                 }
   374                 }
   376             default:
   375             default:
   377                 {
   376                 {
   378                 CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone);
   377                 CSecuritySettings::ShowResultNoteL(status, EErrorTone);
   379                 }
   378                 }
   380             }
   379             }
   381         RDEBUG("while AskSecCodeL", 1);
   380         RDEBUG("while AskSecCodeL", 1);
   382         iSecUi_password.Copy(_L(""));	// clear password so that the next time, it shows empty
   381         iSecUi_password.Copy(_L(""));	// clear password so that the next time, it shows empty
   383         } // while
   382         } // while
   419             {
   418             {
   420             RDEBUG("deleting iSecurityDlg", 0);
   419             RDEBUG("deleting iSecurityDlg", 0);
   421             res += 0x100;
   420             res += 0x100;
   422             delete iSecurityDlg;
   421             delete iSecurityDlg;
   423             }
   422             }
   424         if (iNoteDlg != NULL)
       
   425             {
       
   426             RDEBUG("deleting iNoteDlg", 0);
       
   427             res += 0x1000;
       
   428             delete iNoteDlg;
       
   429             }
       
   430         iNoteDlg = NULL;
       
   431         iSecurityDlg = NULL;
   423         iSecurityDlg = NULL;
   432         }
   424         }
   433     res += 0x10000;
   425     res += 0x10000;
   434     RDEBUG("res", res);
   426     RDEBUG("res", res);
   435     return res;
   427     return res;
   754     iQueryCanceled = EFalse;
   746     iQueryCanceled = EFalse;
   755     TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk;
   747     TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk;
   756     RDEBUG("lType", lType);
   748     RDEBUG("lType", lType);
   757     TBuf<0x100> title;
   749     TBuf<0x100> title;
   758     title.Zero();
   750     title.Zero();
   759     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code"));
   751     HBufC* stringHolder = TranslateLC(_L("txt_devicelocking_dialog_lock_code_unlock"),0);	// old txt_pin_code_dialog_sec_code
   760     title.Append(stringHolder->Des());
   752     title.Append(stringHolder->Des());
   761     CleanupStack::PopAndDestroy(stringHolder);
   753     CleanupStack::PopAndDestroy(stringHolder);
   762     queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType);
   754     queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType);
   763     RDEBUG("iSecUi_password", 0);
   755     RDEBUG("iSecUi_password", 0);
   764     RDEBUGSTR(iSecUi_password);
   756     RDEBUGSTR(iSecUi_password);
   798     CleanupClosePushL(scpClient);
   790     CleanupClosePushL(scpClient);
   799 
   791 
   800     RArray<TDevicelockPolicies> aFailedPolicies;
   792     RArray<TDevicelockPolicies> aFailedPolicies;
   801     TDevicelockPolicies failedPolicy;
   793     TDevicelockPolicies failedPolicy;
   802     TInt retLockcode = KErrNone;
   794     TInt retLockcode = KErrNone;
       
   795     retLockcode = retLockcode;
   803     RMobilePhone::TMobilePassword aISACode;
   796     RMobilePhone::TMobilePassword aISACode;
   804     TInt scpFlags = 0;
   797     TInt scpFlags = 0;
   805     RDEBUG("scpClient.VerifyCurrentLockcode", 0);
   798     RDEBUG("scpClient.VerifyCurrentLockcode", 0);
   806     // this validate on ISA . No need to do iPhone.VerifySecurityCode
   799     // this validate on ISA . No need to do iPhone.VerifySecurityCode
   807     retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, scpFlags);
   800     retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, scpFlags);
   895             	{
   888             	{
   896             	RDEBUG("code has just been changed. No need to show Confirmation note. failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration);
   889             	RDEBUG("code has just been changed. No need to show Confirmation note. failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration);
   897             	}
   890             	}
   898             else
   891             else
   899             	{
   892             	{
   900             	CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone);
   893             	RDEBUG("no R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE);
       
   894             	// there's no need to show the note. Not when it's changed. Not when it becomes unlocked. Not on boot. Not on manual locking. not after *#7370#
       
   895             	// 
       
   896             	// CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, EConfirmationTone);
   901             	}
   897             	}
   902             RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE);
       
   903             if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw))
   898             if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw))
   904                 {
   899                 {
   905                 RDEBUG("KFeatureIdSapTerminalControlFw",
   900                 RDEBUG("KFeatureIdSapTerminalControlFw",
   906                         KFeatureIdSapTerminalControlFw);
   901                         KFeatureIdSapTerminalControlFw);
   907                 // Unset the admin flag if set
   902                 // Unset the admin flag if set
  1052         case KErrLocked:
  1047         case KErrLocked:
  1053         		{
  1048         		{
  1054             // security code blocked!
  1049             // security code blocked!
  1055             RDEBUG("KErrLocked", KErrLocked)
  1050             RDEBUG("KErrLocked", KErrLocked)
  1056             ;
  1051             ;
  1057             CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone);
  1052             CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, EErrorTone);
  1058           	}
  1053           	}
  1059             break;
  1054             break;
  1060         case KErrGsm0707IncorrectPassword:
  1055         case KErrGsm0707IncorrectPassword:
  1061         		{
  1056         		{
  1062     				RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword);
  1057     				RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword);
  1063             // The Settings caller might retry
  1058             // The Settings caller might retry
  1064             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1059             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1065             if(StartUp)
  1060             if(StartUp)
  1066             	goto askPassPhraseRequiredL;
  1061             	goto askPassPhraseRequiredL;
  1067           	}
  1062           	}
  1068             break;
  1063             break;
  1069     				// and continue
  1064     				// and continue
  1070         case KErrAccessDenied:
  1065         case KErrAccessDenied:
  1071         		{
  1066         		{
  1072             RDEBUG("KErrAccessDenied", KErrAccessDenied);
  1067             RDEBUG("KErrAccessDenied", KErrAccessDenied);
  1073             // The Settings caller might retry
  1068             // The Settings caller might retry
  1074             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1069             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1075           	}
  1070           	}
  1076             break;
  1071             break;
  1077         case R_CODES_DONT_MATCH:	// if password was supposed to be changed, but it failed (the initial verification)
  1072         case R_CODES_DONT_MATCH:	// if password was supposed to be changed, but it failed (the initial verification)
  1078         		{
  1073         		{
  1079             RDEBUG("R_CODES_DONT_MATCH", R_CODES_DONT_MATCH);
  1074             RDEBUG("R_CODES_DONT_MATCH", R_CODES_DONT_MATCH);
  1177     RDEBUG("SecQueryDialog", 1);
  1172     RDEBUG("SecQueryDialog", 1);
  1178     // ESecUiCodeEtelReqest/ESecUiNone might be useful
  1173     // ESecUiCodeEtelReqest/ESecUiNone might be useful
  1179     lAlphaSupported = ESecUiAlphaNotSupported;
  1174     lAlphaSupported = ESecUiAlphaNotSupported;
  1180     TBuf<0x100> title;
  1175     TBuf<0x100> title;
  1181     title.Zero();
  1176     title.Zero();
  1182     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code"));
  1177     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin_code"),0);
  1183     title.Append(stringHolder->Des());
  1178     title.Append(stringHolder->Des());
  1184     CleanupStack::PopAndDestroy(stringHolder);
  1179     CleanupStack::PopAndDestroy(stringHolder);
  1185     title.Append(_L("$"));
  1180     title.Append(_L("$"));
  1186     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1181     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1187     TInt amode = ESecUiSecretSupported | lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeType;
  1182     TInt amode = ESecUiSecretSupported | lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeType;
  1192     iQueryCanceled = ETrue;
  1187     iQueryCanceled = ETrue;
  1193     delete iSecQueryUi;
  1188     delete iSecQueryUi;
  1194     RDEBUG("queryAccepted", queryAccepted);
  1189     RDEBUG("queryAccepted", queryAccepted);
  1195     /* end request PIN using QT */
  1190     /* end request PIN using QT */
  1196 
  1191 
  1197     if (queryAccepted == KErrAbort) // emergency call
  1192     if (queryAccepted == KErrAbort || queryAccepted == KErrArgument) // emergency call
  1198         {
  1193         {
  1199         RDEBUG("queryAccepted", queryAccepted);
  1194         RDEBUG("queryAccepted", queryAccepted);
  1200         CleanupStack::PopAndDestroy(wait); // this is needed
  1195         CleanupStack::PopAndDestroy(wait); // this is needed
  1201         return KErrCancel;
  1196         return KErrCancel;
  1202         }
  1197         }
  1226             // code approved
  1221             // code approved
  1227             RDEBUG("code approved", res)
  1222             RDEBUG("code approved", res)
  1228             ;
  1223             ;
  1229             if (lCancelSupported == ESecUiCancelNotSupported)
  1224             if (lCancelSupported == ESecUiCancelNotSupported)
  1230                 { // OK note is not displayed in boot-up, to make things faster
  1225                 { // OK note is not displayed in boot-up, to make things faster
  1231                 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone);
  1226                 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, EConfirmationTone);
  1232                 }
  1227                 }
  1233             break;
  1228             break;
  1234         case KErrGsm0707IncorrectPassword:
  1229         case KErrGsm0707IncorrectPassword:
  1235         case KErrAccessDenied:
  1230         case KErrAccessDenied:
  1236             // code was entered erroneously
  1231             // code was entered erroneously
  1237             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1232             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1238            	RDEBUG("StartUp", StartUp);
  1233            	RDEBUG("StartUp", StartUp);
  1239             if (StartUp)
  1234             if (StartUp)
  1240                 {
  1235                 {
  1241                 returnValue = Pin1RequiredL();
  1236                 returnValue = Pin1RequiredL();
  1242                 }
  1237                 }
  1245         case KErrLocked:
  1240         case KErrLocked:
  1246             // code blocked; show error note and terminate.
  1241             // code blocked; show error note and terminate.
  1247             // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp
  1242             // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp
  1248            	RDEBUG("StartUp", StartUp);
  1243            	RDEBUG("StartUp", StartUp);
  1249             if (StartUp)
  1244             if (StartUp)
  1250                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1245                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1251             break;
  1246             break;
  1252         case KErrGsm0707SimWrong:
  1247         case KErrGsm0707SimWrong:
  1253             // sim lock active
  1248             // sim lock active
  1254             // no error? This is strange
  1249             // no error? This is strange
  1255             break;
  1250             break;
  1319             codeInfo.iRemainingEntryAttempts);
  1314             codeInfo.iRemainingEntryAttempts);
  1320     TInt attempts(codeInfo.iRemainingEntryAttempts);
  1315     TInt attempts(codeInfo.iRemainingEntryAttempts);
  1321     RDEBUG("attempts", attempts);
  1316     RDEBUG("attempts", attempts);
  1322     // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog
  1317     // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog
  1323     if (!StartUp && (attempts == KMaxNumberOfPUKAttempts))
  1318     if (!StartUp && (attempts == KMaxNumberOfPUKAttempts))
  1324         CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1319         CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1325 
  1320 
  1326     if (attempts == KMaxNumberOfPINAttempts)
  1321     if (attempts == KMaxNumberOfPINAttempts)
  1327         attempts = -1;
  1322         attempts = -1;
  1328 
  1323 
  1329     CSecQueryUi *iSecQueryUi;
  1324     CSecQueryUi *iSecQueryUi;
  1332     iQueryCanceled = EFalse;
  1327     iQueryCanceled = EFalse;
  1333     RDEBUG("SecQueryDialog", 1);
  1328     RDEBUG("SecQueryDialog", 1);
  1334     // ESecUiCodeEtelReqest/ESecUiNone might be useful
  1329     // ESecUiCodeEtelReqest/ESecUiNone might be useful
  1335     TBuf<0x100> title;
  1330     TBuf<0x100> title;
  1336     title.Zero();
  1331     title.Zero();
  1337     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code"));
  1332     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_puk_code"),0);
  1338     title.Append(stringHolder->Des());
  1333     title.Append(stringHolder->Des());
  1339     CleanupStack::PopAndDestroy(stringHolder);
  1334     CleanupStack::PopAndDestroy(stringHolder);
  1340     title.Append(_L("$"));
  1335     title.Append(_L("$"));
  1341     title.AppendNum(attempts);
  1336     title.AppendNum(attempts);
  1342     TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported;
  1337     TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported;
  1373     TInt returnValue = res;
  1368     TInt returnValue = res;
  1374     switch (res)
  1369     switch (res)
  1375         {
  1370         {
  1376         case KErrNone:
  1371         case KErrNone:
  1377             // code approved -> note . The process continue and new-pin is requested
  1372             // code approved -> note . The process continue and new-pin is requested
  1378             CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone);
  1373             CSecuritySettings::ShowResultNoteL(res, EConfirmationTone);
  1379             break;
  1374             break;
  1380         case KErrGsm0707IncorrectPassword:
  1375         case KErrGsm0707IncorrectPassword:
  1381         case KErrAccessDenied:
  1376         case KErrAccessDenied:
  1382             // wrong PUK code -> note -> ask PUK code again        
  1377             // wrong PUK code -> note -> ask PUK code again        
  1383             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1378             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1384            	RDEBUG("goto askPuk1RequiredL", 0);
  1379            	RDEBUG("goto askPuk1RequiredL", 0);
  1385             goto askPuk1RequiredL;
  1380             goto askPuk1RequiredL;
  1386             // break;
  1381             // break;
  1387         case KErrGsm0707SimWrong:
  1382         case KErrGsm0707SimWrong:
  1388             // sim lock active
  1383             // sim lock active
  1410         iSecQueryUi = CSecQueryUi::NewL();
  1405         iSecQueryUi = CSecQueryUi::NewL();
  1411         iQueryCanceled = EFalse;
  1406         iQueryCanceled = EFalse;
  1412         RDEBUG("SecQueryDialog", 1);
  1407         RDEBUG("SecQueryDialog", 1);
  1413         TBuf<0x100> title;
  1408         TBuf<0x100> title;
  1414         title.Zero();
  1409         title.Zero();
  1415         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code"));
  1410         HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin_code"),0);
  1416         title.Append(stringHolder->Des());
  1411         title.Append(stringHolder->Des());
  1417         CleanupStack::PopAndDestroy(stringHolder);
  1412         CleanupStack::PopAndDestroy(stringHolder);
  1418         title.Append(_L("|"));
  1413         title.Append(_L("|"));
  1419         HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code"));
  1414         HBufC* stringHolder2 = TranslateLC(_L("txt_pin_code_dialog_verify_new_pin_code"),0);
  1420         title.Append(stringHolder2->Des());
  1415         title.Append(stringHolder2->Des());
  1421         CleanupStack::PopAndDestroy(stringHolder2);
  1416         CleanupStack::PopAndDestroy(stringHolder2);
  1422         lSecUiCancelSupported = ESecUiCancelNotSupported; 	// initialy it was ESecUiCancelSupported , but an error said "Becaouse, if it is can be canceled, why desigh this step about newpincode confirm"
  1417         lSecUiCancelSupported = ESecUiCancelNotSupported; 	// initialy it was ESecUiCancelSupported , but an error said "Becaouse, if it is can be canceled, why desigh this step about newpincode confirm"
  1423         																										// Somehow both scenarios make sense: User should not cancel because the code has been already changed to PUK.
  1418         																										// Somehow both scenarios make sense: User should not cancel because the code has been already changed to PUK.
  1424         																										// On the other hand, this happened because user forgot the PIN. Now you know it: same as PUK. So user can cancel.
  1419         																										// On the other hand, this happened because user forgot the PIN. Now you know it: same as PUK. So user can cancel.
  1454     returnValue = res;
  1449     returnValue = res;
  1455     switch (res)
  1450     switch (res)
  1456         {
  1451         {
  1457         case KErrNone:
  1452         case KErrNone:
  1458             // code approved -> note
  1453             // code approved -> note
  1459             CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  1454             CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, EConfirmationTone);
  1460             break;
  1455             break;
  1461         case KErrGsm0707IncorrectPassword:
  1456         case KErrGsm0707IncorrectPassword:
  1462         case KErrAccessDenied:
  1457         case KErrAccessDenied:
  1463             // wrong PUK code -> note -> ask PUK code again        
  1458             // wrong PUK code -> note -> ask PUK code again        
  1464             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1459             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1465             returnValue = Puk1RequiredL();
  1460             returnValue = Puk1RequiredL();
  1466             break;
  1461             break;
  1467         case KErrGsm0707SimWrong:
  1462         case KErrGsm0707SimWrong:
  1468             // sim lock active
  1463             // sim lock active
  1469             // no message ?
  1464             // no message ?
  1524     RDEBUG("SecQueryDialog", 1);
  1519     RDEBUG("SecQueryDialog", 1);
  1525     // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt
  1520     // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt
  1526 
  1521 
  1527     TBuf<0x100> title;
  1522     TBuf<0x100> title;
  1528     title.Zero();
  1523     title.Zero();
  1529     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code"));
  1524     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_pin2_code"),0);
  1530     title.Append(stringHolder->Des());
  1525     title.Append(stringHolder->Des());
  1531     CleanupStack::PopAndDestroy(stringHolder);
  1526     CleanupStack::PopAndDestroy(stringHolder);
  1532     title.Append(_L("$"));
  1527     title.Append(_L("$"));
  1533     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1528     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1534     queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
  1529     queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
  1561         case KErrNone:
  1556         case KErrNone:
  1562             break;
  1557             break;
  1563         case KErrGsm0707IncorrectPassword:
  1558         case KErrGsm0707IncorrectPassword:
  1564         case KErrAccessDenied:
  1559         case KErrAccessDenied:
  1565             // code was entered erroneously
  1560             // code was entered erroneously
  1566             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1561             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1567             break;
  1562             break;
  1568         case KErrGsmSSPasswordAttemptsViolation:
  1563         case KErrGsmSSPasswordAttemptsViolation:
  1569         case KErrLocked:
  1564         case KErrLocked:
  1570             // blocked
  1565             // blocked
  1571             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1566             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1572             break;
  1567             break;
  1573         default:
  1568         default:
  1574             CSecuritySettings::ShowErrorNoteL(status);
  1569             CSecuritySettings::ShowErrorNoteL(status);
  1575             break;
  1570             break;
  1576         }
  1571         }
  1624     if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ?
  1619     if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ?
  1625         codeInfo.iRemainingEntryAttempts = -1;
  1620         codeInfo.iRemainingEntryAttempts = -1;
  1626 
  1621 
  1627     TBuf<0x100> title;
  1622     TBuf<0x100> title;
  1628     title.Zero();
  1623     title.Zero();
  1629     HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk2_code"));
  1624     HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_puk2_code"),0);
  1630     title.Append(stringHolder->Des());
  1625     title.Append(stringHolder->Des());
  1631     CleanupStack::PopAndDestroy(stringHolder);
  1626     CleanupStack::PopAndDestroy(stringHolder);
  1632     title.Append(_L("$"));
  1627     title.Append(_L("$"));
  1633     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1628     title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1634     queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
  1629     queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
  1659 
  1654 
  1660     switch (res)
  1655     switch (res)
  1661         {
  1656         {
  1662         case KErrNone:
  1657         case KErrNone:
  1663             // code approved -> note
  1658             // code approved -> note
  1664             CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone);
  1659             CSecuritySettings::ShowResultNoteL(res, EConfirmationTone);
  1665             break;
  1660             break;
  1666         case KErrGsm0707IncorrectPassword:
  1661         case KErrGsm0707IncorrectPassword:
  1667         case KErrAccessDenied:
  1662         case KErrAccessDenied:
  1668             // wrong PUK2 code -> note -> ask PUK2 code again        
  1663             // wrong PUK2 code -> note -> ask PUK2 code again        
  1669             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1664             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1670             RDEBUG("goto askPuk2RequiredL", 0);
  1665             RDEBUG("goto askPuk2RequiredL", 0);
  1671             goto askPuk2RequiredL;
  1666             goto askPuk2RequiredL;
  1672             // break;
  1667             // break;
  1673         case KErrGsmSSPasswordAttemptsViolation:
  1668         case KErrGsmSSPasswordAttemptsViolation:
  1674         case KErrLocked:
  1669         case KErrLocked:
  1675             // Pin2 features blocked permanently!
  1670             // Pin2 features blocked permanently!
  1676             CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
  1671             CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone);
  1677             break;
  1672             break;
  1678         default:
  1673         default:
  1679             CSecuritySettings::ShowErrorNoteL(res);
  1674             CSecuritySettings::ShowErrorNoteL(res);
  1680             RDEBUG("goto askPuk2RequiredL", 0);
  1675             RDEBUG("goto askPuk2RequiredL", 0);
  1681             goto askPuk2RequiredL;
  1676             goto askPuk2RequiredL;
  1691         RDEBUG("CSecQueryUi", 0);
  1686         RDEBUG("CSecQueryUi", 0);
  1692         iSecQueryUi = CSecQueryUi::NewL();
  1687         iSecQueryUi = CSecQueryUi::NewL();
  1693         iQueryCanceled = EFalse;
  1688         iQueryCanceled = EFalse;
  1694         TBuf<0x100> title;
  1689         TBuf<0x100> title;
  1695         title.Zero();
  1690         title.Zero();
  1696         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code"));
  1691         HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_pin2_code"),0);
  1697         title.Append(stringHolder->Des());
  1692         title.Append(stringHolder->Des());
  1698         CleanupStack::PopAndDestroy(stringHolder);
  1693         CleanupStack::PopAndDestroy(stringHolder);
  1699         title.Append(_L("|"));
  1694         title.Append(_L("|"));
  1700         HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
  1695         HBufC* stringHolder2 = TranslateLC(_L("Verify"),0);
  1701         title.Append(stringHolder2->Des());
  1696         title.Append(stringHolder2->Des());
  1702         CleanupStack::PopAndDestroy(stringHolder2);
  1697         CleanupStack::PopAndDestroy(stringHolder2);
  1703         // ESecUiCodeEtelReqest/ESecUiNone might be useful
  1698         // ESecUiCodeEtelReqest/ESecUiNone might be useful
  1704         queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1699         queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1705                 | secCodeType);
  1700                 | secCodeType);
  1729 		// this can't fail, as PUK2 was just verified
  1724 		// this can't fail, as PUK2 was just verified
  1730     switch (res)
  1725     switch (res)
  1731         {
  1726         {
  1732         case KErrNone:
  1727         case KErrNone:
  1733             // code approved -> note
  1728             // code approved -> note
  1734             CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  1729             CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, EConfirmationTone);
  1735             break;
  1730             break;
  1736         case KErrGsm0707IncorrectPassword:
  1731         case KErrGsm0707IncorrectPassword:
  1737         case KErrAccessDenied:
  1732         case KErrAccessDenied:
  1738             // wrong PUK2 code -> note -> ask PUK2 code again        
  1733             // wrong PUK2 code -> note -> ask PUK2 code again        
  1739             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1734             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1740             Puk2RequiredL();
  1735             Puk2RequiredL();
  1741             break;
  1736             break;
  1742         case KErrGsmSSPasswordAttemptsViolation:
  1737         case KErrGsmSSPasswordAttemptsViolation:
  1743         case KErrLocked:
  1738         case KErrLocked:
  1744             // Pin2 features blocked permanently!
  1739             // Pin2 features blocked permanently!
  1745             CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
  1740             CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, EConfirmationTone);
  1746             break;
  1741             break;
  1747         default:
  1742         default:
  1748             CSecuritySettings::ShowErrorNoteL(res);
  1743             CSecuritySettings::ShowErrorNoteL(res);
  1749             Puk2RequiredL();
  1744             Puk2RequiredL();
  1750             break;
  1745             break;
  1812         else
  1807         else
  1813             lCancelSupported = ESecUiCancelSupported;
  1808             lCancelSupported = ESecUiCancelSupported;
  1814 
  1809 
  1815         TBuf<0x100> title;
  1810         TBuf<0x100> title;
  1816         title.Zero();
  1811         title.Zero();
  1817         HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code"));
  1812         HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_upin_code"),0);
  1818         title.Append(stringHolder->Des());
  1813         title.Append(stringHolder->Des());
  1819         CleanupStack::PopAndDestroy(stringHolder);
  1814         CleanupStack::PopAndDestroy(stringHolder);
  1820         title.Append(_L("$"));
  1815         title.Append(_L("$"));
  1821         title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1816         title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1822         queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiSecretSupported | ESecUiAlphaNotSupported
  1817         queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiSecretSupported | ESecUiAlphaNotSupported
  1847             {
  1842             {
  1848             case KErrNone:
  1843             case KErrNone:
  1849                 // code approved 
  1844                 // code approved 
  1850                 RDEBUG("code approved ", 0)
  1845                 RDEBUG("code approved ", 0)
  1851                 ;
  1846                 ;
  1852                 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone);
  1847                 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, EConfirmationTone);
  1853                 break;
  1848                 break;
  1854             case KErrGsm0707IncorrectPassword:
  1849             case KErrGsm0707IncorrectPassword:
  1855             case KErrAccessDenied:
  1850             case KErrAccessDenied:
  1856                 // code was entered erroneously
  1851                 // code was entered erroneously
  1857                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1852                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1858                 if (StartUp)
  1853                 if (StartUp)
  1859                     {
  1854                     {
  1860                     returnValue = UPinRequiredL();
  1855                     returnValue = UPinRequiredL();
  1861                     }
  1856                     }
  1862                 break;
  1857                 break;
  1863             case KErrGsmSSPasswordAttemptsViolation:
  1858             case KErrGsmSSPasswordAttemptsViolation:
  1864             case KErrLocked:
  1859             case KErrLocked:
  1865                 // code blocked; show error note and terminate.
  1860                 // code blocked; show error note and terminate.
  1866                 if (StartUp)
  1861                 if (StartUp)
  1867                     CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
  1862                     CSecuritySettings::ShowResultNoteL(res, EErrorTone);
  1868                 break;
  1863                 break;
  1869             case KErrGsm0707SimWrong:
  1864             case KErrGsm0707SimWrong:
  1870                 // sim lock active
  1865                 // sim lock active
  1871                 break;
  1866                 break;
  1872             default: // for example, KErrArgument
  1867             default: // for example, KErrArgument
  1918         res = wait->WaitForRequestL();
  1913         res = wait->WaitForRequestL();
  1919         RDEBUG("WaitForRequestL res", res);
  1914         RDEBUG("WaitForRequestL res", res);
  1920         User::LeaveIfError(res);
  1915         User::LeaveIfError(res);
  1921         //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog
  1916         //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog
  1922         if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts))
  1917         if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts))
  1923             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  1918             CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  1924 
  1919 
  1925         // ask UPUK code
  1920         // ask UPUK code
  1926         /* request PIN using QT */
  1921         /* request PIN using QT */
  1927             {
  1922             {
  1928             CSecQueryUi *iSecQueryUi;
  1923             CSecQueryUi *iSecQueryUi;
  1932             // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
  1927             // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
  1933             // TODO also support Emergency
  1928             // TODO also support Emergency
  1934 
  1929 
  1935             TBuf<0x100> title;
  1930             TBuf<0x100> title;
  1936             title.Zero();
  1931             title.Zero();
  1937             HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code"));
  1932             HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_puk_code"),0);
  1938             title.Append(stringHolder->Des());
  1933             title.Append(stringHolder->Des());
  1939             CleanupStack::PopAndDestroy(stringHolder);
  1934             CleanupStack::PopAndDestroy(stringHolder);
  1940             title.Append(_L("$"));
  1935             title.Append(_L("$"));
  1941             title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1936             title.AppendNum(codeInfo.iRemainingEntryAttempts);
  1942             queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported
  1937             queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported
  1962             iQueryCanceled = EFalse;
  1957             iQueryCanceled = EFalse;
  1963             // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
  1958             // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
  1964             // TODO also support Emergency
  1959             // TODO also support Emergency
  1965             TBuf<0x100> title;
  1960             TBuf<0x100> title;
  1966             title.Zero();
  1961             title.Zero();
  1967             HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code"));
  1962             HBufC* stringHolder = TranslateLC(_L("txt_pin_code_dialog_new_upin_code"),0);
  1968             title.Append(stringHolder->Des());
  1963             title.Append(stringHolder->Des());
  1969             CleanupStack::PopAndDestroy(stringHolder);
  1964             CleanupStack::PopAndDestroy(stringHolder);
  1970             title.Append(_L("|"));
  1965             title.Append(_L("|"));
  1971             HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
  1966             HBufC* stringHolder2 = TranslateLC(_L("Verify"),0);
  1972             title.Append(stringHolder2->Des());
  1967             title.Append(stringHolder2->Des());
  1973             CleanupStack::PopAndDestroy(stringHolder2);
  1968             CleanupStack::PopAndDestroy(stringHolder2);
  1974             queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1969             queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
  1975                     | ESecUiPukRequired);
  1970                     | ESecUiPukRequired);
  1976             RDEBUG("aNewPassword", 0);
  1971             RDEBUG("aNewPassword", 0);
  1996         TInt returnValue = res;
  1991         TInt returnValue = res;
  1997         switch (res)
  1992         switch (res)
  1998             {
  1993             {
  1999             case KErrNone:
  1994             case KErrNone:
  2000                 // code approved -> note
  1995                 // code approved -> note
  2001                 CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
  1996                 CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, EConfirmationTone);
  2002                 break;
  1997                 break;
  2003             case KErrGsm0707IncorrectPassword:
  1998             case KErrGsm0707IncorrectPassword:
  2004             case KErrAccessDenied:
  1999             case KErrAccessDenied:
  2005                 // wrong PUK code -> note -> ask UPUK code again        
  2000                 // wrong PUK code -> note -> ask UPUK code again        
  2006                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
  2001                 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, EErrorTone);
  2007                 returnValue = UPukRequiredL();
  2002                 returnValue = UPukRequiredL();
  2008                 break;
  2003                 break;
  2009             case KErrGsm0707SimWrong:
  2004             case KErrGsm0707SimWrong:
  2010                 // sim lock active
  2005                 // sim lock active
  2011                 break;
  2006                 break;
  2033 // ----------------------------------------------------------
  2028 // ----------------------------------------------------------
  2034 // qtdone
  2029 // qtdone
  2035 void CSecurityHandler::SimLockEventL()
  2030 void CSecurityHandler::SimLockEventL()
  2036     {
  2031     {
  2037     RDEBUG("0", 0);
  2032     RDEBUG("0", 0);
  2038     CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone);
  2033     CSecuritySettings::ShowResultNoteL(R_SIM_ON, EConfirmationTone);
  2039     }
  2034     }
  2040 // ---------------------------------------------------------
  2035 // ---------------------------------------------------------
  2041 // CSecurityHandler::RemoveSplashScreenL()
  2036 // CSecurityHandler::RemoveSplashScreenL()
  2042 // Removes splash screen
  2037 // Removes splash screen
  2043 // ---------------------------------------------------------
  2038 // ---------------------------------------------------------
  2055     {
  2050     {
  2056     // Let's create TextResolver instance for error resolving...
  2051     // Let's create TextResolver instance for error resolving...
  2057     RDEBUG("aStatus", aStatus);
  2052     RDEBUG("aStatus", aStatus);
  2058     RDEBUG("!!!!! this should never be called !!!!", 0);
  2053     RDEBUG("!!!!! this should never be called !!!!", 0);
  2059 
  2054 
  2060     CSecuritySettings::ShowResultNoteL(aStatus, CAknNoteDialog::EErrorTone);
  2055     CSecuritySettings::ShowResultNoteL(aStatus, EErrorTone);
  2061     }
  2056     }
       
  2057 //
       
  2058 // ----------------------------------------------------------
       
  2059 // CSecuritySettings::TranslateLC()
       
  2060 // ----------------------------------------------------------
       
  2061 // qtdone
       
  2062 HBufC* CSecurityHandler::TranslateLC(const TDesC& aMessageId, TInt aFlags)
       
  2063     {
       
  2064     RDEBUG("aFlags", aFlags);
       
  2065     RDEBUG("aMessageId", 1);
       
  2066 		(void)aFlags;
       
  2067 		
       
  2068     _LIT(KPath, "z:/resource/qt/translations/");
       
  2069 
       
  2070 		TBool result=EFalse;
       
  2071 		result=result;
       
  2072     TBuf<0x100> title;
       
  2073     title.Zero();
       
  2074 		HBufC* stringHolder;
       
  2075     RDEBUG("before stringHolder", 0);
       
  2076 		stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2077     RDEBUG("got stringHolder", 1);
       
  2078 		title.Append(stringHolder->Des());
       
  2079     RDEBUG("title", 0);
       
  2080     RDEBUGSTR(title);
       
  2081 		RDEBUG("searched in default", 1);
       
  2082 		// this doesn't work because and error in HbTextResolverSymbian::Init
       
  2083 		int doDoubleTranslations = 0;
       
  2084 		RDEBUG("doDoubleTranslations", doDoubleTranslations);
       
  2085 		if(doDoubleTranslations && !title.CompareF(aMessageId))
       
  2086 			{
       
  2087 			// not translated. Now check in common
       
  2088 			CleanupStack::PopAndDestroy(stringHolder);
       
  2089 				RDEBUG("1", 1);
       
  2090 			title.Zero();
       
  2091 				RDEBUG("1", 1);
       
  2092     	_LIT(KFileNameSecUi, "secui_");
       
  2093 				RDEBUG("1", 1);
       
  2094 	    result = HbTextResolverSymbian::Init(KFileNameSecUi, KPath);
       
  2095 				RDEBUG("1", 1);
       
  2096 	    RDEBUG("bool result", result);
       
  2097 				RDEBUG("1", 1);
       
  2098 			stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2099 				RDEBUG("1", 1);
       
  2100 			title.Append(stringHolder->Des());
       
  2101 				RDEBUG("1", 1);
       
  2102 			RDEBUG("searched in KFileNameSecUi", 1);
       
  2103 			// RDEBUGSTR(aMessageId);
       
  2104 			}
       
  2105 				RDEBUG("1", 1);
       
  2106 		if(doDoubleTranslations && !title.CompareF(aMessageId))
       
  2107 			{
       
  2108 				RDEBUG("1", 1);
       
  2109 			// not translated. Now check in common
       
  2110 			CleanupStack::PopAndDestroy(stringHolder);
       
  2111 				RDEBUG("1", 1);
       
  2112 			title.Zero();
       
  2113 				RDEBUG("1", 1);
       
  2114     	_LIT(KFileNameCommon, "common_");
       
  2115 				RDEBUG("1", 1);
       
  2116 	    result = HbTextResolverSymbian::Init(KFileNameCommon, KPath);
       
  2117 	    RDEBUG("bool result", result);
       
  2118 			stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2119 				RDEBUG("1", 1);
       
  2120 			title.Append(stringHolder->Des());
       
  2121 			RDEBUG("searched in KFileNameCommon", 1);
       
  2122 			// RDEBUGSTR(aMessageId);
       
  2123 			}
       
  2124 		if(doDoubleTranslations && !title.CompareF(aMessageId))
       
  2125 			{
       
  2126 			// not translated. Now check in devicelocking
       
  2127 				RDEBUG("1", 1);
       
  2128 			CleanupStack::PopAndDestroy(stringHolder);
       
  2129 				RDEBUG("1", 1);
       
  2130 			title.Zero();
       
  2131 				RDEBUG("1", 1);
       
  2132     	_LIT(KFileNameDevicelocking, "devicelocking_");
       
  2133 				RDEBUG("1", 1);
       
  2134 	    result = HbTextResolverSymbian::Init(KFileNameDevicelocking, KPath);
       
  2135 	    RDEBUG("bool result", result);
       
  2136 			stringHolder = HbTextResolverSymbian::LoadLC(aMessageId);
       
  2137 				RDEBUG("1", 1);
       
  2138 			title.Append(stringHolder->Des());
       
  2139 			RDEBUG("searched in KFileNameDevicelocking", 1);
       
  2140 			// RDEBUGSTR(aMessageId);
       
  2141 			}
       
  2142 		// this is done by the caller: CleanupStack::PopAndDestroy(stringHolder);
       
  2143 		RDEBUG("0x99", 0x99);
       
  2144 		return stringHolder;
       
  2145     }
  2062 
  2146 
  2063 // End of file
  2147 // End of file