securitydialogs/SecUi/GSSimSecPlugin/Src/GSSimSecPlugin.cpp
branchRCL_3
changeset 22 03674e5abf46
equal deleted inserted replaced
21:09b1ac925e3f 22:03674e5abf46
       
     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:  View for Device & SIM Security sub-folder
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <coeaui.h>
       
    21 #include <hlplch.h>             // For HlpLauncher
       
    22 #include <bautils.h>
       
    23 #include <gulicon.h>
       
    24 #include <eikfrlbd.h>
       
    25 #include <eiktxlbx.h>
       
    26 #include <aknradiobuttonsettingpage.h>
       
    27 #include <aknPopup.h>
       
    28 #include <aknlists.h>
       
    29 #include <RSSSettings.h>
       
    30 #include <AknQueryDialog.h>
       
    31 #include <aknnotedialog.h>
       
    32 #include <aknViewAppUi.h>
       
    33 #include <featmgr.h>
       
    34 #include <StringLoader.h>
       
    35 #include <secui.h>
       
    36 #include <secuisecuritysettings.h>
       
    37 #include <BTSapDomainPSKeys.h>
       
    38 #include <e32property.h>
       
    39 
       
    40 #include <GSSimSecPluginRsc.rsg>
       
    41 #include <gsprivatepluginproviderids.h>
       
    42 #include <gsmainview.h>
       
    43 #include <gsbasecontainer.h>
       
    44 
       
    45 #include "GSSimSecPlugin.h"
       
    46 #include "GSSimSecPluginContainer.h"
       
    47 #include "GSSimSecPlugin.hrh"
       
    48 
       
    49 
       
    50 #ifdef RD_REMOTELOCK
       
    51 #include    <RemoteLockSettings.h>  
       
    52 #endif // RD_REMOTELOCK
       
    53 
       
    54 
       
    55 // EXTERNAL DATA STRUCTURES
       
    56 
       
    57 // EXTERNAL FUNCTION PROTOTYPES  
       
    58 
       
    59 // CONSTANTS
       
    60 
       
    61 // MACROS
       
    62 
       
    63 // LOCAL CONSTANTS AND MACROS
       
    64 const TInt KEmptyCugIndex( -100000000 );
       
    65 _LIT( KGSSimSecPluginResourceFileName, "z:GSSimSecPluginRsc.rsc" );
       
    66 
       
    67 // MODULE DATA STRUCTURES
       
    68 
       
    69 // LOCAL FUNCTION PROTOTYPES
       
    70 
       
    71 // FORWARD DECLARATIONS
       
    72 
       
    73 /**
       
    74 * CCugQuery
       
    75 * It defines CCugQuery used in closed user group settings
       
    76 */
       
    77 class CCugQuery
       
    78     : public CAknNumberQueryDialog
       
    79     {
       
    80     public: // Constructors and destructors
       
    81         /**
       
    82         * C++ constructor.
       
    83         */
       
    84         CCugQuery( TInt& aNumber,const TTone aTone = ENoTone );
       
    85         /**
       
    86         * Prepares the dialog, by constructing it from the specified resource. Overwrite the base class.
       
    87         * @param aResourceId The resource ID of the dialog.
       
    88         */
       
    89         void PrepareLC( TInt aResourceId );
       
    90         
       
    91     protected: // From base classes
       
    92         /**
       
    93         * From CCAknNumberQueryDialog Left softkey is allways OK.
       
    94         */
       
    95         void  UpdateLeftSoftKeyL();
       
    96     };
       
    97 
       
    98 // ============================= LOCAL FUNCTIONS ==============================
       
    99 
       
   100 // ========================= MEMBER FUNCTIONS =================================
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // GSSimSecPlugin::NewL()
       
   104 // 
       
   105 // ---------------------------------------------------------------------------
       
   106 CGSSimSecPlugin* CGSSimSecPlugin::NewL( TAny* /*aInitParams*/ )
       
   107     {
       
   108     CGSSimSecPlugin* self = new( ELeave ) CGSSimSecPlugin();
       
   109     
       
   110     CleanupStack::PushL( self );
       
   111     self->ConstructL();    
       
   112     CleanupStack::Pop( self );
       
   113 
       
   114     return self;
       
   115     }
       
   116 
       
   117 
       
   118 // ---------------------------------------------------------------------------
       
   119 // GSSimSecPlugin::CGSSimSecPlugin()
       
   120 // 
       
   121 // ---------------------------------------------------------------------------
       
   122 CGSSimSecPlugin::CGSSimSecPlugin()
       
   123     : iResourceLoader( *iCoeEnv )
       
   124     {    
       
   125     }
       
   126 
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // CGSSimSecPlugin::ConstructL()
       
   130 // 
       
   131 // Symbian OS two-phased constructor
       
   132 // ---------------------------------------------------------------------------
       
   133 void CGSSimSecPlugin::ConstructL()
       
   134     {
       
   135     FeatureManager::InitializeLibL();
       
   136 
       
   137     iModel = CGSSimSecPluginModel::NewL();
       
   138     //PS listener initialization
       
   139     iBtSapListener = CGSPubSubsListener::NewL( 
       
   140                      KPSUidBluetoothSapConnectionState,
       
   141                      KBTSapConnectionState, this );
       
   142 
       
   143     iSecurity= CSecuritySettings::NewL();    
       
   144     if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport ))
       
   145     {    
       
   146     	User::LeaveIfError( iCugSettings.Open() );
       
   147 		}
       
   148     // Find the resource file
       
   149     TParse parse;
       
   150     parse.Set( KGSSimSecPluginResourceFileName, 
       
   151                &KDC_RESOURCE_FILES_DIR, NULL );
       
   152     TFileName fileName( parse.FullName() );
       
   153     
       
   154     // Get language of resource file
       
   155     BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName );
       
   156 
       
   157     // Open resource file
       
   158     iResourceLoader.OpenL( fileName );
       
   159     
       
   160     BaseConstructL( R_GS_SIM_SECURITY_VIEW );
       
   161 
       
   162     // secui resource file
       
   163     TSecUi::InitializeLibL();
       
   164     }
       
   165 
       
   166 
       
   167 // ---------------------------------------------------------------------------
       
   168 // CGSSimSecPlugin::~CGSSettListSecurityView()
       
   169 // 
       
   170 // 
       
   171 // ---------------------------------------------------------------------------
       
   172 CGSSimSecPlugin::~CGSSimSecPlugin()
       
   173     {
       
   174     FeatureManager::UnInitializeLib();
       
   175     // close resource loader
       
   176     iResourceLoader.Close();
       
   177 	if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport ))
       
   178     { 
       
   179     iCugSettings.Close();
       
   180   	}
       
   181     if ( iSecurity )
       
   182         {
       
   183         delete iSecurity;
       
   184         }
       
   185 
       
   186     if ( iModel )
       
   187         {
       
   188         delete iModel;
       
   189         }
       
   190     delete iBtSapListener;
       
   191 
       
   192     TSecUi::UnInitializeLib();  
       
   193     }
       
   194 
       
   195 
       
   196 // ---------------------------------------------------------------------------
       
   197 // TUid CGSSettSimListSecurityView::Id()
       
   198 // 
       
   199 // 
       
   200 // ---------------------------------------------------------------------------
       
   201 TUid CGSSimSecPlugin::Id() const
       
   202     {
       
   203     return KGSSimSecPluginUid;
       
   204     }
       
   205 
       
   206 
       
   207 // ---------------------------------------------------------------------------
       
   208 // CGSSimSecPlugin::HandleCommandL()
       
   209 // 
       
   210 // 
       
   211 // ---------------------------------------------------------------------------
       
   212 void CGSSimSecPlugin::HandleCommandL( TInt aCommand )
       
   213     {
       
   214     switch ( aCommand )
       
   215         {
       
   216         case EGSCmdAppChange:
       
   217         case EAknSoftkeyChange:
       
   218             {           
       
   219             const TInt currentFeatureId = Container()->CurrentFeatureId();
       
   220 
       
   221             if ( currentFeatureId != EGSSettIdSatOperations )
       
   222                 {
       
   223                 HandleListBoxSelectionL();
       
   224                 }
       
   225             else
       
   226                 {
       
   227                 if(aCommand == EGSCmdAppChange)
       
   228                     SetSatWithSettingPageL();
       
   229                 else //user pressed MSK, don't show setting page.
       
   230                     SetSatOperationsL();
       
   231                 }
       
   232             }
       
   233             break;
       
   234         case EAknSoftkeyBack:
       
   235             iAppUi->ActivateLocalViewL( KGSSecurityPluginUid );  
       
   236             break;
       
   237         case EAknCmdHelp:
       
   238             {
       
   239             if( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   240                 {
       
   241                 HlpLauncher::LaunchHelpApplicationL(
       
   242                     iEikonEnv->WsSession(), iAppUi->AppHelpContextL() );
       
   243                 }
       
   244             }
       
   245             break;
       
   246         default:
       
   247             iAppUi->HandleCommandL( aCommand );
       
   248             break;
       
   249         }
       
   250     }
       
   251 
       
   252 
       
   253 // ---------------------------------------------------------------------------
       
   254 // CGSSimSecPlugin::UpdateListBoxL
       
   255 // 
       
   256 // Update the current item in the listbox.
       
   257 // ---------------------------------------------------------------------------
       
   258 void CGSSimSecPlugin::UpdateListBoxL( TInt aItemId )
       
   259     {
       
   260     Container()->UpdateListBoxL( aItemId );
       
   261     }
       
   262 
       
   263 
       
   264 // ---------------------------------------------------------------------------
       
   265 // CGSSimSecPlugin::DoActivateL(...)
       
   266 // 
       
   267 // 
       
   268 // ---------------------------------------------------------------------------
       
   269 void CGSSimSecPlugin::DoActivateL( const TVwsViewId& aPrevViewId, 
       
   270                                    TUid aCustomMessageId, 
       
   271                                    const TDesC8& aCustomMessage )
       
   272     {
       
   273     CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage );    
       
   274     }
       
   275 
       
   276 
       
   277 // ----------------------------------------------------------------------------
       
   278 // CGSSimSecPlugin::Container
       
   279 // 
       
   280 // Return handle to container class.
       
   281 // ----------------------------------------------------------------------------
       
   282 //
       
   283 CGSSimSecPluginContainer* CGSSimSecPlugin::Container()
       
   284     {
       
   285     return static_cast<CGSSimSecPluginContainer*>( iContainer );
       
   286     }
       
   287 
       
   288 
       
   289 // ---------------------------------------------------------------------------
       
   290 // CGSSimSecPlugin::NewContainerL()
       
   291 // 
       
   292 // Creates new iContainer.
       
   293 // ---------------------------------------------------------------------------
       
   294 //
       
   295 void CGSSimSecPlugin::NewContainerL()
       
   296     {
       
   297     iContainer = new( ELeave ) CGSSimSecPluginContainer( iModel );
       
   298     }
       
   299 
       
   300 
       
   301 // ---------------------------------------------------------------------------
       
   302 // CGSSimSecPlugin::HandleListBoxSelectionL()
       
   303 // 
       
   304 // 
       
   305 // ---------------------------------------------------------------------------
       
   306 void CGSSimSecPlugin::HandleListBoxSelectionL() 
       
   307     {
       
   308     const TInt currentFeatureId = Container()->CurrentFeatureId();
       
   309     TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ));
       
   310     TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin ));
       
   311     switch ( currentFeatureId )
       
   312         {
       
   313         case EGSSettIdCodeInUse:
       
   314             if(wcdmaSupported || upinSupported)
       
   315                 {
       
   316 	                if(iSecurity->SwitchPinCodesL())
       
   317 	                {
       
   318 	                	UpdateListBoxL( currentFeatureId );
       
   319 	              	}
       
   320                 }       
       
   321             break;
       
   322         case EGSSettIdUpinRequest:
       
   323             if(wcdmaSupported || upinSupported)
       
   324                  {
       
   325                     if(iSecurity->ChangeUPinRequestL())
       
   326                     {            
       
   327                     	UpdateListBoxL( currentFeatureId );
       
   328                     }
       
   329                  }
       
   330             break;
       
   331         case EGSSettIdUpinCode:
       
   332             if(wcdmaSupported || upinSupported)
       
   333               {
       
   334                   iSecurity->ChangeUPinL();
       
   335               }
       
   336             break;
       
   337         case EGSSettIdPinRequest: 
       
   338         		if(iSecurity->ChangePinRequestL())
       
   339             {               
       
   340             	UpdateListBoxL( currentFeatureId );
       
   341             }
       
   342             break;
       
   343         case EGSSettIdPinCode:            
       
   344             iSecurity->ChangePinL();
       
   345             break;
       
   346         case EGSSettIdPin2Code:
       
   347             iSecurity->ChangePin2L();
       
   348             break;
       
   349         case EGSSettIdAutolock:        
       
   350             SetAutolockTimeL( iSecurity->ChangeAutoLockPeriodL( 
       
   351                                          iModel->AutoLockPeriod() ) );
       
   352             break;
       
   353         case EGSSettIdSecurityCode:
       
   354             iSecurity->ChangeSecCodeL();
       
   355             break;
       
   356         case EGSSettIdSimChange:    
       
   357             if(iSecurity->ChangeSimSecurityL())
       
   358             {
       
   359             	UpdateListBoxL( currentFeatureId );
       
   360             }
       
   361             break; 
       
   362             
       
   363 #ifdef RD_REMOTELOCK
       
   364         case EGSSettIdRemoteLock:
       
   365             SetRemoteLockStatusL( iModel->AutoLockPeriod() );
       
   366             break;
       
   367             
       
   368 #endif                
       
   369         case EGSSettIdClosedUserGroup:
       
   370         	if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport ))
       
   371     		{        
       
   372 	            CugModeL();
       
   373 	            UpdateListBoxL( currentFeatureId );
       
   374 	          }
       
   375             break;
       
   376         case EGSSettIdSatOperations:
       
   377             SetSatOperationsL();
       
   378             break;
       
   379         default:
       
   380             break;
       
   381         }
       
   382     
       
   383     }
       
   384 
       
   385 // ---------------------------------------------------------------------------
       
   386 // CGSSimSecPlugin::SetAutolockTimeL()
       
   387 // 
       
   388 // 
       
   389 // ---------------------------------------------------------------------------
       
   390 void CGSSimSecPlugin::SetAutolockTimeL( TInt aPeriod )
       
   391     { 
       
   392     iModel->SetAutoLockPeriod( aPeriod );
       
   393     UpdateListBoxL( EGSSettIdAutolock );
       
   394     }
       
   395 
       
   396 // ---------------------------------------------------------------------------
       
   397 // CGSSimSecPlugin::SetSatOperationsL()
       
   398 // 
       
   399 // 
       
   400 // ---------------------------------------------------------------------------
       
   401 void CGSSimSecPlugin::SetSatOperationsL()
       
   402     {
       
   403     TInt i = iModel->SatOperations();
       
   404     
       
   405     if ( i == 0 )
       
   406         {
       
   407         iModel->SetSatOperations( 1 );
       
   408         }
       
   409     else
       
   410         {
       
   411         iModel->SetSatOperations( 0 );
       
   412         }
       
   413     UpdateListBoxL( EGSSettIdSatOperations );
       
   414     }
       
   415 
       
   416 // ---------------------------------------------------------------------------
       
   417 // CGSSimSecPlugin::SetSatOperationsL()
       
   418 // 
       
   419 // 
       
   420 // ---------------------------------------------------------------------------
       
   421 void CGSSimSecPlugin::SetSatWithSettingPageL()
       
   422     {
       
   423     TInt currentItem = iModel->SatOperations();
       
   424 
       
   425     CDesCArrayFlat* items =  iCoeEnv->ReadDesC16ArrayResourceL( R_SAT_ARRAY );
       
   426     CleanupStack::PushL( items );
       
   427 
       
   428     CAknRadioButtonSettingPage* page = 
       
   429         new( ELeave ) CAknRadioButtonSettingPage( R_SAT_SETTING_PAGE, 
       
   430                                                   currentItem, items );
       
   431 
       
   432     if ( page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )            
       
   433         {    
       
   434         iModel->SetSatOperations( currentItem );
       
   435         }
       
   436     
       
   437     CleanupStack::PopAndDestroy( items );
       
   438 
       
   439     UpdateListBoxL( EGSSettIdSatOperations );
       
   440     }
       
   441 
       
   442 
       
   443 // ---------------------------------------------------------------------------
       
   444 // CGSSimSecPlugin::CugModeL()
       
   445 // 
       
   446 // 
       
   447 // ---------------------------------------------------------------------------
       
   448 void CGSSimSecPlugin::CugModeL()
       
   449     {    
       
   450     TInt cugIndex = 0;
       
   451     TInt currentItem = 0;
       
   452     TInt cugMode = 0;
       
   453     TInt cugDefault;
       
   454     TInt err = KErrNone;
       
   455 
       
   456     err = iCugSettings.Get( ESSSettingsDefaultCug, cugDefault );
       
   457     User::LeaveIfError( err );
       
   458 
       
   459     
       
   460     if ( iCugSettings.Get( ESSSettingsCug, cugMode ) != KErrNone )
       
   461         {// getting mode was not succesful
       
   462         cugMode = cugDefault;
       
   463         }
       
   464 
       
   465     if ( cugMode == cugDefault )
       
   466         {
       
   467         currentItem = EGSCugNetworkDefault;
       
   468         if ( iCugSettings.PreviousCugValue( cugIndex ) != KErrNone )        
       
   469             {
       
   470             cugIndex = 0;
       
   471             }
       
   472         }
       
   473     else
       
   474         {
       
   475         switch ( cugMode )
       
   476             {
       
   477             case ESSSettingsCugSuppress:
       
   478                 currentItem = EGSCugOff;
       
   479                 if ( iCugSettings.PreviousCugValue( cugIndex ) != KErrNone )
       
   480                     {
       
   481                     cugIndex = 0;
       
   482                     }
       
   483                 break;
       
   484             default:
       
   485                 currentItem = EGSCugOn;
       
   486                 cugIndex = cugMode;
       
   487                 break;
       
   488             }
       
   489         }
       
   490 
       
   491 
       
   492     CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_CUG_LBX );
       
   493     CleanupStack::PushL( items );
       
   494 
       
   495     CAknRadioButtonSettingPage* page = 
       
   496         new( ELeave ) CAknRadioButtonSettingPage( R_CUG_SETTING_PAGE, 
       
   497                                                   currentItem, items );
       
   498 
       
   499     // call the appropriate cug- methods here
       
   500     if ( page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) )    
       
   501         {    
       
   502         
       
   503         switch ( currentItem )
       
   504             {
       
   505             case EGSCugNetworkDefault://cug mode set default, 
       
   506                 User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, 
       
   507                                                       cugDefault ) );
       
   508                 break;
       
   509             case EGSCugOn: //1, index is queried, if query ok then
       
   510                 // set the index and mode
       
   511                 if ( CugIndexQueryL( cugIndex, cugDefault )  )
       
   512                     {
       
   513                     if ( iCugSettings.IsValueValidCugIndex( cugIndex ) )
       
   514                         {
       
   515                         User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, 
       
   516                                                               cugIndex ) );
       
   517                         }
       
   518                     else
       
   519                         {
       
   520                         User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, 
       
   521                                                               cugDefault ) );
       
   522                         User::LeaveIfError( iCugSettings.ResetPreviousCugValue() );
       
   523                         }
       
   524                     }
       
   525                 break;
       
   526             case EGSCugOff://2, sets cug mode "inactive"
       
   527                 User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, 
       
   528                                     ESSSettingsCugSuppress ) );
       
   529                 break;
       
   530             default:
       
   531                 break;
       
   532             }
       
   533         }
       
   534     CleanupStack::PopAndDestroy( items );
       
   535     return;    
       
   536     }
       
   537 
       
   538 
       
   539 // ---------------------------------------------------------------------------
       
   540 // CGSSimSecPlugin::CugIndexQueryL()
       
   541 // 
       
   542 // 
       
   543 // ---------------------------------------------------------------------------
       
   544 TInt CGSSimSecPlugin::CugIndexQueryL( TInt& aCugIndex, TInt& aCugDefault )
       
   545     {    
       
   546     while ( ETrue )
       
   547         {
       
   548         CCugQuery* dlg = new( ELeave ) CCugQuery( aCugIndex,
       
   549                                        CAknQueryDialog::ENoTone );
       
   550         dlg->PrepareLC( R_CUG_INDEX );
       
   551         if ( dlg->RunLD() )
       
   552             {
       
   553             // check content validity (?-32767), 
       
   554             // ui spec concerned only values above limit
       
   555             if( !iCugSettings.IsValueValidCugIndex( aCugIndex )
       
   556                 && ( aCugIndex != KEmptyCugIndex )
       
   557                 && ( aCugIndex != aCugDefault ) )
       
   558                 {
       
   559                 CAknNoteDialog* dlg = new ( ELeave ) 
       
   560                     CAknNoteDialog( CAknNoteDialog::EErrorTone, 
       
   561                                     CAknNoteDialog::ELongTimeout );
       
   562                 dlg->ExecuteLD( R_CUG_INDEX_ERROR_NOTE );
       
   563                 }
       
   564             else //index ok, break
       
   565                 {
       
   566                 break;
       
   567                 }
       
   568             }
       
   569         else // query cancelled
       
   570             {
       
   571             return EFalse;
       
   572             }
       
   573         }
       
   574 
       
   575     return ETrue;    
       
   576     }
       
   577 
       
   578 
       
   579 // ---------------------------------------------------------------------------
       
   580 // CCugQuery::CCugQuery()
       
   581 // 
       
   582 // ---------------------------------------------------------------------------
       
   583 //
       
   584 CCugQuery::CCugQuery( TInt& aNumber, const TTone aTone )
       
   585     : CAknNumberQueryDialog( aNumber, aTone )
       
   586     {
       
   587     }
       
   588 
       
   589 
       
   590 // ---------------------------------------------------------------------------
       
   591 // CCugQuery::UpdateLeftSoftKeyL()
       
   592 // Left softkey is allways visible
       
   593 // ---------------------------------------------------------------------------
       
   594 //
       
   595 void CCugQuery::UpdateLeftSoftKeyL()
       
   596     {
       
   597     MakeLeftSoftkeyVisible( ETrue );
       
   598     }
       
   599 
       
   600 // ---------------------------------------------------------------------------
       
   601 // CCugQuery::PrepareLC( TInt aResourceId )
       
   602 // 
       
   603 // ---------------------------------------------------------------------------
       
   604 //
       
   605 void CCugQuery::PrepareLC( TInt aResourceId )
       
   606     {
       
   607     CAknNumberQueryDialog::PrepareLC( aResourceId );
       
   608     CAknQueryControl* queryControl = QueryControl();
       
   609     if( queryControl )
       
   610         {
       
   611         CEikEdwin* edwin = static_cast< CEikEdwin* >( queryControl->ControlByLayoutOrNull( ENumberLayout ) );
       
   612         if( edwin )
       
   613             {
       
   614             edwin->SetAknEditorNumericKeymap( EAknEditorPlainNumberModeKeymap );
       
   615             }
       
   616         }
       
   617     }
       
   618 
       
   619 // ---------------------------------------------------------------------------
       
   620 // CGSSimSecPlugin::HandleResourceChangeL( TInt aType )
       
   621 // Updates view layout
       
   622 //  
       
   623 // ---------------------------------------------------------------------------
       
   624 //
       
   625 void CGSSimSecPlugin::HandleResourceChangeL( TInt aType )
       
   626     {
       
   627     if( aType == KAknsMessageSkinChange ||
       
   628         aType == KEikDynamicLayoutVariantSwitch )
       
   629         {
       
   630         //iContainer->HandleResourceChangeL( aType );
       
   631         }
       
   632     }
       
   633 
       
   634 
       
   635 // ---------------------------------------------------------------------------
       
   636 // CGSSimSecPlugin::HandleNotifyPSL
       
   637 //
       
   638 // Handling PS keys change
       
   639 // ---------------------------------------------------------------------------
       
   640 //  
       
   641 void CGSSimSecPlugin::HandleNotifyPSL( const TUid aUid, const TInt& aKey,
       
   642                                        const TRequestStatus& /* aStatus */ )
       
   643     {
       
   644     if ( aUid == KPSUidBluetoothSapConnectionState && 
       
   645          aKey == KBTSapConnectionState )
       
   646         {
       
   647         Visible();
       
   648         }
       
   649     }
       
   650 
       
   651 
       
   652 // ========================= From CGSPluginInterface ==================
       
   653 
       
   654 // ----------------------------------------------------------------------------
       
   655 // CGSSimSecPlugin::GetCaption
       
   656 // 
       
   657 // Return application/view caption.
       
   658 // ----------------------------------------------------------------------------
       
   659 //
       
   660 void CGSSimSecPlugin::GetCaptionL( TDes& aCaption ) const
       
   661     {
       
   662     // the resource file is already opened.
       
   663     HBufC* result = StringLoader::LoadL( R_GS_SIM_SECURITY_VIEW_CAPTION );
       
   664     
       
   665     aCaption.Copy( *result );
       
   666     delete result;
       
   667     }
       
   668     
       
   669 
       
   670 // ----------------------------------------------------------------------------
       
   671 // CGSSimSecPlugin::PluginProviderCategory
       
   672 // 
       
   673 // A means to identify the location of this plug-in in the framework.
       
   674 // ----------------------------------------------------------------------------
       
   675 //
       
   676 TInt CGSSimSecPlugin::PluginProviderCategory() const
       
   677     {
       
   678     //To identify internal plug-ins.
       
   679     return KGSPluginProviderInternal;
       
   680     }
       
   681     
       
   682 
       
   683 // ----------------------------------------------------------------------------
       
   684 // CGSSimSecPlugin::Visible
       
   685 // 
       
   686 // Provides the visibility status of self to framework.
       
   687 // ----------------------------------------------------------------------------
       
   688 //    
       
   689 TBool CGSSimSecPlugin::Visible() const
       
   690     {
       
   691     TInt btSapConnectionState;
       
   692     TBool visible = ETrue;
       
   693 
       
   694     iBtSapListener->Get( btSapConnectionState );
       
   695 
       
   696     if ( btSapConnectionState == EBTSapConnected )
       
   697         {
       
   698         visible = EFalse;
       
   699         }
       
   700     
       
   701     return visible;
       
   702     }
       
   703 
       
   704 
       
   705 
       
   706 // ---------------------------------------------------------------------------
       
   707 // CGSSimSecPlugin::SetRemoteLockStatusL()
       
   708 // 
       
   709 // 
       
   710 // ---------------------------------------------------------------------------
       
   711 TInt CGSSimSecPlugin::SetRemoteLockStatusL( TInt aAutoLockPeriod )
       
   712     {
       
   713     #ifdef RD_REMOTELOCK
       
   714     #ifdef _DEBUG
       
   715     RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Enter" ) );
       
   716     #endif // DEBUG
       
   717 
       
   718     TInt retValue( KErrNone );
       
   719     TBool remoteLockStatus( EFalse );
       
   720     TBuf<KRLockMaxLockCodeLength> remoteLockCode;
       
   721 
       
   722     CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewLC();
       
   723 
       
   724     // Get the current remote lock status 
       
   725     if ( remoteLockSettings->GetEnabled( remoteLockStatus ) )
       
   726         {
       
   727         // Show remote lock setting page
       
   728         retValue = iSecurity->ChangeRemoteLockStatusL( remoteLockStatus, remoteLockCode, aAutoLockPeriod );
       
   729 
       
   730         if ( retValue == KErrNone )
       
   731             {
       
   732             if ( remoteLockStatus )
       
   733                 {
       
   734                 // Set remote lock status
       
   735                 if ( remoteLockSettings->SetEnabledL( remoteLockCode ) )
       
   736                     {
       
   737                     // Remote lock status was set successfully
       
   738                     #ifdef _DEBUG
       
   739                     RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Remote lock enabled and code set" ) );
       
   740                     #endif // DEBUG
       
   741                     }
       
   742                 else
       
   743                     {
       
   744                     // Failed to enabled remote lock 
       
   745                     retValue = KErrGeneral;
       
   746 
       
   747                     #ifdef _DEBUG
       
   748                     RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->SetEnabledL failed" ) );
       
   749                     #endif // DEBUG
       
   750                     }
       
   751                 }
       
   752             else
       
   753                 {
       
   754                 // Disable remote lock
       
   755                 if ( remoteLockSettings->SetDisabled() )
       
   756                     {
       
   757                     // Remote lock disabled
       
   758                     #ifdef _DEBUG
       
   759                     RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Remote lock disabled" ) );
       
   760                     #endif // DEBUG
       
   761                     }
       
   762                 else
       
   763                     {
       
   764                     // Failed to disable remote lock
       
   765                     retValue = KErrGeneral;
       
   766 
       
   767                     #ifdef _DEBUG
       
   768                     RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->SetDisabled failed" ) );
       
   769                     #endif // DEBUG
       
   770                     }
       
   771                 }
       
   772             }
       
   773         else
       
   774             {
       
   775             // User interaction (setting page) failed for some reason
       
   776             #ifdef _DEBUG
       
   777             RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - iSecurity->ChangeRemoteLockStatusL failed" ) );
       
   778             #endif // DEBUG
       
   779             }
       
   780         }
       
   781     else
       
   782         {
       
   783         // Failed to retreive the current remote lock status
       
   784         retValue = KErrGeneral;
       
   785 
       
   786         #ifdef _DEBUG
       
   787         RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->GetEnabled failed" ) );
       
   788         #endif // DEBUG
       
   789         }
       
   790 
       
   791     CleanupStack::PopAndDestroy( remoteLockSettings );
       
   792     remoteLockSettings = NULL;
       
   793 
       
   794     UpdateListBoxL( EGSSettIdRemoteLock );
       
   795 
       
   796     #ifdef _DEBUG
       
   797     RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Exit" ) );
       
   798     #endif // DEBUG
       
   799 	return retValue;
       
   800 	#else //!RD_REMOTELOCK 
       
   801     return KErrNotSupported;
       
   802     #endif // RD_REMOTELOCK  
       
   803     }
       
   804     
       
   805     
       
   806 // ----------------------------------------------------------------------------
       
   807 // CGSSimSecPlugin::DynInitMenuPaneL()
       
   808 // 
       
   809 // Display the dynamic menu
       
   810 // ----------------------------------------------------------------------------
       
   811 void CGSSimSecPlugin::DynInitMenuPaneL( TInt aResourceId,
       
   812                                           CEikMenuPane* aMenuPane )
       
   813     {
       
   814 
       
   815 	// show or hide the 'help' menu item when supported
       
   816     if( aResourceId == R_GS_SIM_SEC_MENU_ITEM_HELP )
       
   817         {
       
   818         User::LeaveIfNull( aMenuPane );    
       
   819         if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) )
       
   820             {
       
   821             aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse );
       
   822             }
       
   823         else
       
   824             {
       
   825             aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
       
   826             }
       
   827         }
       
   828 
       
   829     } 
       
   830 // End of File