securitydialogs/SecUi/Src/SecUiManualSecuritySettings.cpp
changeset 0 164170e6151a
child 21 33ad376816a8
child 22 6b63ca65093a
equal deleted inserted replaced
-1:000000000000 0:164170e6151a
       
     1 /*
       
     2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Provides api for changing security settings via PhoneApp
       
    15 *     
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #include <rmmcustomapi.h>
       
    21 #include <SecUi.rsg>
       
    22 #include "secuimanualsecuritysettings.h"
       
    23 #include <exterror.h>
       
    24 #include "SecUiWait.h"
       
    25 #include <mmtsy_names.h>
       
    26     /*****************************************************
       
    27     *    Series 60 Customer / TSY
       
    28     *    Needs customer TSY implementation
       
    29     *****************************************************/
       
    30 //  LOCAL CONSTANTS AND MACROS  
       
    31 
       
    32 
       
    33 
       
    34 _LIT(Operator,"1");
       
    35 _LIT(Gid1,"2");
       
    36 _LIT(Gid2,"3");
       
    37 _LIT(Imsi,"4");
       
    38 _LIT(Operator_Gid1,"5");
       
    39 _LIT(Operator_Gid2,"6");
       
    40 _LIT(GlobalUnlock, "7");
       
    41 
       
    42 const TInt KTriesToConnectServer( 2 );
       
    43 const TInt KTimeBeforeRetryingServerConnection( 50000 );
       
    44 const TInt PhoneIndex( 0 );
       
    45 
       
    46 // ================= MEMBER FUNCTIONS =======================
       
    47 //
       
    48 // ----------------------------------------------------------
       
    49 // CManualSecuritySettings::NewL()
       
    50 // Constructs a new entry with given values.
       
    51 // ----------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CManualSecuritySettings* CManualSecuritySettings::NewL()
       
    54     {
       
    55     CManualSecuritySettings* self = new (ELeave) CManualSecuritySettings();
       
    56     CleanupStack::PushL(self);
       
    57     self->ConstructL();
       
    58     CleanupStack::Pop();
       
    59     return self;
       
    60     }
       
    61 //
       
    62 // ----------------------------------------------------------
       
    63 // CManualSecuritySettings::CManualSecuritySettings()
       
    64 // constructor
       
    65 // ----------------------------------------------------------
       
    66 //
       
    67 CManualSecuritySettings::CManualSecuritySettings()
       
    68     {
       
    69     }
       
    70 
       
    71 //
       
    72 // ----------------------------------------------------------
       
    73 // CManualSecuritySettings::ConstructL()
       
    74 // Symbian OS constructor.
       
    75 // ----------------------------------------------------------
       
    76 //
       
    77 void CManualSecuritySettings::ConstructL()
       
    78     {
       
    79     
       
    80     iWait = CWait::NewL();
       
    81     
       
    82     /*****************************************************
       
    83     *    Series 60 Customer / ETel
       
    84     *    Series 60  ETel API
       
    85     *****************************************************/
       
    86     /*****************************************************
       
    87     *    Series 60 Customer / TSY
       
    88     *    Needs customer TSY implementation
       
    89     *****************************************************/
       
    90     TInt err( KErrGeneral );
       
    91     TInt thisTry( 0 );
       
    92     RTelServer::TPhoneInfo PhoneInfo;
       
    93     /* All server connections are tried to be made KTriesToConnectServer times because occasional
       
    94     fails on connections are possible, at least on some servers */
       
    95 
       
    96     // connect ETel server
       
    97     while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer )
       
    98         {
       
    99         User::After( KTimeBeforeRetryingServerConnection );
       
   100         }
       
   101     User::LeaveIfError( err );
       
   102 
       
   103     // load TSY
       
   104     err = iServer.LoadPhoneModule( KMmTsyModuleName );
       
   105     if ( err != KErrAlreadyExists )
       
   106         {
       
   107         // May also return KErrAlreadyExists if something else
       
   108         // has already loaded the TSY module. And that is
       
   109         // not an error.
       
   110         User::LeaveIfError( err );
       
   111         }
       
   112 
       
   113     // open phones
       
   114     User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended));
       
   115     User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo));
       
   116     User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName));
       
   117     User::LeaveIfError(iCustomPhone.Open(iPhone));
       
   118     }
       
   119 //
       
   120 // ----------------------------------------------------------
       
   121 // CManualSecuritySettings::~CManualSecuritySettings()
       
   122 // Destructor
       
   123 // ----------------------------------------------------------
       
   124 //
       
   125 EXPORT_C CManualSecuritySettings::~CManualSecuritySettings()
       
   126     {    
       
   127     /*****************************************************
       
   128     *    Series 60 Customer / ETel
       
   129     *    Series 60  ETel API
       
   130     *****************************************************/
       
   131     /*****************************************************
       
   132     *    Series 60 Customer / TSY
       
   133     *    Needs customer TSY implementation
       
   134     *****************************************************/
       
   135 	#if defined(_DEBUG)
       
   136 	RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings()"));
       
   137 	#endif
       
   138     // Cancel active requests
       
   139     if(iWait->IsActive())
       
   140     {
       
   141         #if defined(_DEBUG)
       
   142 	    RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings() CANCEL REQ"));
       
   143 	    #endif
       
   144         iPhone.CancelAsyncRequest(iWait->GetRequestType());
       
   145     }
       
   146     // close phone
       
   147     if (iPhone.SubSessionHandle())
       
   148         iPhone.Close();
       
   149     // close custom phone
       
   150     if (iCustomPhone.SubSessionHandle())
       
   151         iCustomPhone.Close();
       
   152     //close ETel connection
       
   153     if (iServer.Handle())
       
   154         {
       
   155         iServer.UnloadPhoneModule(KMmTsyModuleName);
       
   156         iServer.Close();
       
   157         }
       
   158     delete iNote;
       
   159     delete iWait;
       
   160 	#if defined(_DEBUG)
       
   161 	RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CManualSecuritySettings() END"));
       
   162 	#endif  
       
   163     }
       
   164 
       
   165 //
       
   166 // ----------------------------------------------------------
       
   167 // CManualSecuritySettings::ChangePinL()
       
   168 // Changes pin
       
   169 // ----------------------------------------------------------
       
   170 //
       
   171 EXPORT_C TBool CManualSecuritySettings::ChangePinL(TPin aPin,const TDesC& aOld,const TDesC& aNew,const TDesC& aVerifyNew )
       
   172     {    
       
   173     /*****************************************************
       
   174     *    Series 60 Customer / ETel
       
   175     *    Series 60  ETel API
       
   176     *****************************************************/
       
   177     #if defined(_DEBUG)
       
   178     RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL()"));
       
   179     #endif        
       
   180     if (aPin == EPin1)
       
   181         {
       
   182 		#if defined(_DEBUG)
       
   183 		RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() PIN1"));
       
   184 		#endif        
       
   185         RMobilePhone::TMobilePhoneLock lockType;
       
   186         RMobilePhone::TMobilePhoneLockInfoV1 lockInfo;
       
   187         RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo);
       
   188 
       
   189 
       
   190         lockType = RMobilePhone::ELockICC;
       
   191         // check if pin code is enabled...
       
   192         // The following is required, since the new multimode Etel is asynchronous
       
   193         // rather than synchronous.
       
   194     
       
   195 		#if defined(_DEBUG)
       
   196 		RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() GetLockInfo"));
       
   197 		#endif
       
   198 
       
   199         iWait->SetRequestType(EMobilePhoneGetLockInfo);
       
   200         iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg);
       
   201         TInt res = iWait->WaitForRequestL();
       
   202          
       
   203         if (res != KErrNone)
       
   204             return EFalse;
       
   205         // if pin is disabled -> pin code change is not allowed
       
   206         if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled)
       
   207             {    
       
   208             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN_NOT_ALLOWED);
       
   209             return EFalse;
       
   210             }
       
   211         }
       
   212     
       
   213 	#if defined(_DEBUG)
       
   214 	RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() CompareF"));
       
   215 	#endif
       
   216     if (aNew.CompareF(aVerifyNew) != 0)     
       
   217         {
       
   218         // codes do not match note 
       
   219         ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODES_DONT_MATCH);
       
   220         return EFalse;
       
   221         }
       
   222     
       
   223 
       
   224     RMobilePhone::TMobilePhoneSecurityCode secCodeType;
       
   225     if (aPin == EPin1)
       
   226         {
       
   227         secCodeType = RMobilePhone::ESecurityCodePin1;
       
   228         }
       
   229     else
       
   230         {
       
   231         secCodeType = RMobilePhone::ESecurityCodePin2;
       
   232         }
       
   233 
       
   234     RMobilePhone::TMobilePhonePasswordChangeV1 aChange;
       
   235     aChange.iOldPassword = aOld;
       
   236     aChange.iNewPassword = aNew;
       
   237 
       
   238 	#if defined(_DEBUG)
       
   239 	RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() ChangeSecurityCode"));
       
   240 	#endif
       
   241     iWait->SetRequestType(EMobilePhoneChangeSecurityCode);
       
   242     iPhone.ChangeSecurityCode(iWait->iStatus,secCodeType,aChange);
       
   243     TInt res = iWait->WaitForRequestL();
       
   244     
       
   245 	#if defined(_DEBUG)
       
   246 	RDebug::Print(_L("(SECUI)CManualSecuritySettings::ChangePinL() ChangeSecurityCode RES: %d"), res);
       
   247 	#endif
       
   248 
       
   249     switch(res)
       
   250         {        
       
   251         case KErrNone:
       
   252             if (aPin == EPin1)
       
   253                 {
       
   254                 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_PIN_CODE_CHANGED_NOTE);
       
   255                 }
       
   256             else
       
   257                 {
       
   258                 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_PIN2_CODE_CHANGED_NOTE);
       
   259                 }
       
   260             return ETrue;
       
   261         case KErrGsmSSPasswordAttemptsViolation:
       
   262         case KErrLocked:
       
   263             if (aPin == EPin1)
       
   264                 {
       
   265                 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN_BLOCKED_NOTE);
       
   266                 }
       
   267             else
       
   268                 {
       
   269                 iCustomPhone.CheckSecurityCode(iWait->iStatus,RMmCustomAPI::ESecurityCodePuk2);
       
   270                 TInt res = iWait->WaitForRequestL();
       
   271                 }
       
   272             break;
       
   273         case KErrGsm0707OperationNotAllowed:
       
   274             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_OPERATION_NOT_ALLOWED);
       
   275             break;
       
   276         default:
       
   277             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODE_ERROR);
       
   278             break;
       
   279         }
       
   280     
       
   281     return EFalse;
       
   282     }
       
   283 //
       
   284 // ----------------------------------------------------------
       
   285 // CManualSecuritySettings::CancelChangePin()
       
   286 // Deletes pin operation note if necessary
       
   287 // ----------------------------------------------------------
       
   288 //
       
   289 EXPORT_C void CManualSecuritySettings::CancelChangePin()
       
   290     {
       
   291     #if defined(_DEBUG)
       
   292     RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelChangePin()"));
       
   293     #endif    
       
   294     delete iNote;
       
   295     iNote = NULL;
       
   296     }
       
   297 //
       
   298 // ----------------------------------------------------------
       
   299 // CManualSecuritySettings::UnblockPinL()
       
   300 // Unblocks pin 
       
   301 // ----------------------------------------------------------
       
   302 //    
       
   303 EXPORT_C TBool CManualSecuritySettings::UnblockPinL(TPin aPin,const TDesC& aPuk,const TDesC& aNew,const TDesC& aVerifyNew )
       
   304     {
       
   305     /*****************************************************
       
   306     *    Series 60 Customer / ETel
       
   307     *    Series 60  ETel API
       
   308     *****************************************************/
       
   309     #if defined(_DEBUG)
       
   310     RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnblockPinL()"));
       
   311     #endif        
       
   312     if (aNew.CompareF(aVerifyNew) != 0)     
       
   313         {
       
   314         // codes do not match note 
       
   315         ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODES_DONT_MATCH);
       
   316         return EFalse;
       
   317         }
       
   318     
       
   319     RMobilePhone::TMobilePhoneSecurityCode blockCodeType;
       
   320     
       
   321     if (aPin == EPin1)
       
   322         {
       
   323         blockCodeType = RMobilePhone::ESecurityCodePuk1;
       
   324         }
       
   325     else
       
   326         {
       
   327         blockCodeType = RMobilePhone::ESecurityCodePuk2;
       
   328         }
       
   329 
       
   330     iWait->SetRequestType(EMobilePhoneVerifySecurityCode);
       
   331     iPhone.VerifySecurityCode(iWait->iStatus, blockCodeType, aNew, aPuk);
       
   332     TInt res = iWait->WaitForRequestL();
       
   333 
       
   334     switch(res)
       
   335         {        
       
   336         case KErrNone:
       
   337             if (aPin == EPin1)
       
   338                 {
       
   339                 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_PIN_CODE_CHANGED_NOTE);
       
   340                 }
       
   341             else
       
   342                 {
       
   343                 ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_PIN2_CODE_CHANGED_NOTE);
       
   344                 }
       
   345             return ETrue;
       
   346         case KErrGsmSSPasswordAttemptsViolation:
       
   347         case KErrLocked:
       
   348             if (aPin == EPin2)
       
   349                 {
       
   350                 ShowResultNoteL(CAknNoteDialog::EErrorTone,R_PIN2_REJECTED);
       
   351                 }
       
   352             break;
       
   353         case KErrGsm0707OperationNotAllowed:
       
   354             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_OPERATION_NOT_ALLOWED);
       
   355             break;
       
   356         default:
       
   357             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODE_ERROR);
       
   358             break;
       
   359         }
       
   360 
       
   361     return EFalse;
       
   362     }
       
   363 //
       
   364 // ----------------------------------------------------------
       
   365 // CManualSecuritySettings::CancelUnblockPin()
       
   366 // Deletes unblock pin operation note if necessary
       
   367 // ----------------------------------------------------------
       
   368 //    
       
   369 EXPORT_C void CManualSecuritySettings::CancelUnblockPin()
       
   370     {
       
   371     #if defined(_DEBUG)
       
   372     RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnblockPinL()"));
       
   373     #endif        
       
   374     delete iNote;
       
   375     iNote = NULL;        
       
   376     }
       
   377 //
       
   378 // ----------------------------------------------------------
       
   379 // CManualSecuritySettings::LockSimL()
       
   380 // 
       
   381 // ----------------------------------------------------------
       
   382 //        
       
   383 EXPORT_C TBool CManualSecuritySettings::LockSimL(const TDesC& aLockCode,const TDesC& aType )
       
   384     {
       
   385     /*****************************************************
       
   386     *    Series 60 Customer / ETel
       
   387     *    Series 60  ETel API
       
   388     *****************************************************/
       
   389     #if defined(_DEBUG)
       
   390     RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL()"));
       
   391     #endif
       
   392 
       
   393     
       
   394     RMmCustomAPI::TLockNumber aLockType;
       
   395     TInt ret = KErrGsm0707IncorrectPassword;
       
   396     TInt length = aLockCode.Length();
       
   397 
       
   398     #if defined(_DEBUG)
       
   399     RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL(): Param length: %d"), length);
       
   400     #endif
       
   401 
       
   402     if(aLockCode.Length() <= KSimLockMaxPasswordSize)
       
   403     {
       
   404     if (aType.CompareF(Operator) == 0)
       
   405         {
       
   406         aLockType = RMmCustomAPI::EOperator;
       
   407         ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType );
       
   408         }
       
   409 
       
   410     if (aType.CompareF(Gid1) == 0)
       
   411         {
       
   412         aLockType = RMmCustomAPI::EGid1;
       
   413         ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType );
       
   414         }
       
   415 
       
   416     if (aType.CompareF(Gid2) == 0)
       
   417         {
       
   418         aLockType = RMmCustomAPI::EGid2;
       
   419         ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType );
       
   420         }
       
   421 
       
   422     if (aType.CompareF(Imsi) == 0)
       
   423         {
       
   424         aLockType = RMmCustomAPI::EImsi;
       
   425         ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType );
       
   426         }
       
   427 
       
   428     if (aType.CompareF(Operator_Gid1) == 0)
       
   429         {    
       
   430         aLockType = RMmCustomAPI::EOperator_Gid1;
       
   431         ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType );
       
   432         }
       
   433 
       
   434     if (aType.CompareF(Operator_Gid2) == 0)
       
   435         {
       
   436         aLockType = RMmCustomAPI::EOperator_Gid2;
       
   437         ret = iCustomPhone.ActivateSimLock( aLockCode,aLockType );
       
   438         }
       
   439     }
       
   440 
       
   441     #if defined(_DEBUG)
       
   442     RDebug::Print(_L("(SECUI)CManualSecuritySettings::LockSimL() RESULT: %d"), ret);
       
   443     #endif
       
   444     switch (ret)
       
   445         {
       
   446         case KErrNone:
       
   447             ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_ON);
       
   448             return ETrue;
       
   449         case KErrAlreadyExists:
       
   450             ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_ALLREADY_ON);
       
   451             break;
       
   452         case KErrGeneral:
       
   453         case KErrLocked:
       
   454         case KErrAccessDenied:
       
   455         case KErrNotSupported:
       
   456         case KErrGsm0707OperationNotAllowed:
       
   457             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_SIM_NOT_ALLOWED);
       
   458             break;
       
   459         case KErrArgument:
       
   460         case KErrGsm0707IncorrectPassword:
       
   461             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODE_ERROR);
       
   462             break;
       
   463         default:
       
   464             break;
       
   465         }
       
   466 
       
   467     return EFalse;
       
   468     }
       
   469 
       
   470 //
       
   471 // ----------------------------------------------------------
       
   472 // CManualSecuritySettings::CancelLockSim()
       
   473 // 
       
   474 // ----------------------------------------------------------
       
   475 //        
       
   476 EXPORT_C void CManualSecuritySettings::CancelLockSim()
       
   477     {
       
   478     #if defined(_DEBUG)
       
   479     RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelLockSimL()"));
       
   480     #endif
       
   481     delete iNote;
       
   482     iNote = NULL;    
       
   483     }    
       
   484 //
       
   485 // ----------------------------------------------------------
       
   486 // CManualSecuritySettings::UnlockSimL()
       
   487 // 
       
   488 // ----------------------------------------------------------
       
   489 //            
       
   490 EXPORT_C TBool CManualSecuritySettings::UnlockSimL(const TDesC& aUnlockCode,const TDesC& aType )
       
   491     {
       
   492     /*****************************************************
       
   493     *    Series 60 Customer / ETel
       
   494     *    Series 60  ETel API
       
   495     *****************************************************/
       
   496     #if defined(_DEBUG)
       
   497     RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL()"));
       
   498     #endif
       
   499     RMmCustomAPI::TLockNumber aLockType;
       
   500     TInt ret = KErrGsm0707IncorrectPassword;
       
   501     TInt length = aUnlockCode.Length();
       
   502 
       
   503     #if defined(_DEBUG)
       
   504     RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL(): Param length: %d"), length);
       
   505     #endif
       
   506     if(aUnlockCode.Length() <= KSimLockMaxPasswordSize)
       
   507     {
       
   508     if (aType.CompareF(Operator) == 0)
       
   509         {
       
   510         aLockType = RMmCustomAPI::EOperator;
       
   511         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   512         }
       
   513 
       
   514     if (aType.CompareF(Gid1) == 0)
       
   515         {
       
   516         aLockType = RMmCustomAPI::EGid1;
       
   517         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   518         }
       
   519 
       
   520     if (aType.CompareF(Gid2) == 0)
       
   521         {
       
   522         aLockType = RMmCustomAPI::EGid2;
       
   523         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   524         }
       
   525 
       
   526     if (aType.CompareF(Imsi) == 0)
       
   527         {
       
   528         aLockType = RMmCustomAPI::EImsi;
       
   529         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   530         }
       
   531 
       
   532     if (aType.CompareF(Operator_Gid1) == 0)
       
   533         {    
       
   534         aLockType = RMmCustomAPI::EOperator_Gid1;
       
   535         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   536         }
       
   537 
       
   538     if (aType.CompareF(Operator_Gid2) == 0)
       
   539         {
       
   540         aLockType = RMmCustomAPI::EOperator_Gid2;
       
   541         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   542         }
       
   543     if (aType.CompareF(GlobalUnlock) == 0)
       
   544         {
       
   545         aLockType = RMmCustomAPI::EGlobalUnlock;
       
   546         ret = iCustomPhone.DeActivateSimLock( aUnlockCode,aLockType );
       
   547         }    
       
   548         
       
   549     }
       
   550     #if defined(_DEBUG)
       
   551     RDebug::Print(_L("(SECUI)CManualSecuritySettings::UnLockSimL() RESULT: %d"), ret);
       
   552     #endif
       
   553     switch (ret)
       
   554         {
       
   555         case KErrNone:
       
   556             ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_OFF);
       
   557             return ETrue;
       
   558         case KErrAlreadyExists:
       
   559             ShowResultNoteL(CAknNoteDialog::EConfirmationTone,R_SIM_ALLREADY_OFF);
       
   560             break;
       
   561         case KErrGeneral:
       
   562         case KErrLocked:
       
   563         case KErrAccessDenied:
       
   564         case KErrGsm0707OperationNotAllowed:
       
   565             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_SIM_NOT_ALLOWED);
       
   566             break;
       
   567         case KErrArgument:
       
   568         case KErrGsm0707IncorrectPassword:
       
   569             ShowResultNoteL(CAknNoteDialog::EErrorTone,R_CODE_ERROR);
       
   570             break;
       
   571         default:
       
   572             break;
       
   573         }
       
   574 
       
   575     return EFalse;
       
   576     }
       
   577 //
       
   578 // ----------------------------------------------------------
       
   579 // CManualSecuritySettings::CancelUnlockSim()
       
   580 // 
       
   581 // ----------------------------------------------------------
       
   582 //                
       
   583 EXPORT_C void CManualSecuritySettings::CancelUnlockSim()
       
   584     {
       
   585     #if defined(_DEBUG)
       
   586     RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnLockSimL()"));
       
   587     #endif
       
   588     delete iNote;
       
   589     iNote = NULL;
       
   590     }
       
   591 
       
   592 //
       
   593 // ----------------------------------------------------------
       
   594 // CManualSecuritySettings::ShowResultNoteL()
       
   595 // Shows settingchange results
       
   596 // ----------------------------------------------------------
       
   597 //
       
   598 void CManualSecuritySettings::ShowResultNoteL(CAknNoteDialog::TTone aTone, TInt aResourceID)
       
   599     {
       
   600     #if defined(_DEBUG)
       
   601     RDebug::Print(_L("(SECUI)CManualSecuritySettings::CancelUnLockSimL()"));
       
   602     #endif
       
   603     iNote = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNote));
       
   604     iNote->SetTimeout(CAknNoteDialog::ELongTimeout);
       
   605     iNote->SetTone(aTone);
       
   606     iNote->ExecuteLD(aResourceID);
       
   607     }
       
   608 
       
   609 // End of file