phonebookui/Phonebook2/USIMExtension/src/CPsu2CopyToSimFieldInfoArray.cpp
branchRCL_3
changeset 18 d4f567ce2e7c
parent 0 e686773b3f54
equal deleted inserted replaced
17:2666d9724c76 18:d4f567ce2e7c
    31 #include <MVPbkFieldType.h>
    31 #include <MVPbkFieldType.h>
    32 
    32 
    33 #include <coemain.h>
    33 #include <coemain.h>
    34 #include <barsread.h>
    34 #include <barsread.h>
    35 #include <gsmerror.h>
    35 #include <gsmerror.h>
    36 
    36 #include <featmgr.h>
    37 #include <VPbkEng.rsg>
    37 #include <VPbkEng.rsg>
    38 
    38 
    39 namespace
    39 namespace
    40 {
    40 {
    41 
    41 
   237     // This class can be used from SIM copy policy so it must not
   237     // This class can be used from SIM copy policy so it must not
   238     // depend on CCoeEnv in anyway.
   238     // depend on CCoeEnv in anyway.
   239     RPbk2LocalizedResourceFile resFile( &aFs );
   239     RPbk2LocalizedResourceFile resFile( &aFs );
   240     resFile.OpenLC(KPbk2RomFileDrive,
   240     resFile.OpenLC(KPbk2RomFileDrive,
   241         KDC_RESOURCE_FILES_DIR, KPsu2USimExtensionResFile);
   241         KDC_RESOURCE_FILES_DIR, KPsu2USimExtensionResFile);
   242     
   242     FeatureManager::InitializeLibL();
   243     TResourceReader reader;
   243     TResourceReader reader;
   244     reader.SetBuffer( 
   244     if( !FeatureManager::FeatureSupported( 
   245         resFile.AllocReadLC( R_PSU2_COPY_TO_SIM_FIELDTYPE_MAPPINGS ) );
   245                     KFeatureIdFfTdClmcontactreplicationfromphonebooktousimcard ) )
       
   246         {
       
   247         reader.SetBuffer( 
       
   248                resFile.AllocReadLC( R_PSU2_COPY_TO_SIM_FIELDTYPE_MAPPINGS ) );
       
   249         }
       
   250     else
       
   251         {
       
   252         reader.SetBuffer( 
       
   253                resFile.AllocReadLC( R_PSU2_COPY_TO_USIM_FIELDTYPE_MAPPINGS ) );
       
   254         }
   246     
   255     
   247     // Go through all mappings in resource and create a mapping array
   256     // Go through all mappings in resource and create a mapping array
   248     const TInt count = reader.ReadInt16();
   257     const TInt count = reader.ReadInt16();
   249     for ( TInt i = 0; i < count; ++i )
   258     for ( TInt i = 0; i < count; ++i )
   250         {
   259         {
   297 CPsu2CopyToSimFieldInfoArray::~CPsu2CopyToSimFieldInfoArray()
   306 CPsu2CopyToSimFieldInfoArray::~CPsu2CopyToSimFieldInfoArray()
   298     {
   307     {
   299     iInfoArray.Close();
   308     iInfoArray.Close();
   300     iMatchedTypes.Close();
   309     iMatchedTypes.Close();
   301     delete iNumberKeyMap;
   310     delete iNumberKeyMap;
       
   311     FeatureManager::UnInitializeLib();
   302     }
   312     }
   303 
   313 
   304 // -----------------------------------------------------------------------------
   314 // -----------------------------------------------------------------------------
   305 // CPsu2CopyToSimFieldInfoArray::FindInfoForSourceType
   315 // CPsu2CopyToSimFieldInfoArray::FindInfoForSourceType
   306 // -----------------------------------------------------------------------------
   316 // -----------------------------------------------------------------------------
   317             {
   327             {
   318             result = &iInfoArray[i];
   328             result = &iInfoArray[i];
   319             }
   329             }
   320         }
   330         }
   321     return result;
   331     return result;
       
   332     }
       
   333 
       
   334 // -----------------------------------------------------------------------------
       
   335 // CPsu2CopyToSimFieldInfoArray::RemoveUnSupportedTargetTypeFieldInfo
       
   336 // -----------------------------------------------------------------------------
       
   337 //
       
   338 void CPsu2CopyToSimFieldInfoArray::RemoveUnSupportedFieldInfo( const MVPbkFieldTypeList& aSupportedTypes )
       
   339     {
       
   340     // Check all the field info in the iInfoArray, if the target of the fieldinfo 
       
   341     // is not contained in the supportedTypes, Remove it from iInfoArray.
       
   342     TInt i = iInfoArray.Count() - 1;
       
   343     while( i >= 0 )
       
   344         {
       
   345         if( !aSupportedTypes.ContainsSame( iInfoArray[i].SimType()))
       
   346             {
       
   347             iInfoArray.Remove( i );
       
   348             }
       
   349         i --;
       
   350         }
   322     }
   351     }
   323     
   352     
   324 // -----------------------------------------------------------------------------
   353 // -----------------------------------------------------------------------------
   325 // CPsu2CopyToSimFieldInfoArray::SimNameType
   354 // CPsu2CopyToSimFieldInfoArray::SimNameType
   326 // -----------------------------------------------------------------------------
   355 // -----------------------------------------------------------------------------