equal
deleted
inserted
replaced
21 // INCLUDE FILES |
21 // INCLUDE FILES |
22 #include "CPsu2CopyToSimFieldInfoArray.h" |
22 #include "CPsu2CopyToSimFieldInfoArray.h" |
23 |
23 |
24 #include <RPbk2LocalizedResourceFile.h> |
24 #include <RPbk2LocalizedResourceFile.h> |
25 #include <Pbk2DataCaging.hrh> |
25 #include <Pbk2DataCaging.hrh> |
26 #include <pbk2usimuires.rsg> |
26 #include <Pbk2USimUIRes.rsg> |
27 #include <pbk2commonui.rsg> |
27 #include <Pbk2CommonUi.rsg> |
28 |
28 |
29 #include <TVPbkFieldTypeMapping.h> |
29 #include <TVPbkFieldTypeMapping.h> |
30 #include <CVPbkFieldTypeSelector.h> |
30 #include <CVPbkFieldTypeSelector.h> |
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 #include <featmgr.h> |
36 |
37 #include <vpbkeng.rsg> |
37 #include <VPbkEng.rsg> |
38 |
38 |
39 namespace |
39 namespace |
40 { |
40 { |
41 |
41 |
42 _LIT(KPsu2USimExtensionResFile, "Pbk2USimUIRes.rsc"); |
42 _LIT(KPsu2USimExtensionResFile, "Pbk2USimUIRes.rsc"); |
84 * @return The selector for the source field types. |
84 * @return The selector for the source field types. |
85 */ |
85 */ |
86 MVPbkFieldTypeSelector& SourceTypeSelector() const; |
86 MVPbkFieldTypeSelector& SourceTypeSelector() const; |
87 |
87 |
88 /** |
88 /** |
89 * Returns the resource id (vpbkeng.rsg) of the target field type. |
89 * Returns the resource id (VPbkEng.rsg) of the target field type. |
90 * |
90 * |
91 * @return the resource id (vpbkeng.rsg) of the target field type. |
91 * @return the resource id (VPbkEng.rsg) of the target field type. |
92 */ |
92 */ |
93 TInt TargetFieldtypeResId() const; |
93 TInt TargetFieldtypeResId() const; |
94 |
94 |
95 /** |
95 /** |
96 * Returns flags defined Pbk2UsimUi.hrh |
96 * Returns flags defined Pbk2UsimUi.hrh |
110 const MVPbkFieldTypeList& aMasterFieldTypeList ); |
110 const MVPbkFieldTypeList& aMasterFieldTypeList ); |
111 |
111 |
112 private: // Data |
112 private: // Data |
113 /// Own: source field type selector |
113 /// Own: source field type selector |
114 CVPbkFieldTypeSelector* iSourceTypeSelector; |
114 CVPbkFieldTypeSelector* iSourceTypeSelector; |
115 /// Own: target field type resource id (vpbkeng.rsg) |
115 /// Own: target field type resource id (VPbkEng.rsg) |
116 TInt iTargetFieldTypeResId; |
116 TInt iTargetFieldTypeResId; |
117 /// Flags from Pbk2UsimUi.hrh |
117 /// Flags from Pbk2UsimUi.hrh |
118 TUint8 iFlags; |
118 TUint8 iFlags; |
119 /// See TPsu2ErrorCode |
119 /// See TPsu2ErrorCode |
120 TUint8 iBlockingError; |
120 TUint8 iBlockingError; |
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 FeatureManager::InitializeLibL(); |
242 |
243 TResourceReader reader; |
243 TResourceReader reader; |
244 if( !FeatureManager::FeatureSupported( |
244 reader.SetBuffer( |
245 KFeatureIdFfTdClmcontactreplicationfromphonebooktousimcard ) ) |
245 resFile.AllocReadLC( R_PSU2_COPY_TO_SIM_FIELDTYPE_MAPPINGS ) ); |
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 } |
|
255 |
246 |
256 // Go through all mappings in resource and create a mapping array |
247 // Go through all mappings in resource and create a mapping array |
257 const TInt count = reader.ReadInt16(); |
248 const TInt count = reader.ReadInt16(); |
258 for ( TInt i = 0; i < count; ++i ) |
249 for ( TInt i = 0; i < count; ++i ) |
259 { |
250 { |
306 CPsu2CopyToSimFieldInfoArray::~CPsu2CopyToSimFieldInfoArray() |
297 CPsu2CopyToSimFieldInfoArray::~CPsu2CopyToSimFieldInfoArray() |
307 { |
298 { |
308 iInfoArray.Close(); |
299 iInfoArray.Close(); |
309 iMatchedTypes.Close(); |
300 iMatchedTypes.Close(); |
310 delete iNumberKeyMap; |
301 delete iNumberKeyMap; |
311 FeatureManager::UnInitializeLib(); |
|
312 } |
302 } |
313 |
303 |
314 // ----------------------------------------------------------------------------- |
304 // ----------------------------------------------------------------------------- |
315 // CPsu2CopyToSimFieldInfoArray::FindInfoForSourceType |
305 // CPsu2CopyToSimFieldInfoArray::FindInfoForSourceType |
316 // ----------------------------------------------------------------------------- |
306 // ----------------------------------------------------------------------------- |
327 { |
317 { |
328 result = &iInfoArray[i]; |
318 result = &iInfoArray[i]; |
329 } |
319 } |
330 } |
320 } |
331 return result; |
321 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 } |
|
351 } |
322 } |
352 |
323 |
353 // ----------------------------------------------------------------------------- |
324 // ----------------------------------------------------------------------------- |
354 // CPsu2CopyToSimFieldInfoArray::SimNameType |
325 // CPsu2CopyToSimFieldInfoArray::SimNameType |
355 // ----------------------------------------------------------------------------- |
326 // ----------------------------------------------------------------------------- |