63
|
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 |
TInt ListIndex( TInt aPresentationIndex );
|
|
79 |
void ExternalizeL( RWriteStream& aStream ) const;
|
|
80 |
void InternalizeL( RReadStream& aStream );
|
|
81 |
void SetDataL(
|
|
82 |
const CPbk2PresentationContact& aContact,
|
|
83 |
const CPbk2IconArray* aIconArray );
|
|
84 |
void Reset();
|
|
85 |
TPtrC Text( CSpbContactDataModel::TTextTypes aType ) const;
|
|
86 |
TPtrC8 Data( CSpbContactDataModel::TBinaryTypes aType ) const;
|
|
87 |
void UpdateIconsL( const CPbk2IconArray& aIconArray );
|
|
88 |
void SetClipListBoxText( MPbk2ClipListBoxText* aClip );
|
|
89 |
MVPbkContactLink* ContactLink();
|
|
90 |
TBool IsEmpty();
|
|
91 |
|
|
92 |
public: // From MDesCArray
|
|
93 |
|
|
94 |
TInt MdcaCount() const;
|
|
95 |
TPtrC MdcaPoint(TInt aIndex) const;
|
|
96 |
|
|
97 |
private: // private construction
|
|
98 |
|
|
99 |
/**
|
|
100 |
* Constructor
|
|
101 |
*/
|
|
102 |
CSpbContactDataModelPrivate(
|
|
103 |
CVPbkContactManager& aCntManager,
|
|
104 |
CCoeEnv& aCoeEnv,
|
|
105 |
TInt aFieldTypeSelectorRes,
|
|
106 |
MPbk2ClipListBoxText* aClip );
|
|
107 |
|
|
108 |
/**
|
|
109 |
* 2nd constructor
|
|
110 |
*/
|
|
111 |
void ConstructL();
|
|
112 |
|
|
113 |
|
|
114 |
private: // new implementation
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Get label for contact field
|
|
118 |
*/
|
|
119 |
HBufC* GetLabelLC(const CPbk2PresentationContactField& aField);
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Should field aFieldType be hidden
|
|
123 |
*/
|
|
124 |
TBool IsHiddenField(const MVPbkFieldType* aFieldType);
|
|
125 |
|
|
126 |
/**
|
|
127 |
* Field type tester
|
|
128 |
*/
|
|
129 |
TBool IsFieldTypeL( const MVPbkFieldType& aFieldType, TInt aSelectorResId);
|
|
130 |
|
|
131 |
/**
|
|
132 |
* Format generic text -type field
|
|
133 |
*/
|
|
134 |
void HandleTextTypeFieldL(
|
|
135 |
const MVPbkFieldType& aFieldType,
|
|
136 |
const MVPbkContactFieldData& aFieldData,
|
|
137 |
CSpbContactDataModelRow* aRow );
|
|
138 |
|
|
139 |
/**
|
|
140 |
* Format Date -type field
|
|
141 |
*/
|
|
142 |
void HandleDateTimeTypeFieldL(
|
|
143 |
const MVPbkContactFieldData& aFieldData,
|
|
144 |
CSpbContactDataModelRow* aRow);
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Format URI -type field
|
|
148 |
*/
|
|
149 |
void HandleUriTypeFieldL(
|
|
150 |
const MVPbkFieldType& aFieldType,
|
|
151 |
const MVPbkContactFieldData& aFieldData,
|
|
152 |
CSpbContactDataModelRow* aRow);
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Expand column and line buffers to be sufficient for aRow
|
|
156 |
*/
|
|
157 |
void ExpandBuffersL(CSpbContactDataModelRow* aRow);
|
|
158 |
|
|
159 |
/**
|
|
160 |
* Expand column buffer to aRequiredLength
|
|
161 |
*
|
|
162 |
* @return new column buffer
|
|
163 |
*/
|
|
164 |
TPtr ExpandColumnBufferL(TInt aRequiredLength);
|
|
165 |
|
|
166 |
/**
|
|
167 |
*
|
|
168 |
*/
|
|
169 |
void ExternalizeDataL( RWriteStream& aStream, const TDesC16& aData ) const;
|
|
170 |
void ExternalizeDataL( RWriteStream& aStream, const TDesC8& aData ) const;
|
|
171 |
|
|
172 |
/**
|
|
173 |
*
|
|
174 |
*/
|
|
175 |
void InternalizeDataL( RReadStream& aStream, HBufC16*& aData );
|
|
176 |
void InternalizeDataL( RReadStream& aStream, HBufC8*& aData );
|
|
177 |
|
|
178 |
private: // data
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Reference to control environment.
|
|
182 |
* Not own.
|
|
183 |
*/
|
|
184 |
CCoeEnv& iCoeEnv;
|
|
185 |
|
|
186 |
/**
|
|
187 |
*
|
|
188 |
* Not own.
|
|
189 |
*/
|
|
190 |
CVPbkContactManager& iCntManager;
|
|
191 |
|
|
192 |
/**
|
|
193 |
* Reference to listbox clipper.
|
|
194 |
* Not own.
|
|
195 |
*/
|
|
196 |
MPbk2ClipListBoxText* iClip;
|
|
197 |
|
|
198 |
/**
|
|
199 |
* Text row array.
|
|
200 |
* Own.
|
|
201 |
*/
|
|
202 |
CArrayPtrFlat<CSpbContactDataModelRow> iRows;
|
|
203 |
|
|
204 |
/**
|
|
205 |
* Buffer for storing one formatted listbox row.
|
|
206 |
* Own.
|
|
207 |
*/
|
|
208 |
HBufC* iLineBuf;
|
|
209 |
|
|
210 |
/**
|
|
211 |
* Buffer for storing one formatted listbox column.
|
|
212 |
* Own.
|
|
213 |
*/
|
|
214 |
HBufC* iColumnBuf;
|
|
215 |
|
|
216 |
/**
|
|
217 |
* Own: Map current index to Presentation Contact index
|
|
218 |
*/
|
|
219 |
RArray<TInt> iListIndxToPresentationIndx;
|
|
220 |
|
|
221 |
/**
|
|
222 |
* Field type selector resource
|
|
223 |
*/
|
|
224 |
TInt iFieldTypeRes;
|
|
225 |
|
|
226 |
/**
|
|
227 |
* Own. Image data buffer
|
|
228 |
*/
|
|
229 |
HBufC8* iImageBuffer;
|
|
230 |
|
|
231 |
/**
|
|
232 |
* Own. Contact's image filename
|
|
233 |
*/
|
|
234 |
HBufC* iImageFileName;
|
|
235 |
|
|
236 |
/**
|
|
237 |
* Own. Contact's last name
|
|
238 |
*/
|
|
239 |
HBufC* iLastName;
|
|
240 |
|
|
241 |
/**
|
|
242 |
* Own. Contact's first name
|
|
243 |
*/
|
|
244 |
HBufC* iFirstName;
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Own. Current contact of model
|
|
248 |
*/
|
|
249 |
MVPbkContactLink* iContactLink;
|
|
250 |
};
|
|
251 |
|
|
252 |
#endif // CSPBCONTACTDATAMODELPRIVATE_H
|
|
253 |
|
|
254 |
// End of File
|