securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPluginContainer.cpp
branchRCL_3
changeset 21 09b1ac925e3f
parent 20 63339781d179
child 22 03674e5abf46
equal deleted inserted replaced
20:63339781d179 21:09b1ac925e3f
     1 /*
       
     2 * Copyright (c) 2005 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:  Container for the Device & SIM security sub-folder
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "GSSimSecPluginContainer.h"
       
    20 #include "GSSimSecPluginModel.h"
       
    21 #include "GSSimSecPlugin.hrh"
       
    22 
       
    23 #include <aknlists.h>
       
    24 #include <etelmm.h>
       
    25 #include <RSSSettings.h>
       
    26 #include <StringLoader.h>
       
    27 #include <featmgr.h>
       
    28 #include <csxhelp/cp.hlp.hrh>
       
    29 #include <gsfwviewuids.h>
       
    30 #include <GSSimSecPluginRsc.rsg>
       
    31 #include <gslistbox.h>
       
    32 #include <AknsConstants.h>
       
    33 #include <secuisecuritysettings.h>
       
    34 
       
    35 
       
    36 #ifdef RD_REMOTELOCK
       
    37 #include <RemoteLockSettings.h>
       
    38 _LIT( KRemoteLockEmptyItem, " " );
       
    39 #endif
       
    40 
       
    41 #include    <SCPClient.h>                                                  
       
    42 // EXTERNAL DATA STRUCTURES
       
    43 
       
    44 // EXTERNAL FUNCTION PROTOTYPES  
       
    45 
       
    46 // CONSTANTS
       
    47 
       
    48 // MACROS
       
    49 
       
    50 // LOCAL CONSTANTS AND MACROS
       
    51 _LIT( CodeItem,"****" );
       
    52 _LIT( SecurityCodeItem, "*****" );
       
    53 
       
    54 const TInt KMaxStringLength = 50;
       
    55 
       
    56 // MODULE DATA STRUCTURES
       
    57 
       
    58 // LOCAL FUNCTION PROTOTYPES
       
    59 
       
    60 // FORWARD DECLARATIONS
       
    61 
       
    62 // ============================= LOCAL FUNCTIONS ==============================
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // CGSSimSecPluginContainer::ConstructL()
       
    67 // 
       
    68 // Symbian OS two phased constructor
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 void CGSSimSecPluginContainer::ConstructL( const TRect& aRect )
       
    72     { 
       
    73     iListBox = new( ELeave ) CAknSettingStyleListBox;
       
    74     BaseConstructL( aRect, R_GS_SIM_SECURITY_VIEW_TITLE, R_SIM_SECURITY_LBX );
       
    75     FeatureManager::InitializeLibL();
       
    76     }
       
    77 
       
    78 
       
    79 // ---------------------------------------------------------------------------
       
    80 // CGSSimSecPluginContainer::~CGSSettListSecurityContainer()
       
    81 // 
       
    82 // Destructor 
       
    83 // ---------------------------------------------------------------------------
       
    84 //
       
    85 
       
    86 CGSSimSecPluginContainer::~CGSSimSecPluginContainer()
       
    87     {
       
    88     if(iCodeItems)
       
    89         delete iCodeItems;
       
    90     if(iUpinItems)
       
    91         delete iUpinItems;
       
    92     if(iAutoLockItems)
       
    93         delete iAutoLockItems;
       
    94     if(iPinItems)
       
    95         delete iPinItems;
       
    96     if(iSecurityItems)
       
    97         delete iSecurityItems;
       
    98     if(iSatItems)
       
    99         delete iSatItems;
       
   100     if(iSecurity)
       
   101         delete iSecurity;
       
   102     if(iListboxItemArray)
       
   103         delete iListboxItemArray;
       
   104 #ifdef RD_REMOTELOCK
       
   105     if(iRemoteLockItems)
       
   106         delete iRemoteLockItems;
       
   107 #endif // RD_REMOTELOCK    
       
   108 FeatureManager::UnInitializeLib();
       
   109     }
       
   110 
       
   111 
       
   112 // ---------------------------------------------------------------------------
       
   113 // CGSSimSecPluginContainer::CGSSimSecPluginContainer()
       
   114 // 
       
   115 // Constructor
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CGSSimSecPluginContainer::CGSSimSecPluginContainer(
       
   119                           CGSSimSecPluginModel* aModel )
       
   120     : iModel ( aModel )
       
   121     {
       
   122     }
       
   123 
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // CGSSimSecPluginContainer::ConstructListBoxL()
       
   127 // 
       
   128 //  
       
   129 // ---------------------------------------------------------------------------
       
   130 //
       
   131 void CGSSimSecPluginContainer::ConstructListBoxL( TInt aResLbxId )
       
   132     {
       
   133     iSecurity= CSecuritySettings::NewL();
       
   134     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   135     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   136     if(wcdmaSupported || upinSupported)
       
   137         {
       
   138         //check if UPIN code is supported and not rejected
       
   139         TBool resp = iSecurity->IsUpinSupportedL();
       
   140         if( resp )
       
   141             {
       
   142             iUpinCodeSupported = ETrue;
       
   143     
       
   144             //check if UPIN code is active
       
   145             if( iSecurity->IsUpinActive() )
       
   146                 {
       
   147                 iUpinCodeActive = ETrue;
       
   148                 }
       
   149             else
       
   150                 {
       
   151                 iUpinCodeActive = EFalse;
       
   152                 }
       
   153             
       
   154             //Check whether UPIN is blocked
       
   155             resp = iSecurity->IsUpinBlocked();
       
   156     
       
   157             if( !resp )
       
   158                 {
       
   159                 iUpinCodeRejected = EFalse;
       
   160                 }
       
   161             else
       
   162                 {
       
   163                 iUpinCodeRejected = ETrue;    
       
   164                 }
       
   165             }
       
   166         else
       
   167             {
       
   168             iUpinCodeSupported = EFalse;
       
   169             iUpinCodeActive = EFalse;
       
   170             }
       
   171         }
       
   172     
       
   173 
       
   174     iListBox->ConstructL( this, EAknListBoxSelectionList );
       
   175     iListboxItemArray = CGSListBoxItemTextArray::NewL( aResLbxId, 
       
   176                         *iListBox, *iCoeEnv );
       
   177     iListBox->Model()->SetItemTextArray( iListboxItemArray );
       
   178     iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
       
   179 
       
   180     iAutoLockItems = iCoeEnv->ReadDesC16ArrayResourceL( R_AUTOLOCK_ARRAY );
       
   181 
       
   182 #ifdef RD_REMOTELOCK
       
   183     #ifdef _DEBUG
       
   184     RDebug::Print( _L( "(GS)CGSSettListSimSecurityContainer::ConstructListBoxL() - Reading R_REMOTELOCK_ARRAY resource" ) );
       
   185     #endif // DEBUG
       
   186 
       
   187     iRemoteLockItems = iCoeEnv->ReadDesC16ArrayResourceL( R_REMOTELOCK_ARRAY );
       
   188 #endif // RD_REMOTELOCK
       
   189 
       
   190 
       
   191     if(wcdmaSupported || upinSupported)
       
   192       {
       
   193         iUpinItems = iCoeEnv->ReadDesC16ArrayResourceL( R_UPIN_ARRAY );
       
   194         iCodeItems = iCoeEnv->ReadDesC16ArrayResourceL( R_CODE_ARRAY );
       
   195       }
       
   196     else
       
   197         {
       
   198         iUpinItems = NULL;
       
   199         iCodeItems = NULL;
       
   200         }
       
   201 
       
   202     iPinItems = iCoeEnv->ReadDesC16ArrayResourceL( R_PIN_ARRAY );
       
   203     iSecurityItems = iCoeEnv->ReadDesC16ArrayResourceL( R_SECURITY_ARRAY );
       
   204     iSatItems = iCoeEnv->ReadDesC16ArrayResourceL( R_SAT_ARRAY );
       
   205 
       
   206     CreateListBoxItemsL();
       
   207     }
       
   208 
       
   209 
       
   210 // ---------------------------------------------------------------------------
       
   211 // CGSSettListIdleContainer::CreateListBoxItemsL()
       
   212 // 
       
   213 //  
       
   214 // ---------------------------------------------------------------------------
       
   215 //
       
   216 void CGSSimSecPluginContainer::CreateListBoxItemsL()
       
   217     {
       
   218     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   219     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   220 
       
   221     if(wcdmaSupported || upinSupported)
       
   222       {
       
   223         if( iUpinCodeSupported && !iUpinCodeRejected )
       
   224             {
       
   225             MakeCodeInUseItemL();
       
   226             }
       
   227     
       
   228         if( iUpinCodeActive )
       
   229             {
       
   230             MakeUpinRequestItemL();
       
   231             MakeCodeItemL( EGSSettIdUpinCode );
       
   232             }
       
   233         else
       
   234             {
       
   235             MakePinRequestItemL();
       
   236             MakeCodeItemL( EGSSettIdPinCode );
       
   237             }
       
   238        }
       
   239     else //not wcdma or upin
       
   240         {   
       
   241             MakePinRequestItemL();
       
   242             MakeCodeItemL( EGSSettIdPinCode );
       
   243         }
       
   244 
       
   245     MakeCodeItemL( EGSSettIdPin2Code );
       
   246     MakeAutolockItemL();
       
   247     
       
   248 #ifdef RD_REMOTELOCK
       
   249     MakeRemoteLockItemL();
       
   250 #endif // RD_REMOTELOCK
       
   251     
       
   252     MakeCodeItemL( EGSSettIdSecurityCode );
       
   253     MakeSimChangeItemL();
       
   254 		if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport ))
       
   255     	{ 
       
   256     		#ifdef _DEBUG
       
   257     		RDebug::Print( _L( "(GS)CGSSettListSimSecurityContainer::CreateListBoxItemsL() CUG supported!" ) );
       
   258     		#endif // DEBUG
       
   259     		MakeClosedUserGroupItemL();
       
   260     	}
       
   261     else
       
   262     {
       
   263     #ifdef _DEBUG
       
   264     RDebug::Print( _L( "(GS)CGSSettListSimSecurityContainer::CreateListBoxItemsL() CUG Not supported!" ) );
       
   265     #endif // DEBUG
       
   266     }
       
   267     
       
   268     TInt support = iModel->ConfirmSatOperationsSupport();
       
   269     
       
   270     if ( support == 1 ) // Confirmation allowed.
       
   271         {
       
   272         MakeSatOperationsItemL();
       
   273         }
       
   274     }
       
   275 
       
   276 // ---------------------------------------------------------------------------
       
   277 // CGSSettListIdleContainer::UpdateListBoxL( TInt aFeatureId )
       
   278 // 
       
   279 //  
       
   280 // ---------------------------------------------------------------------------
       
   281 //
       
   282 void CGSSimSecPluginContainer::UpdateListBoxL( TInt aFeatureId )
       
   283     {
       
   284     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   285     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   286     switch( aFeatureId )
       
   287         {
       
   288         case EGSSettIdCodeInUse:
       
   289             if(wcdmaSupported || upinSupported)
       
   290               {
       
   291                   RecreatePinItemsL();
       
   292               }
       
   293             break;
       
   294         case EGSSettIdUpinRequest:
       
   295             if(wcdmaSupported || upinSupported)
       
   296               {
       
   297                   MakeUpinRequestItemL();
       
   298               }
       
   299             break;
       
   300         case EGSSettIdUpinCode:
       
   301             if(wcdmaSupported || upinSupported)
       
   302               {
       
   303                   MakeCodeItemL( EGSSettIdUpinCode );
       
   304               }
       
   305             break;
       
   306         case EGSSettIdPinRequest:
       
   307             MakePinRequestItemL();
       
   308             break;
       
   309         case EGSSettIdPinCode:
       
   310             MakeCodeItemL( EGSSettIdPinCode );
       
   311             break;
       
   312         case EGSSettIdPin2Code:
       
   313             MakeCodeItemL( EGSSettIdPin2Code );
       
   314             break;
       
   315         case EGSSettIdAutolock:
       
   316             MakeAutolockItemL();
       
   317             break;
       
   318         case EGSSettIdSecurityCode:
       
   319             MakeCodeItemL( EGSSettIdSecurityCode );
       
   320             break;
       
   321         case EGSSettIdSimChange:
       
   322             MakeSimChangeItemL();
       
   323             break;
       
   324             
       
   325     #ifdef RD_REMOTELOCK
       
   326         case EGSSettIdRemoteLock:
       
   327             MakeRemoteLockItemL();
       
   328             break;
       
   329     #endif // RD_REMOTELOCK    
       
   330         case EGSSettIdClosedUserGroup:
       
   331         		if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport ))
       
   332     				{ 
       
   333             	MakeClosedUserGroupItemL();
       
   334             }
       
   335             break;
       
   336         case EGSSettIdSatOperations:
       
   337             MakeSatOperationsItemL();
       
   338             break;
       
   339         default:
       
   340             return;
       
   341         }
       
   342     
       
   343     iListBox->HandleItemAdditionL();
       
   344     }
       
   345 
       
   346 // ---------------------------------------------------------------------------
       
   347 // CGSSimSecPluginContainer::MakeCodeItemL()
       
   348 // 
       
   349 //  
       
   350 // ---------------------------------------------------------------------------
       
   351 //
       
   352 void CGSSimSecPluginContainer::MakeCodeItemL( const TInt aItemType )
       
   353     {
       
   354     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   355     TPtr ptrBuffer ( dynamicText->Des() );
       
   356     
       
   357     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   358     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   359 
       
   360     if(wcdmaSupported || upinSupported)
       
   361       {
       
   362         iUpinCodeSupported = iSecurity->IsUpinSupportedL();
       
   363         iUpinCodeActive = iSecurity->IsUpinActive(); 
       
   364         iUpinCodeRejected = iSecurity->IsUpinBlocked();
       
   365       }
       
   366     else
       
   367       {
       
   368         iUpinCodeSupported = EFalse;
       
   369         iUpinCodeActive = EFalse; 
       
   370         iUpinCodeRejected = EFalse;
       
   371       }
       
   372 
       
   373     switch ( aItemType )
       
   374         {
       
   375         case EGSSettIdUpinCode:
       
   376             if( iUpinCodeSupported && !iUpinCodeRejected && iUpinCodeActive )
       
   377                 {
       
   378                 ptrBuffer =  CodeItem;
       
   379                 iListboxItemArray->SetDynamicTextL( EGSSettIdUpinCode, ptrBuffer );
       
   380                 iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinCode,
       
   381                                    CGSListBoxItemTextArray::EVisible );
       
   382                 }
       
   383             else
       
   384                 {
       
   385                 iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinCode,
       
   386                                    CGSListBoxItemTextArray::EInvisible );
       
   387                 }
       
   388             break;
       
   389         case EGSSettIdPin2Code:
       
   390             ptrBuffer =  CodeItem;
       
   391             iListboxItemArray->SetDynamicTextL( EGSSettIdPin2Code, ptrBuffer );
       
   392             iListboxItemArray->SetItemVisibilityL( EGSSettIdPin2Code, 
       
   393                                CGSListBoxItemTextArray::EVisible );
       
   394             break;
       
   395         case EGSSettIdSecurityCode:
       
   396             ptrBuffer =  SecurityCodeItem;
       
   397             iListboxItemArray->SetDynamicTextL( EGSSettIdSecurityCode, 
       
   398                                                 ptrBuffer );
       
   399         if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
       
   400         {
       
   401         
       
   402             {                                                      
       
   403             // Check the code change policy from the SCP server.
       
   404             TInt allowChange = 1;
       
   405             
       
   406             RSCPClient scpClient;
       
   407             TInt ret = scpClient.Connect();
       
   408             if ( ret == KErrNone )
       
   409                 {                                
       
   410                 TBuf<KSCPMaxIntLength> policyBuf;
       
   411                 policyBuf.Zero();
       
   412                 if ( scpClient.GetParamValue( ESCPCodeChangePolicy, policyBuf ) == KErrNone )
       
   413                     {
       
   414                     TLex lex( policyBuf );
       
   415                     lex.Val( allowChange );
       
   416                     #if defined(_DEBUG)
       
   417                         RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::\
       
   418                             MakeCodeInUseItemL(): Policy retrieved: %d"), allowChange );
       
   419                     #endif //DEBUG                    
       
   420                     }
       
   421                 else
       
   422                     {
       
   423                     #if defined(_DEBUG)
       
   424                        RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::\
       
   425                             MakeCodeInUseItemL(): ERROR: Failed to retrieve the policy value") );
       
   426                     #endif //DEBUG                                                      
       
   427                     }
       
   428                 scpClient.Close();
       
   429                 }
       
   430             else
       
   431                 {
       
   432                 #if defined(_DEBUG)
       
   433                     RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::MakeCodeInUseItemL(): \
       
   434                         ERROR: Failed to connect to SCP") );
       
   435                 #endif //DEBUG                                  
       
   436                 }
       
   437             
       
   438             if ( allowChange == 1 )
       
   439                 {            
       
   440                 #if defined(_DEBUG)
       
   441                     RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::MakeCodeInUseItemL(): \
       
   442                         Code change allowed"));
       
   443                 #endif //DEBUG                                        
       
   444         
       
   445                 iListboxItemArray->SetItemVisibilityL( EGSSettIdSecurityCode, 
       
   446 		        CGSListBoxItemTextArray::EVisible );		        				
       
   447                 }
       
   448             else
       
   449                 {
       
   450                 #if defined(_DEBUG)
       
   451                     RDebug::Print(_L("(GS)CGSSettListSimSecurityContainer::MakeCodeInUseItemL():\
       
   452                         Code change disallowed"));
       
   453                 #endif //DEBUG
       
   454                 
       
   455                 iListboxItemArray->SetItemVisibilityL( EGSSettIdSecurityCode, 
       
   456     		        CGSListBoxItemTextArray::EInvisible );
       
   457                 }
       
   458             }
       
   459             
       
   460       }  
       
   461       else
       
   462       {      
       
   463         
       
   464             iListboxItemArray->SetItemVisibilityL( EGSSettIdSecurityCode, 
       
   465                                CGSListBoxItemTextArray::EVisible );
       
   466 		                		        
       
   467 	}
       
   468             break;
       
   469         case EGSSettIdPinCode:
       
   470         default:
       
   471             if( !iUpinCodeSupported || iUpinCodeRejected || !iUpinCodeActive )
       
   472                 {
       
   473                 ptrBuffer =  CodeItem;
       
   474                 iListboxItemArray->SetDynamicTextL( EGSSettIdPinCode, 
       
   475                                                     ptrBuffer );
       
   476                 iListboxItemArray->SetItemVisibilityL( EGSSettIdPinCode, 
       
   477                                    CGSListBoxItemTextArray::EVisible );
       
   478                 }
       
   479             else
       
   480                 {
       
   481                 iListboxItemArray->SetItemVisibilityL( EGSSettIdPinCode, 
       
   482                                    CGSListBoxItemTextArray::EInvisible );
       
   483                 }
       
   484             break;
       
   485         }
       
   486     CleanupStack::PopAndDestroy( dynamicText );
       
   487     
       
   488     }
       
   489 
       
   490 
       
   491 // ---------------------------------------------------------------------------
       
   492 // CGSSimSecPluginContainer::MakeAutolockItemL()
       
   493 // 
       
   494 //  
       
   495 // ---------------------------------------------------------------------------
       
   496 //
       
   497 void CGSSimSecPluginContainer::MakeAutolockItemL()
       
   498     {
       
   499     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   500     TPtr ptrBuffer ( dynamicText->Des() );
       
   501 
       
   502     TInt period = iModel->AutoLockPeriod();
       
   503     
       
   504     switch ( period )
       
   505         {
       
   506         case 0:
       
   507             ptrBuffer = ( *iAutoLockItems )[ 0 ];
       
   508             break;
       
   509         case 1:
       
   510             {
       
   511             TBuf<KGSBufSize128> tempString;
       
   512             StringLoader::Format( tempString, 
       
   513                                 ( ( *iAutoLockItems )[1] ),
       
   514                                   -1, // no index in the key string
       
   515                                   period );
       
   516             ptrBuffer = tempString;
       
   517             }
       
   518             break;
       
   519         default:
       
   520             {
       
   521             TBuf<KGSBufSize128> tempString;
       
   522             StringLoader::Format( tempString, 
       
   523                                 ( ( *iAutoLockItems )[2] ),
       
   524                                   -1, // no index in the key string
       
   525                                   period );
       
   526             ptrBuffer = tempString;
       
   527             }
       
   528             break;
       
   529         }
       
   530     iListboxItemArray->SetDynamicTextL( EGSSettIdAutolock, ptrBuffer );
       
   531     CleanupStack::PopAndDestroy( dynamicText );
       
   532     iListboxItemArray->SetItemVisibilityL( EGSSettIdAutolock, 
       
   533                        CGSListBoxItemTextArray::EVisible );
       
   534     }
       
   535 
       
   536 // ---------------------------------------------------------------------------
       
   537 // CGSSimSecPluginContainer::MakeSimChangeItemL()
       
   538 // 
       
   539 //  
       
   540 // ---------------------------------------------------------------------------
       
   541 //
       
   542 void CGSSimSecPluginContainer::MakeSimChangeItemL()
       
   543     {
       
   544     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   545     TPtr ptrBuffer ( dynamicText->Des() );
       
   546    
       
   547     if ( iSecurity->IsLockEnabledL( RMobilePhone::ELockPhoneToICC ) )
       
   548         {
       
   549         ptrBuffer = ( *iSecurityItems )[0];
       
   550         }
       
   551     else
       
   552         {
       
   553         ptrBuffer = ( *iSecurityItems )[1];
       
   554         }
       
   555 
       
   556     iListboxItemArray->SetDynamicTextL( EGSSettIdSimChange, ptrBuffer );
       
   557     CleanupStack::PopAndDestroy( dynamicText );
       
   558     iListboxItemArray->SetItemVisibilityL( EGSSettIdSimChange, 
       
   559                        CGSListBoxItemTextArray::EVisible );
       
   560     }
       
   561 
       
   562 
       
   563 // ---------------------------------------------------------------------------
       
   564 // CGSSimSecPluginContainer:: MakePinRequestItemL()
       
   565 // 
       
   566 //  
       
   567 // ---------------------------------------------------------------------------
       
   568 //
       
   569 void CGSSimSecPluginContainer:: MakePinRequestItemL()
       
   570     {
       
   571     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   572     TPtr ptrBuffer ( dynamicText->Des() );
       
   573 
       
   574     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   575     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   576     if(wcdmaSupported || upinSupported)
       
   577       {
       
   578         iUpinCodeSupported = iSecurity->IsUpinSupportedL();
       
   579         iUpinCodeActive = iSecurity->IsUpinActive(); 
       
   580         iUpinCodeRejected = iSecurity->IsUpinBlocked();
       
   581       }
       
   582     else
       
   583         {
       
   584          iUpinCodeSupported = EFalse;
       
   585          iUpinCodeActive = EFalse; 
       
   586          iUpinCodeRejected = EFalse;       
       
   587         }
       
   588 
       
   589     if( !iUpinCodeSupported || !iUpinCodeActive || iUpinCodeRejected )
       
   590         {
       
   591         if ( iSecurity->IsLockEnabledL( RMobilePhone::ELockICC ) )
       
   592             {
       
   593             ptrBuffer = ( *iPinItems )[0];
       
   594             }
       
   595         else
       
   596             {
       
   597             ptrBuffer = ( *iPinItems )[1];
       
   598             }   
       
   599 
       
   600         iListboxItemArray->SetDynamicTextL( EGSSettIdPinRequest, ptrBuffer );
       
   601         iListboxItemArray->SetItemVisibilityL( EGSSettIdPinRequest, 
       
   602                            CGSListBoxItemTextArray::EVisible );
       
   603         }
       
   604     else
       
   605         {
       
   606         iListboxItemArray->SetItemVisibilityL( EGSSettIdPinRequest, 
       
   607                            CGSListBoxItemTextArray::EInvisible );
       
   608         }
       
   609     CleanupStack::PopAndDestroy( dynamicText );
       
   610     }
       
   611 
       
   612 
       
   613 // ---------------------------------------------------------------------------
       
   614 // CGSSimSecPluginContainer:: MakeUpinRequestItemL()
       
   615 // 
       
   616 //  
       
   617 // ---------------------------------------------------------------------------
       
   618 //
       
   619 void CGSSimSecPluginContainer:: MakeUpinRequestItemL()
       
   620     {
       
   621     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   622     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   623     if(wcdmaSupported || upinSupported)
       
   624       {   
       
   625         HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   626         TPtr ptrBuffer ( dynamicText->Des() );
       
   627     
       
   628         iUpinCodeSupported = iSecurity->IsUpinSupportedL();
       
   629         iUpinCodeActive = iSecurity->IsUpinActive();
       
   630         iUpinCodeRejected = iSecurity->IsUpinBlocked();
       
   631     
       
   632     
       
   633         if( iUpinCodeSupported && !iUpinCodeRejected && iUpinCodeActive )
       
   634             {
       
   635         
       
   636             if ( iSecurity->IsLockEnabledL( RMobilePhone::ELockUniversalPin ) )
       
   637                 {
       
   638                 ptrBuffer = ( *iPinItems )[0];
       
   639                 }
       
   640             else
       
   641                 {
       
   642                 ptrBuffer = ( *iPinItems )[1];
       
   643                 }
       
   644     
       
   645             iListboxItemArray->SetDynamicTextL( EGSSettIdUpinRequest, ptrBuffer );
       
   646             iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinRequest, 
       
   647                                CGSListBoxItemTextArray::EVisible );
       
   648             }
       
   649         else
       
   650             {
       
   651             iListboxItemArray->SetItemVisibilityL( EGSSettIdUpinRequest,
       
   652                                CGSListBoxItemTextArray::EInvisible );
       
   653             }
       
   654         
       
   655         CleanupStack::PopAndDestroy( dynamicText );
       
   656       }
       
   657     }
       
   658 
       
   659 
       
   660 // ---------------------------------------------------------------------------
       
   661 // CGSSimSecPluginContainer:: MakeCodeInUseItemL()
       
   662 // 
       
   663 //  
       
   664 // ---------------------------------------------------------------------------
       
   665 //
       
   666 void CGSSimSecPluginContainer:: MakeCodeInUseItemL()
       
   667     {
       
   668     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   669     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   670     if(wcdmaSupported || upinSupported)
       
   671       {
       
   672         HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   673         TPtr ptrBuffer ( dynamicText->Des() );
       
   674         iUpinCodeSupported = iSecurity->IsUpinSupportedL();
       
   675         iUpinCodeRejected = iSecurity->IsUpinBlocked();
       
   676         if( iUpinCodeSupported && !iUpinCodeRejected )
       
   677             {
       
   678             if ( !iSecurity->IsUpinActive() )
       
   679                 {
       
   680                 ptrBuffer = ( *iCodeItems )[0];
       
   681                 }
       
   682             else
       
   683                 {
       
   684                 ptrBuffer = ( *iCodeItems )[1];
       
   685                 }
       
   686     
       
   687             iListboxItemArray->SetDynamicTextL( EGSSettIdCodeInUse, ptrBuffer );
       
   688             iListboxItemArray->SetItemVisibilityL( EGSSettIdCodeInUse, 
       
   689                                CGSListBoxItemTextArray::EVisible );
       
   690             }
       
   691         else
       
   692             {
       
   693     
       
   694              iListboxItemArray->SetItemVisibilityL( EGSSettIdCodeInUse, 
       
   695                                 CGSListBoxItemTextArray::EInvisible );
       
   696             }
       
   697         
       
   698         CleanupStack::PopAndDestroy( dynamicText );
       
   699       }
       
   700     }
       
   701 
       
   702 
       
   703 // ---------------------------------------------------------------------------
       
   704 // CGSSimSecPluginContainer:: MakeClosedUserGroupItemL()
       
   705 // 
       
   706 //  
       
   707 // ---------------------------------------------------------------------------
       
   708 //
       
   709 void CGSSimSecPluginContainer::MakeClosedUserGroupItemL()
       
   710     {
       
   711     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   712     TPtr ptrBuffer ( dynamicText->Des() );
       
   713 
       
   714     TInt cugMode = 0;
       
   715     TInt cugDefault;
       
   716     TInt err = KErrNone;
       
   717 
       
   718     RSSSettings cugSettings;
       
   719     User::LeaveIfError( cugSettings.Open() );
       
   720 
       
   721     err = cugSettings.Get( ESSSettingsDefaultCug, cugDefault );
       
   722     User::LeaveIfError( err );
       
   723 
       
   724     if ( cugSettings.Get( ESSSettingsCug , cugMode ) != KErrNone )
       
   725         {// getting mode was not succesful
       
   726         cugMode = cugDefault;
       
   727         }
       
   728     
       
   729     TBuf<KMaxStringLength> string;
       
   730 
       
   731     if ( cugMode == cugDefault )
       
   732         {
       
   733         StringLoader::Load( string, R_CUG_NETWORK_DEFAULT );
       
   734         ptrBuffer = string;
       
   735         }
       
   736     else
       
   737         {
       
   738         switch ( cugMode )
       
   739             {
       
   740             case ESSSettingsCugSuppress:
       
   741                 StringLoader::Load( string, R_CUG_OFF );
       
   742                 ptrBuffer = string;    
       
   743                 break;
       
   744             default:
       
   745                 StringLoader::Load( string, R_CUG_ON );
       
   746                 ptrBuffer = string;    
       
   747                 break;
       
   748             }
       
   749         }
       
   750     
       
   751     cugSettings.Close();
       
   752     
       
   753     iListboxItemArray->SetDynamicTextL( EGSSettIdClosedUserGroup, ptrBuffer );
       
   754     iListboxItemArray->SetItemVisibilityL( EGSSettIdClosedUserGroup, 
       
   755                        CGSListBoxItemTextArray::EVisible );
       
   756     CleanupStack::PopAndDestroy( dynamicText );
       
   757 
       
   758     }
       
   759 
       
   760 
       
   761 // ---------------------------------------------------------------------------
       
   762 // CGSSimSecPluginContainer:: MakeSatOperationsItemL()
       
   763 // 
       
   764 //  
       
   765 // ---------------------------------------------------------------------------
       
   766 //
       
   767 void CGSSimSecPluginContainer::MakeSatOperationsItemL()
       
   768     {
       
   769     HBufC* dynamicText = HBufC::NewLC( KGSBufSize128 );
       
   770     TPtr ptrBuffer ( dynamicText->Des() );
       
   771 
       
   772     TInt satOperation = iModel->SatOperations();
       
   773         
       
   774     if ( satOperation == 1 )
       
   775         {
       
   776         ptrBuffer = ( *iSatItems )[1];
       
   777         }
       
   778     else
       
   779         {
       
   780         ptrBuffer = ( *iSatItems )[0];
       
   781         }
       
   782 
       
   783     iListboxItemArray->SetDynamicTextL( EGSSettIdSatOperations, ptrBuffer );
       
   784     iListboxItemArray->SetItemVisibilityL( EGSSettIdSatOperations, 
       
   785                        CGSListBoxItemTextArray::EVisible );
       
   786     CleanupStack::PopAndDestroy( dynamicText );
       
   787 
       
   788     }
       
   789 
       
   790 
       
   791 // ---------------------------------------------------------------------------
       
   792 // CGSSimSecPluginContainer::CurrentFeatureId()
       
   793 //  
       
   794 // ---------------------------------------------------------------------------
       
   795 //
       
   796 TInt CGSSimSecPluginContainer::CurrentFeatureId() const
       
   797     {
       
   798     return iListboxItemArray->CurrentFeature( );
       
   799     }
       
   800 
       
   801 
       
   802 // ---------------------------------------------------------------------------
       
   803 // CGSSimSecPluginContainer::GetHelpContext() const
       
   804 // Gets Help 
       
   805 //  
       
   806 // ---------------------------------------------------------------------------
       
   807 //
       
   808 void CGSSimSecPluginContainer::GetHelpContext( TCoeHelpContext& aContext ) const
       
   809     {
       
   810     aContext.iMajor = KUidGS;
       
   811     aContext.iContext = KSET_HLP_SECURITY_DEVICE_SIM;
       
   812     }
       
   813 
       
   814 
       
   815 // ---------------------------------------------------------------------------
       
   816 // CGSSettListIdleContainer::RecreatePinItemsL()
       
   817 // 
       
   818 //  
       
   819 // ---------------------------------------------------------------------------
       
   820 //
       
   821 void CGSSimSecPluginContainer::RecreatePinItemsL()
       
   822     {
       
   823     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   824     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   825     if(wcdmaSupported || upinSupported)
       
   826       {
       
   827         //check if UPIN code is supported and not rejected
       
   828         if( iSecurity->IsUpinSupportedL() )
       
   829             {
       
   830             iUpinCodeSupported = ETrue;
       
   831     
       
   832             //check if UPIN code is active
       
   833             if( iSecurity->IsUpinActive() )
       
   834                 {
       
   835                 iUpinCodeActive = ETrue;
       
   836                 }
       
   837             else
       
   838                 {
       
   839                 iUpinCodeActive = EFalse;
       
   840                 }
       
   841             
       
   842             //Check whether UPIN is blocked
       
   843     
       
   844             if( !iSecurity->IsUpinBlocked() )
       
   845                 {
       
   846                 iUpinCodeRejected = EFalse;
       
   847                 }
       
   848             else
       
   849                 {
       
   850                 iUpinCodeRejected = ETrue;
       
   851                 }
       
   852         }
       
   853         else
       
   854             {
       
   855             iUpinCodeSupported = EFalse;
       
   856             iUpinCodeActive = EFalse;
       
   857             }
       
   858     
       
   859         MakeCodeInUseItemL();
       
   860         MakeUpinRequestItemL();
       
   861         MakeCodeItemL( EGSSettIdUpinCode );
       
   862         MakePinRequestItemL();
       
   863         MakeCodeItemL( EGSSettIdPinCode );
       
   864       }
       
   865     }
       
   866 
       
   867 
       
   868 // ---------------------------------------------------------------------------
       
   869 // CGSSimSecPluginContainer::HandleResourceChangeL()
       
   870 // 
       
   871 // Updates view layout 
       
   872 // ---------------------------------------------------------------------------
       
   873 //
       
   874 void CGSSimSecPluginContainer::HandleResourceChangeL( TInt aType )
       
   875     {
       
   876     if( aType == KAknsMessageSkinChange ||
       
   877         aType == KEikDynamicLayoutVariantSwitch )
       
   878         {
       
   879         TRect mainPaneRect;
       
   880         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, 
       
   881                                            mainPaneRect );
       
   882         SetRect( mainPaneRect );
       
   883         DrawNow();
       
   884         }
       
   885     }
       
   886     
       
   887     
       
   888 
       
   889 // ---------------------------------------------------------------------------
       
   890 // CGSSimSecPluginContainer::MakeRemoteLockItemL()
       
   891 // 
       
   892 //  
       
   893 // ---------------------------------------------------------------------------
       
   894 //
       
   895 void CGSSimSecPluginContainer::MakeRemoteLockItemL()
       
   896     {
       
   897     #ifdef RD_REMOTELOCK
       
   898     #ifdef _DEBUG
       
   899     RDebug::Print( _L( "(SECUI)CGSSimSecPluginContainer::MakeRemoteLockItemL() - Enter" ) );
       
   900     #endif // DEBUG
       
   901 
       
   902     HBufC* statusItemText = HBufC::NewLC( KGSBufSize128 );
       
   903     TPtr ptrRemoteLockStatus( statusItemText->Des() );
       
   904     TBool remoteLockStatus( EFalse );
       
   905     CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewLC();
       
   906 
       
   907     if ( remoteLockSettings->GetEnabled( remoteLockStatus ) )
       
   908         {
       
   909         if ( remoteLockStatus )
       
   910             {
       
   911             // Remote lock enabled
       
   912             ptrRemoteLockStatus = (*iRemoteLockItems)[0];
       
   913             }
       
   914         else
       
   915             {
       
   916             // Remote lock disabled
       
   917             ptrRemoteLockStatus = (*iRemoteLockItems)[1];
       
   918             }
       
   919         }
       
   920     else
       
   921         {
       
   922         // Failed to get remote lock status
       
   923         // Undefined situation. Display empty item
       
   924         ptrRemoteLockStatus = KRemoteLockEmptyItem;
       
   925         }
       
   926 
       
   927     CleanupStack::PopAndDestroy( remoteLockSettings );
       
   928     remoteLockSettings = NULL;
       
   929 
       
   930     // Remote Lock item
       
   931 	iListboxItemArray->SetDynamicTextL( EGSSettIdRemoteLock, ptrRemoteLockStatus );
       
   932     CleanupStack::PopAndDestroy( statusItemText );
       
   933 	iListboxItemArray->SetItemVisibilityL( EGSSettIdRemoteLock, CGSListBoxItemTextArray::EVisible );
       
   934 
       
   935     #ifdef _DEBUG
       
   936     RDebug::Print( _L( "(SECUI)CGSSimSecPluginContainer::MakeRemoteLockItemL() - Exit" ) );
       
   937     #endif // DEBUG
       
   938 	#endif // RD_REMOTELOCK
       
   939     return;
       
   940     }
       
   941     
       
   942     
       
   943 //End of File