|
1 /* |
|
2 * Copyright (c) 2006-2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "TVPbkVCardFieldTypeMapping.h" |
|
20 |
|
21 #include <MVPbkFieldType.h> |
|
22 #include <VPbkUtil.h> |
|
23 |
|
24 #include <barsread.h> |
|
25 |
|
26 void TVPbkVCardFieldTypeMapping::InitializeL |
|
27 ( TResourceReader& aResReader, |
|
28 VPbkEngUtils::CTextStore& aTextStore ) |
|
29 { |
|
30 iVersitProperty.ReadFromResource( aResReader ); |
|
31 iNonVersitType = static_cast<TVPbkNonVersitFieldType>( aResReader.ReadUint8() ); |
|
32 |
|
33 if ( iVersitProperty.ExtensionName().Length() > 0 ) |
|
34 { |
|
35 // Store the extension name to the text store and set the property |
|
36 // pointer to the stored version. |
|
37 iVersitProperty.SetExtensionName( |
|
38 aTextStore.AddL( iVersitProperty.ExtensionName() ) ); |
|
39 } |
|
40 } |
|
41 |
|
42 const MVPbkFieldType* TVPbkVCardFieldTypeMapping::FindMatch |
|
43 ( const MVPbkFieldTypeList& aFieldTypeList ) const |
|
44 { |
|
45 const MVPbkFieldType* result = NULL; |
|
46 |
|
47 if (iVersitProperty.Name() != EVPbkVersitNameNone) |
|
48 { |
|
49 const TInt maxMatchPriority = aFieldTypeList.MaxMatchPriority(); |
|
50 for (TInt matchPriority = 0; matchPriority <= maxMatchPriority; ++matchPriority) |
|
51 { |
|
52 result = aFieldTypeList.FindMatch(iVersitProperty, matchPriority); |
|
53 if (result) |
|
54 { |
|
55 break; |
|
56 } |
|
57 } |
|
58 } |
|
59 |
|
60 if (!result) |
|
61 { |
|
62 if (iNonVersitType != EVPbkNonVersitTypeNone) |
|
63 { |
|
64 result = aFieldTypeList.FindMatch(iNonVersitType); |
|
65 } |
|
66 } |
|
67 |
|
68 return result; |
|
69 } |
|
70 |
|
71 // End of file |