|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation of detailsview plugin control data model |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CVIMPSTDETAILSVIEWLISTBOXMODEL_H |
|
20 #define CVIMPSTDETAILSVIEWLISTBOXMODEL_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <badesca.h> |
|
24 |
|
25 #include <MVPbkSingleContactOperationObserver.h> |
|
26 #include <MVPbkContactObserver.h> |
|
27 #include "tvimpstenums.h" |
|
28 #include "mvimpstdetailspresencehandler.h" |
|
29 #include "cvimpstdetailscontacthandler.h" |
|
30 // forward declaration |
|
31 class CEikListBox; |
|
32 class MVPbkStoreContact; |
|
33 class CVIMPSTFieldPropertyArray; |
|
34 class CVIMPSTFieldProperty; |
|
35 class MVIMPSTDetailsPresenceHandler; |
|
36 |
|
37 // constants declaraion |
|
38 const TInt KCacheGranularity = 4; |
|
39 const TInt KBufferSize = 256; |
|
40 _LIT(KTabLit, "\t"); |
|
41 _LIT(KSlash, "/"); |
|
42 _LIT(KAt, "@"); |
|
43 _LIT(KColon, ":"); |
|
44 _LIT(KSpace," "); |
|
45 |
|
46 /** |
|
47 * list box model class implemenation for list box items |
|
48 * @lib vimpstdetailsviewplugin.dll |
|
49 * @since S60 v5.0 |
|
50 */ |
|
51 class CVIMPSTDetailsViewListBoxModel : public CBase, |
|
52 public MDesCArray |
|
53 { |
|
54 |
|
55 public: |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @param aListBox, reference to the list box |
|
60 * @param aPresenceHandler, reference to presence handler |
|
61 * @param aFieldBuffer, pointer to a stream buffer |
|
62 * @return Pointer of CVIMPSTDetailsViewListBoxModel class |
|
63 * @since s60 v5.0 |
|
64 */ |
|
65 static CVIMPSTDetailsViewListBoxModel* NewL( CEikListBox& aListBox, |
|
66 MVIMPSTDetailsPresenceHandler& aPresenceHandler, |
|
67 HBufC8* aFieldBuffer ); |
|
68 /** |
|
69 * Destructor. |
|
70 * @since s60 v5.0 |
|
71 */ |
|
72 ~CVIMPSTDetailsViewListBoxModel(); |
|
73 |
|
74 |
|
75 /** |
|
76 * Get field index of focused list item |
|
77 * @return focus field index. |
|
78 * @since s60 v5.0 |
|
79 */ |
|
80 TInt FocusedFieldIndex(); |
|
81 |
|
82 /** |
|
83 * set field index focused list item |
|
84 * @param aIndex, field index. |
|
85 * @since s60 v5.0 |
|
86 */ |
|
87 void SetFocusedListIndex(TInt aIndex); |
|
88 |
|
89 /** |
|
90 * @return the focus field |
|
91 * @since s60 v5.0 |
|
92 */ |
|
93 CVIMPSTFieldProperty& FocusField(); |
|
94 |
|
95 /** |
|
96 * return the field array |
|
97 * @since s60 v5.0 |
|
98 */ |
|
99 CVIMPSTFieldPropertyArray& FieldsArray(); |
|
100 |
|
101 |
|
102 /** |
|
103 * From MDesCArray |
|
104 * (see details from header) |
|
105 * |
|
106 * @since S60 v5.0 |
|
107 */ |
|
108 TInt MdcaCount() const; |
|
109 |
|
110 |
|
111 /** |
|
112 * function for creating the presentation contact |
|
113 * @param aContactStore the contact store |
|
114 * @param aFocusFieldIndex focus field index |
|
115 * @since S60 v5.0 |
|
116 */ |
|
117 void CreateListPresentationL( MVPbkStoreContact& aContact, |
|
118 TInt aFocusFieldIndex,TDesC& aServiceName, TStoreType aStoreType); |
|
119 |
|
120 /** |
|
121 * Helper function for adding contact field items to |
|
122 * listbox data model. |
|
123 * |
|
124 * @since S60 v5.0 |
|
125 */ |
|
126 void AddFieldsDataL(); |
|
127 |
|
128 |
|
129 /** |
|
130 * set the empty text to list box |
|
131 * @since S60 v5.0 |
|
132 */ |
|
133 void SetEmptyTextsToListboxL(); |
|
134 |
|
135 |
|
136 /** |
|
137 * helper removing domain part |
|
138 * @param aId, id to use |
|
139 * @param aListHiding,ETrue if hide domain part |
|
140 * @since S60 v5.0 |
|
141 */ |
|
142 TPtrC DisplayId( const TDesC& aId, TBool aListHiding = EFalse ); |
|
143 |
|
144 |
|
145 /** |
|
146 * return the field count |
|
147 * @since S60 v5.0 |
|
148 */ |
|
149 TInt FieldsCount(); |
|
150 |
|
151 |
|
152 private: |
|
153 |
|
154 /** |
|
155 * From MDesCArray |
|
156 * (see details from header) |
|
157 * @param aIndex, index of item |
|
158 * @since S60 v5.0 |
|
159 */ |
|
160 TPtrC MdcaPoint(TInt aIndex) const; |
|
161 |
|
162 private: |
|
163 |
|
164 /** |
|
165 * default constructor |
|
166 * @param aListBox, reference to the list box |
|
167 * @param aPresenceHandler, reference to presence handler |
|
168 * @param aFieldBuffer, pointer to a stream buffer |
|
169 * @since S60 v5.0 |
|
170 */ |
|
171 CVIMPSTDetailsViewListBoxModel( |
|
172 CEikListBox& aListBox, |
|
173 MVIMPSTDetailsPresenceHandler& aPresenceHandler, |
|
174 HBufC8* aFieldBuffer ); |
|
175 /** |
|
176 * provide two phase construction |
|
177 * @since S60 v5.0 |
|
178 */ |
|
179 void ConstructL(); |
|
180 |
|
181 |
|
182 |
|
183 private: |
|
184 // data |
|
185 |
|
186 /** |
|
187 * not owns : Reference to listbox. |
|
188 */ |
|
189 CEikListBox& iListBox; |
|
190 |
|
191 /** |
|
192 * Not owned : reference to presence handler |
|
193 */ |
|
194 MVIMPSTDetailsPresenceHandler& iPresenceHandler; |
|
195 |
|
196 /** |
|
197 * Owns : Pointer to listbox data. |
|
198 */ |
|
199 CDesCArray* iTextCache; |
|
200 |
|
201 /** |
|
202 * Owns : Pointer to field array |
|
203 */ |
|
204 CVIMPSTFieldPropertyArray* iFieldArray; |
|
205 |
|
206 |
|
207 /** |
|
208 * Owns : Pointer to stream buffer |
|
209 */ |
|
210 HBufC8* iFieldBuffer; |
|
211 |
|
212 |
|
213 }; |
|
214 |
|
215 #endif // CVIMPSTDETAILSVIEWLISTBOXMODEL_H |
|
216 |
|
217 // End of File |