|
1 /* |
|
2 * Copyright (c) 2002-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: A class that reads an array of PSU2_COPY_TO_SIM_FIELDTYPE_INFO |
|
15 * items |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CPSU2COPYTOSIMFIELDINFOARRAY_H |
|
22 #define CPSU2COPYTOSIMFIELDINFOARRAY_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include "Pbk2USimUI.hrh" |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class TResourceReader; |
|
30 class MVPbkFieldType; |
|
31 class MVPbkFieldTypeList; |
|
32 class RFs; |
|
33 class CPsu2CopyToSimFieldtypeMapping; |
|
34 |
|
35 // CLASS DECLARATION |
|
36 |
|
37 class TPsu2CopyToSimFieldInfo |
|
38 { |
|
39 public: // Constructors and destructor |
|
40 /** |
|
41 * C++ constructor |
|
42 * |
|
43 * @param aSourceType Source field type |
|
44 * @param aSimType Sim field type |
|
45 * @param aFlags Flags |
|
46 * @param aBlockingError Error code |
|
47 */ |
|
48 TPsu2CopyToSimFieldInfo( const MVPbkFieldType& aSourceType, |
|
49 const MVPbkFieldType& aSimType, TUint8 aFlags, |
|
50 TUint8 aBlockingError ); |
|
51 |
|
52 public: // New functions |
|
53 |
|
54 /** |
|
55 * @return the field type that has a conversion to the sim type |
|
56 */ |
|
57 inline const MVPbkFieldType& SourceType() const; |
|
58 |
|
59 /** |
|
60 * @return the sim type that must be used before saving to sim |
|
61 */ |
|
62 inline const MVPbkFieldType& SimType() const; |
|
63 |
|
64 /** |
|
65 * @return ETrue if field can be truncated |
|
66 */ |
|
67 inline TBool TruncationAllowed() const; |
|
68 |
|
69 /** |
|
70 * @param aBlockingError an error that is compared |
|
71 * @return ETrue if aBlockingError means |
|
72 */ |
|
73 inline TBool BlockedByError( TPsu2ErrorCode aBlockingError ) const; |
|
74 |
|
75 private: // Data |
|
76 /// Ref: a field type that possible can be copied to the sim |
|
77 const MVPbkFieldType& iSourceType; |
|
78 /// Ref: the sim type for the iFieldType |
|
79 const MVPbkFieldType& iSimType; |
|
80 /// Field info flags |
|
81 TUint8 iFlags; |
|
82 /// A saving time error that tells that iSimType is not possible |
|
83 /// to save. See TPsu2ErrorCode |
|
84 TUint8 iBlockingError; |
|
85 }; |
|
86 |
|
87 /** |
|
88 * A class that reads an array of PSU2_COPY_TO_SIM_FIELDTYPE_INFO items |
|
89 * |
|
90 */ |
|
91 class CPsu2CopyToSimFieldInfoArray : public CBase |
|
92 { |
|
93 public: // Constructors and destructor |
|
94 |
|
95 /** |
|
96 * Two-phased constructor. |
|
97 * @param aMasterFieldTypeList list of all field types |
|
98 * @param aFs an open file system session for reading |
|
99 * resources |
|
100 * @return a new instance of this class |
|
101 */ |
|
102 static CPsu2CopyToSimFieldInfoArray* NewL( |
|
103 const MVPbkFieldTypeList& aMasterFieldTypeList, |
|
104 RFs& aFs ); |
|
105 |
|
106 /** |
|
107 * Destructor. |
|
108 */ |
|
109 virtual ~CPsu2CopyToSimFieldInfoArray(); |
|
110 |
|
111 public: // New functions |
|
112 |
|
113 /** |
|
114 * @return the number of items in the array |
|
115 */ |
|
116 inline TInt Count() const; |
|
117 |
|
118 /** |
|
119 * @param aIndex the index of the item in the array |
|
120 * @return a reference to item in given index |
|
121 */ |
|
122 inline const TPsu2CopyToSimFieldInfo& operator[](TInt aIndex) const; |
|
123 |
|
124 |
|
125 /** |
|
126 * @param aSourceType the source field type |
|
127 * @return the info that for the aSourceType or NULL |
|
128 */ |
|
129 const TPsu2CopyToSimFieldInfo* FindInfoForSourceType( |
|
130 const MVPbkFieldType& aSourceType ); |
|
131 |
|
132 /** |
|
133 * @return the field type of the sim name field |
|
134 */ |
|
135 const MVPbkFieldType& SimNameType() const; |
|
136 |
|
137 /** |
|
138 * @return the field type of SIM reading field |
|
139 */ |
|
140 const MVPbkFieldType& LastNameReadingType() const; |
|
141 |
|
142 /** |
|
143 * @param aSourceType a type of the source contact field that has |
|
144 * a conversion to sim type. |
|
145 * @return the corresponding sim type or NULL |
|
146 */ |
|
147 const MVPbkFieldType* ConvertToSimType(const MVPbkFieldType& aSourceType); |
|
148 |
|
149 /** |
|
150 * @return ETrue if the fields of given field type must be truncated |
|
151 * when data is too long |
|
152 */ |
|
153 TBool TruncationAllowed( const MVPbkFieldType& aSimType ); |
|
154 |
|
155 /** |
|
156 * @return The standard number keymap |
|
157 */ |
|
158 const TDesC& NumberKeyMap() const; |
|
159 |
|
160 private: |
|
161 |
|
162 /** |
|
163 * C++ default constructor. |
|
164 */ |
|
165 CPsu2CopyToSimFieldInfoArray( |
|
166 const MVPbkFieldTypeList& aMasterFieldTypeList); |
|
167 |
|
168 /** |
|
169 * By default Symbian 2nd phase constructor is private. |
|
170 */ |
|
171 void ConstructL( RFs& aFs ); |
|
172 void CreateMappingsL( CPsu2CopyToSimFieldtypeMapping& aCMapping ); |
|
173 |
|
174 private: // Data |
|
175 /// The list of all types |
|
176 const MVPbkFieldTypeList& iMasterFieldTypeList; |
|
177 /// Ref: the sim name field type |
|
178 const MVPbkFieldType* iSimNameType; |
|
179 /// Ref: the sim name field type |
|
180 const MVPbkFieldType* iSimReadingType; |
|
181 /// An array of field infos |
|
182 RArray<TPsu2CopyToSimFieldInfo> iInfoArray; |
|
183 /// An array for finding types that caused an error |
|
184 RPointerArray<const MVPbkFieldType> iMatchedTypes; |
|
185 /// Own: valid characters for number key map |
|
186 HBufC* iNumberKeyMap; |
|
187 }; |
|
188 |
|
189 // INLINE FUNCTIONS |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // TPsu2CopyToSimFieldInfo::SourceType |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 inline const MVPbkFieldType& TPsu2CopyToSimFieldInfo::SourceType() const |
|
196 { |
|
197 return iSourceType; |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // TPsu2CopyToSimFieldInfo::SimType |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 inline const MVPbkFieldType& TPsu2CopyToSimFieldInfo::SimType() const |
|
205 { |
|
206 return iSimType; |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // TPsu2CopyToSimFieldInfo::TruncationAllowed |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 inline TBool TPsu2CopyToSimFieldInfo::TruncationAllowed() const |
|
214 { |
|
215 return iFlags & KPsu2AllowedToTruncate; |
|
216 } |
|
217 |
|
218 // ----------------------------------------------------------------------------- |
|
219 // TPsu2CopyToSimFieldInfo::BlockedByError |
|
220 // ----------------------------------------------------------------------------- |
|
221 // |
|
222 inline TBool TPsu2CopyToSimFieldInfo::BlockedByError( |
|
223 TPsu2ErrorCode aBlockingError ) const |
|
224 { |
|
225 return iBlockingError == aBlockingError; |
|
226 } |
|
227 |
|
228 // ----------------------------------------------------------------------------- |
|
229 // CPsu2CopyToSimFieldInfoArray::Count |
|
230 // ----------------------------------------------------------------------------- |
|
231 // |
|
232 inline TInt CPsu2CopyToSimFieldInfoArray::Count() const |
|
233 { |
|
234 return iInfoArray.Count(); |
|
235 } |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
|
238 // CPsu2CopyToSimFieldInfoArray::operator[] |
|
239 // ----------------------------------------------------------------------------- |
|
240 // |
|
241 inline const TPsu2CopyToSimFieldInfo& |
|
242 CPsu2CopyToSimFieldInfoArray::operator[](TInt aIndex) const |
|
243 { |
|
244 return iInfoArray[aIndex]; |
|
245 } |
|
246 #endif // CPSU2COPYTOSIMFIELDINFOARRAY_H |
|
247 |
|
248 // End of File |