|
1 /* |
|
2 * Copyright (c) 2009 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: Contact model class for MyCard |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CSPBCONTACTDATAMODELPRIVATE_H |
|
19 #define CSPBCONTACTDATAMODELPRIVATE_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 #include "spbcontactdatamodel.h" |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MVPbkContactFieldData; |
|
28 class MVPbkBaseContactField; |
|
29 class MVPbkFieldType; |
|
30 class MVPbkContactLink; |
|
31 |
|
32 class MPbk2ClipListBoxText; |
|
33 class CPbk2PresentationContactField; |
|
34 class CPbk2PresentationContactFieldCollection; |
|
35 class CPbk2IconArray; |
|
36 class CPbk2PresentationContact; |
|
37 |
|
38 class CSpbContactDataModelRow; |
|
39 |
|
40 class CEikListBox; |
|
41 class CCoeEnv; |
|
42 |
|
43 /** |
|
44 * Listbox model class for MyCard details list |
|
45 * |
|
46 * |
|
47 * @lib pbk2spbcontentprovider.dll |
|
48 * @since S60 9.2 |
|
49 */ |
|
50 NONSHARABLE_CLASS( CSpbContactDataModelPrivate ) : public CBase, public MDesCArray |
|
51 { |
|
52 |
|
53 public: |
|
54 |
|
55 /** |
|
56 * Two-phased constructor. |
|
57 * |
|
58 * @param aCntManager |
|
59 * @param aCoeEnv UI control environment |
|
60 * @param aFieldTypeSelectorRes |
|
61 * @param aClip |
|
62 * @param aIconArray Listbox's icon array |
|
63 */ |
|
64 static CSpbContactDataModelPrivate* NewL( |
|
65 CVPbkContactManager& aCntManager, |
|
66 CCoeEnv& aCoeEnv, |
|
67 TInt aFieldTypeSelectorRes, |
|
68 MPbk2ClipListBoxText* aClip = NULL ); |
|
69 |
|
70 /** |
|
71 * Destructor. |
|
72 */ |
|
73 ~CSpbContactDataModelPrivate(); |
|
74 |
|
75 public: // "From" CSpbContactDataModel |
|
76 |
|
77 TInt PresentationFieldIndex( TInt aListIndex ); |
|
78 void ExternalizeL( RWriteStream& aStream ) const; |
|
79 void InternalizeL( RReadStream& aStream ); |
|
80 void SetDataL( |
|
81 const CPbk2PresentationContact& aContact, |
|
82 const CPbk2IconArray* aIconArray ); |
|
83 void Reset(); |
|
84 TPtrC Text( CSpbContactDataModel::TTextTypes aType ) const; |
|
85 TPtrC8 Data( CSpbContactDataModel::TBinaryTypes aType ) const; |
|
86 void UpdateIconsL( const CPbk2IconArray& aIconArray ); |
|
87 void SetClipListBoxText( MPbk2ClipListBoxText* aClip ); |
|
88 MVPbkContactLink* ContactLink(); |
|
89 TBool IsEmpty(); |
|
90 |
|
91 public: // From MDesCArray |
|
92 |
|
93 TInt MdcaCount() const; |
|
94 TPtrC MdcaPoint(TInt aIndex) const; |
|
95 |
|
96 private: // private construction |
|
97 |
|
98 /** |
|
99 * Constructor |
|
100 */ |
|
101 CSpbContactDataModelPrivate( |
|
102 CVPbkContactManager& aCntManager, |
|
103 CCoeEnv& aCoeEnv, |
|
104 TInt aFieldTypeSelectorRes, |
|
105 MPbk2ClipListBoxText* aClip ); |
|
106 |
|
107 /** |
|
108 * 2nd constructor |
|
109 */ |
|
110 void ConstructL(); |
|
111 |
|
112 |
|
113 private: // new implementation |
|
114 |
|
115 /** |
|
116 * Get label for contact field |
|
117 */ |
|
118 HBufC* GetLabelLC(const CPbk2PresentationContactField& aField); |
|
119 |
|
120 /** |
|
121 * Should field aFieldType be hidden |
|
122 */ |
|
123 TBool IsHiddenField(const MVPbkFieldType* aFieldType); |
|
124 |
|
125 /** |
|
126 * Field type tester |
|
127 */ |
|
128 TBool IsFieldTypeL( const MVPbkFieldType& aFieldType, TInt aSelectorResId); |
|
129 |
|
130 /** |
|
131 * Format generic text -type field |
|
132 */ |
|
133 void HandleTextTypeFieldL( |
|
134 const MVPbkFieldType& aFieldType, |
|
135 const MVPbkContactFieldData& aFieldData, |
|
136 CSpbContactDataModelRow* aRow ); |
|
137 |
|
138 /** |
|
139 * Format Date -type field |
|
140 */ |
|
141 void HandleDateTimeTypeFieldL( |
|
142 const MVPbkContactFieldData& aFieldData, |
|
143 CSpbContactDataModelRow* aRow); |
|
144 |
|
145 /** |
|
146 * Format URI -type field |
|
147 */ |
|
148 void HandleUriTypeFieldL( |
|
149 const MVPbkFieldType& aFieldType, |
|
150 const MVPbkContactFieldData& aFieldData, |
|
151 CSpbContactDataModelRow* aRow); |
|
152 |
|
153 /** |
|
154 * Expand column and line buffers to be sufficient for aRow |
|
155 */ |
|
156 void ExpandBuffersL(CSpbContactDataModelRow* aRow); |
|
157 |
|
158 /** |
|
159 * Expand column buffer to aRequiredLength |
|
160 * |
|
161 * @return new column buffer |
|
162 */ |
|
163 TPtr ExpandColumnBufferL(TInt aRequiredLength); |
|
164 |
|
165 /** |
|
166 * |
|
167 */ |
|
168 void ExternalizeDataL( RWriteStream& aStream, const TDesC16& aData ) const; |
|
169 void ExternalizeDataL( RWriteStream& aStream, const TDesC8& aData ) const; |
|
170 |
|
171 /** |
|
172 * |
|
173 */ |
|
174 void InternalizeDataL( RReadStream& aStream, HBufC16*& aData ); |
|
175 void InternalizeDataL( RReadStream& aStream, HBufC8*& aData ); |
|
176 |
|
177 private: // data |
|
178 |
|
179 /** |
|
180 * Reference to control environment. |
|
181 * Not own. |
|
182 */ |
|
183 CCoeEnv& iCoeEnv; |
|
184 |
|
185 /** |
|
186 * |
|
187 * Not own. |
|
188 */ |
|
189 CVPbkContactManager& iCntManager; |
|
190 |
|
191 /** |
|
192 * Reference to listbox clipper. |
|
193 * Not own. |
|
194 */ |
|
195 MPbk2ClipListBoxText* iClip; |
|
196 |
|
197 /** |
|
198 * Text row array. |
|
199 * Own. |
|
200 */ |
|
201 CArrayPtrFlat<CSpbContactDataModelRow> iRows; |
|
202 |
|
203 /** |
|
204 * Buffer for storing one formatted listbox row. |
|
205 * Own. |
|
206 */ |
|
207 HBufC* iLineBuf; |
|
208 |
|
209 /** |
|
210 * Buffer for storing one formatted listbox column. |
|
211 * Own. |
|
212 */ |
|
213 HBufC* iColumnBuf; |
|
214 |
|
215 /** |
|
216 * Own: Map current index to Presentation Contact index |
|
217 */ |
|
218 RArray<TInt> iListIndxToPresentationIndx; |
|
219 |
|
220 /** |
|
221 * Field type selector resource |
|
222 */ |
|
223 TInt iFieldTypeRes; |
|
224 |
|
225 /** |
|
226 * Own. Image data buffer |
|
227 */ |
|
228 HBufC8* iImageBuffer; |
|
229 |
|
230 /** |
|
231 * Own. Contact's image filename |
|
232 */ |
|
233 HBufC* iImageFileName; |
|
234 |
|
235 /** |
|
236 * Own. Contact's last name |
|
237 */ |
|
238 HBufC* iLastName; |
|
239 |
|
240 /** |
|
241 * Own. Contact's first name |
|
242 */ |
|
243 HBufC* iFirstName; |
|
244 |
|
245 /** |
|
246 * Own. Current contact of model |
|
247 */ |
|
248 MVPbkContactLink* iContactLink; |
|
249 }; |
|
250 |
|
251 #endif // CSPBCONTACTDATAMODELPRIVATE_H |
|
252 |
|
253 // End of File |