williamr@2
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
4 |
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __CNTVIEW_H__
|
williamr@2
|
17 |
#define __CNTVIEW_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <cntviewbase.h>
|
williamr@2
|
20 |
|
williamr@2
|
21 |
/** The maximum length of the string used by contact sub view ranges to find the
|
williamr@2
|
22 |
item at the upper or lower limit of the range.
|
williamr@2
|
23 |
|
williamr@2
|
24 |
In practice, only the first character in the string is used and this value
|
williamr@2
|
25 |
is ignored. */
|
williamr@2
|
26 |
const TInt KMaxBoundaryMatchLength=8;
|
williamr@2
|
27 |
|
williamr@2
|
28 |
class CContactGroupView: public CContactViewBase, public MContactViewObserver
|
williamr@2
|
29 |
/** Provides a view of a group of contact items.
|
williamr@2
|
30 |
|
williamr@2
|
31 |
The view uses an underlying view. For items to appear in the group view, they
|
williamr@2
|
32 |
must exist in the underlying view.
|
williamr@2
|
33 |
|
williamr@2
|
34 |
The TGroupType enumeration defines whether the view displays items that belong
|
williamr@2
|
35 |
to the group, items that do not belong to the group, or items that do not
|
williamr@2
|
36 |
belong to any group.
|
williamr@2
|
37 |
|
williamr@2
|
38 |
The group view observes its underlying view so that it is kept up to date
|
williamr@2
|
39 |
if the contents of the underlying view change.
|
williamr@2
|
40 |
|
williamr@2
|
41 |
The group can be identified by a contact item ID or by a label, e.g. "family",
|
williamr@2
|
42 |
or "colleagues".
|
williamr@2
|
43 |
|
williamr@2
|
44 |
@see CContactGroup
|
williamr@2
|
45 |
@publishedAll
|
williamr@2
|
46 |
@released
|
williamr@2
|
47 |
*/
|
williamr@2
|
48 |
{
|
williamr@2
|
49 |
friend class CGroupViewTester;
|
williamr@2
|
50 |
public:
|
williamr@2
|
51 |
/** Defines the types of contact group view. */
|
williamr@2
|
52 |
enum TGroupType
|
williamr@2
|
53 |
{
|
williamr@2
|
54 |
/** The view contains contact items in the group. */
|
williamr@2
|
55 |
EShowContactsInGroup,
|
williamr@2
|
56 |
/** The view contains contact items not in the group. */
|
williamr@2
|
57 |
EShowContactsNotInGroup,
|
williamr@2
|
58 |
/** The view contains contact items not in any group. */
|
williamr@2
|
59 |
EShowContactsNotInAnyGroup
|
williamr@2
|
60 |
};
|
williamr@2
|
61 |
public:
|
williamr@2
|
62 |
IMPORT_C static CContactGroupView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver,const TContactItemId aGroupId,const TGroupType aGroupType);
|
williamr@2
|
63 |
IMPORT_C static CContactGroupView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver, const TDesC& aGroupName,const TGroupType aGroupType);
|
williamr@2
|
64 |
|
williamr@2
|
65 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
66 |
IMPORT_C static CContactGroupView* NewL(CContactViewBase& aView,const CContactDatabase& aDb, MContactViewObserver& aObserver,const TContactItemId aGroupId,const TGroupType aGroupType);
|
williamr@2
|
67 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
68 |
IMPORT_C static CContactGroupView* NewL(CContactViewBase& aView,const CContactDatabase& aDb, MContactViewObserver& aObserver, const TDesC& aGroupName,const TGroupType aGroupType);
|
williamr@2
|
69 |
//All CContactViewBase derived classes in public headers,
|
williamr@2
|
70 |
//should mandatorily implement this reserved function.
|
williamr@2
|
71 |
TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
|
williamr@2
|
72 |
~CContactGroupView();
|
williamr@2
|
73 |
public: // From CContactViewBase
|
williamr@2
|
74 |
TContactItemId AtL(TInt aIndex) const;
|
williamr@2
|
75 |
TInt CountL() const;
|
williamr@2
|
76 |
TInt FindL(TContactItemId aId) const;
|
williamr@2
|
77 |
HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
|
williamr@2
|
78 |
const CViewContact& ContactAtL(TInt aIndex) const;
|
williamr@2
|
79 |
TContactViewPreferences ContactViewPreferences();
|
williamr@2
|
80 |
const RContactViewSortOrder& SortOrderL() const;
|
williamr@2
|
81 |
protected:
|
williamr@2
|
82 |
IMPORT_C virtual void UpdateGroupViewL();
|
williamr@2
|
83 |
private: // From MContactViewObserver.
|
williamr@2
|
84 |
void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
|
williamr@2
|
85 |
private:
|
williamr@2
|
86 |
void ConstructL(MContactViewObserver& aObserver,TContactItemId aGroupId);
|
williamr@2
|
87 |
void UpdateForContactsInGroupL();
|
williamr@2
|
88 |
void UpdateForContactsNotInThisGroupL();
|
williamr@2
|
89 |
void UpdateForUnfiledContactsL();
|
williamr@2
|
90 |
void UpdateForContactListL(const CContactIdArray* aArray);
|
williamr@2
|
91 |
TContactItemId GetGroupIdbyNameL(const TDesC& aGroupName);
|
williamr@2
|
92 |
TBool HandleRemoveEventL(TContactViewEvent& aEvent);
|
williamr@2
|
93 |
TBool HandleAddEventL(TContactViewEvent& aEvent);
|
williamr@2
|
94 |
TBool HandleAddEventForUnfiledContactsL(const TContactViewEvent& aEvent );
|
williamr@2
|
95 |
static TInt CompareMappingsL(const TContactIdWithMapping& aFirst,const TContactIdWithMapping& aSecond);
|
williamr@2
|
96 |
TInt static CompareIndexesAllowingDuplicates(const TContactIdWithMapping& aFirst, const TContactIdWithMapping& aSecond);
|
williamr@2
|
97 |
private:
|
williamr@2
|
98 |
CContactGroupView(const CContactDatabase& aDb,CContactViewBase& aView,TGroupType aGroupType);
|
williamr@2
|
99 |
void UpdateMappingsL();
|
williamr@2
|
100 |
void NotifyRemovedMembersL(const CContactIdArray* aArray);
|
williamr@2
|
101 |
private:
|
williamr@2
|
102 |
RArray<TContactIdWithMapping> iGroupContacts;
|
williamr@2
|
103 |
TContactItemId iGroupId;
|
williamr@2
|
104 |
CContactViewBase& iView;
|
williamr@2
|
105 |
TGroupType iGroupType;
|
williamr@2
|
106 |
TUint iClassVersion; //version class - used for TContactViewEvent dispatching
|
williamr@2
|
107 |
};
|
williamr@2
|
108 |
|
williamr@2
|
109 |
|
williamr@2
|
110 |
class CContactFindView: public CContactViewBase, public MContactViewObserver
|
williamr@2
|
111 |
/** Provides a view of an existing CContactViewBase-derived object, populated using
|
williamr@2
|
112 |
search criteria.
|
williamr@2
|
113 |
|
williamr@2
|
114 |
The find view only contains contact items from the underlying view that match
|
williamr@2
|
115 |
the search criteria.
|
williamr@2
|
116 |
|
williamr@2
|
117 |
The find view observes its underlying view so that it is kept up to date if
|
williamr@2
|
118 |
the contents of the underlying view change.
|
williamr@2
|
119 |
|
williamr@2
|
120 |
The search criteria (one or more words) are held in an MDesCArray object.
|
williamr@2
|
121 |
The fields involved in the search are those that have been used to sort the
|
williamr@2
|
122 |
underlying view.
|
williamr@2
|
123 |
@publishedAll
|
williamr@2
|
124 |
@released
|
williamr@2
|
125 |
*/
|
williamr@2
|
126 |
{
|
williamr@2
|
127 |
public:
|
williamr@2
|
128 |
IMPORT_C static CContactFindView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver,MDesCArray* aFindWords);
|
williamr@2
|
129 |
IMPORT_C static CContactFindView* NewL(const CContactDatabase& aDb,CContactViewBase& aView,MContactViewObserver& aObserver,MDesCArray* aFindWords, TSearchType aSearchType);
|
williamr@2
|
130 |
|
williamr@2
|
131 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
132 |
IMPORT_C static CContactFindView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,MDesCArray* aFindWords);
|
williamr@2
|
133 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
134 |
IMPORT_C static CContactFindView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,MDesCArray* aFindWords, TSearchType aSearchType);
|
williamr@2
|
135 |
|
williamr@2
|
136 |
~CContactFindView();
|
williamr@2
|
137 |
public: // From CContactViewBase
|
williamr@2
|
138 |
TContactItemId AtL(TInt aIndex) const;
|
williamr@2
|
139 |
TInt CountL() const;
|
williamr@2
|
140 |
TInt FindL(TContactItemId aId) const;
|
williamr@2
|
141 |
HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
|
williamr@2
|
142 |
const CViewContact& ContactAtL(TInt aIndex) const;
|
williamr@2
|
143 |
TContactViewPreferences ContactViewPreferences();
|
williamr@2
|
144 |
const RContactViewSortOrder& SortOrderL() const;
|
williamr@2
|
145 |
protected:
|
williamr@2
|
146 |
IMPORT_C virtual void UpdateFindViewL();
|
williamr@2
|
147 |
public:
|
williamr@2
|
148 |
IMPORT_C void RefineFindViewL(MDesCArray* aFindWords);
|
williamr@2
|
149 |
//All CContactViewBase derived classes in public headers,
|
williamr@2
|
150 |
//should mandatorily implement this reserved function.
|
williamr@2
|
151 |
TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
|
williamr@2
|
152 |
private: // From MContactViewObserver.
|
williamr@2
|
153 |
virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
|
williamr@2
|
154 |
private:
|
williamr@2
|
155 |
void ConstructL(MContactViewObserver& aObserver,MDesCArray* aFindWords);
|
williamr@2
|
156 |
void DeleteFindContacts();
|
williamr@2
|
157 |
void TightenFindViewCriteriaL();
|
williamr@2
|
158 |
void HandleRemoveEventL(TContactViewEvent& aEvent);
|
williamr@2
|
159 |
void HandleAddEventL(TContactViewEvent& aEvent);
|
williamr@2
|
160 |
void CopyNewFindWordsL(MDesCArray* aFindWords);
|
williamr@2
|
161 |
void DestroyFindWordsArray();
|
williamr@2
|
162 |
TInt InsertContact(const CViewContact* aNewContact);
|
williamr@2
|
163 |
private:
|
williamr@2
|
164 |
CContactFindView(const CContactDatabase& aDb,CContactViewBase& aView, TSearchType aSearchType);
|
williamr@2
|
165 |
private:
|
williamr@2
|
166 |
RPointerArray<CViewContact> iFindContacts;
|
williamr@2
|
167 |
CPtrCArray* iFindWords;
|
williamr@2
|
168 |
CContactViewBase& iView;
|
williamr@2
|
169 |
const TSearchType iSearchType;
|
williamr@2
|
170 |
TUint iClassVersion; //version class - used for TContactViewEvent dispatching
|
williamr@2
|
171 |
};
|
williamr@2
|
172 |
|
williamr@2
|
173 |
|
williamr@2
|
174 |
class CContactFilteredView : public CContactViewBase, public MContactViewObserver
|
williamr@2
|
175 |
/** Provides a filtered view over an existing CContactViewBase derived object.
|
williamr@2
|
176 |
|
williamr@2
|
177 |
For example, it might provide a view containing only contacts that have an
|
williamr@2
|
178 |
email address. For efficiency reasons there are a limited set of filters available
|
williamr@2
|
179 |
(defined in CContactDatabase::TContactViewFilter).
|
williamr@2
|
180 |
|
williamr@2
|
181 |
The filtered view observes its underlying view so that it is kept up to date
|
williamr@2
|
182 |
if the contents of the underlying view change. It will, in turn, notify its
|
williamr@2
|
183 |
observers.
|
williamr@2
|
184 |
|
williamr@2
|
185 |
Filters only apply to non-hidden contact fields with content.
|
williamr@2
|
186 |
@publishedAll
|
williamr@2
|
187 |
@released
|
williamr@2
|
188 |
*/
|
williamr@2
|
189 |
{
|
williamr@2
|
190 |
public:
|
williamr@2
|
191 |
IMPORT_C static CContactFilteredView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,CContactViewBase& aView,TInt aFilter);
|
williamr@2
|
192 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
193 |
IMPORT_C static CContactFilteredView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,TInt aFilter);
|
williamr@2
|
194 |
|
williamr@2
|
195 |
//All CContactViewBase derived classes in public headers,
|
williamr@2
|
196 |
//should mandatorily implement this reserved function.
|
williamr@2
|
197 |
TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
|
williamr@2
|
198 |
~CContactFilteredView();
|
williamr@2
|
199 |
public: // From CContactViewBase.
|
williamr@2
|
200 |
TContactItemId AtL(TInt aIndex) const;
|
williamr@2
|
201 |
TInt CountL() const;
|
williamr@2
|
202 |
TInt FindL(TContactItemId aId) const;
|
williamr@2
|
203 |
HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
|
williamr@2
|
204 |
const CViewContact& ContactAtL(TInt aIndex) const;
|
williamr@2
|
205 |
TContactViewPreferences ContactViewPreferences();
|
williamr@2
|
206 |
const RContactViewSortOrder& SortOrderL() const;
|
williamr@2
|
207 |
virtual void ContactsMatchingCriteriaL(const MDesCArray& aFindWords,RPointerArray<CViewContact>& aMatchedContacts);
|
williamr@2
|
208 |
virtual void ContactsMatchingPrefixL(const MDesCArray& aFindWords, RPointerArray<CViewContact>& aMatchedContacts);
|
williamr@2
|
209 |
private: // From MContactViewObserver.
|
williamr@2
|
210 |
virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
|
williamr@2
|
211 |
private:
|
williamr@2
|
212 |
CContactFilteredView(const CContactDatabase& aDb,TInt aFilter,CContactViewBase& aView);
|
williamr@2
|
213 |
void ConstructL(MContactViewObserver& aObserver);
|
williamr@2
|
214 |
void CreateFilteredIdArray();
|
williamr@2
|
215 |
void UpdateFilteredIdArrayL(TContactViewEvent& aEvent, TBool& aViewModified);
|
williamr@2
|
216 |
void HandleAddEventL(TContactViewEvent& aEvent, TBool& aViewModified);
|
williamr@2
|
217 |
void HandleRemoveEventL(TContactViewEvent& aEvent, TBool& aViewModified);
|
williamr@2
|
218 |
TInt BinaryInsertL(TContactIdWithMapping aId);
|
williamr@2
|
219 |
static TInt FilterCallBack(TAny* aSelf);
|
williamr@2
|
220 |
static TBool CompareMappings(const TContactIdWithMapping& aFirst,const TContactIdWithMapping& aSecond);
|
williamr@2
|
221 |
void FilterResultsArray(RPointerArray<CViewContact>& aMatchedContacts);
|
williamr@2
|
222 |
TInt DoFilterIncrementL();
|
williamr@2
|
223 |
void UpdateMappingsL();
|
williamr@2
|
224 |
private:
|
williamr@2
|
225 |
const TInt iFilter;
|
williamr@2
|
226 |
CContactViewBase& iView;
|
williamr@2
|
227 |
RArray<TContactIdWithMapping> iFilteredIdArray;
|
williamr@2
|
228 |
TUint iClassVersion; //version class - used for TContactViewEvent dispatching
|
williamr@2
|
229 |
};
|
williamr@2
|
230 |
|
williamr@2
|
231 |
|
williamr@2
|
232 |
class CContactViewRangeBase : public CBase
|
williamr@2
|
233 |
/** The abstract base class for all contact view range classes.
|
williamr@2
|
234 |
|
williamr@2
|
235 |
Range classes are used by contact sub views to specify the upper and lower
|
williamr@2
|
236 |
range boundaries and for searching their underlying view.
|
williamr@2
|
237 |
|
williamr@2
|
238 |
@see CContactSubView
|
williamr@2
|
239 |
@publishedAll
|
williamr@2
|
240 |
@released
|
williamr@2
|
241 |
*/
|
williamr@2
|
242 |
{
|
williamr@2
|
243 |
public:
|
williamr@2
|
244 |
/** Defines the range criteria. */
|
williamr@2
|
245 |
enum TCriteria
|
williamr@2
|
246 |
{
|
williamr@2
|
247 |
/** Less than. */
|
williamr@2
|
248 |
ELessThan,
|
williamr@2
|
249 |
/** Less than or equal to. */
|
williamr@2
|
250 |
ELessThanOrEqualTo,
|
williamr@2
|
251 |
/** Greater than. */
|
williamr@2
|
252 |
EGreaterThan,
|
williamr@2
|
253 |
/** Greater than or equal to. */
|
williamr@2
|
254 |
EGreaterThanOrEqualTo
|
williamr@2
|
255 |
};
|
williamr@2
|
256 |
public:
|
williamr@2
|
257 |
~CContactViewRangeBase();
|
williamr@2
|
258 |
inline TInt LowIndex() const;
|
williamr@2
|
259 |
inline TInt HighIndex() const;
|
williamr@2
|
260 |
/** Sets the iLow and iHigh members. */
|
williamr@2
|
261 |
virtual void SetL()=0;
|
williamr@2
|
262 |
IMPORT_C TBool IndicesValid() const;
|
williamr@2
|
263 |
protected:
|
williamr@2
|
264 |
CContactViewRangeBase(const CContactViewBase& aView);
|
williamr@2
|
265 |
void ConstructL();
|
williamr@2
|
266 |
TInt FindIndexL(const TDesC& aMatch,TCriteria aCriteria) const;
|
williamr@2
|
267 |
TBool MatchesCriteriaL(TCriteria aCriteria,const TDesC& aMatch,TInt aIndex) const;
|
williamr@2
|
268 |
void ValidateIndices();
|
williamr@2
|
269 |
protected:
|
williamr@2
|
270 |
/** The sub view's underlying view. */
|
williamr@2
|
271 |
const CContactViewBase& iView;
|
williamr@2
|
272 |
/** The index into the sub view's underlying view of the item at the lower limit
|
williamr@2
|
273 |
of the range. */
|
williamr@2
|
274 |
TInt iLow;
|
williamr@2
|
275 |
/** The index into the sub view's underlying view of the item at the upper limit
|
williamr@2
|
276 |
of the range. */
|
williamr@2
|
277 |
TInt iHigh;
|
williamr@2
|
278 |
//ChrisD: contain by value not ptr
|
williamr@2
|
279 |
/** The collation method used to sort the strings.
|
williamr@2
|
280 |
|
williamr@2
|
281 |
By default, this is the standard collation method for the current locale. */
|
williamr@2
|
282 |
TCollationMethod* iCollateMethod;
|
williamr@2
|
283 |
};
|
williamr@2
|
284 |
|
williamr@2
|
285 |
|
williamr@2
|
286 |
class CContactViewRange : public CContactViewRangeBase
|
williamr@2
|
287 |
/** A sub view range with both a lower and upper limit.
|
williamr@2
|
288 |
|
williamr@2
|
289 |
This is used by sub views when lower and upper boundary criteria are specified.
|
williamr@2
|
290 |
|
williamr@2
|
291 |
@see CContactSubView
|
williamr@2
|
292 |
@publishedAll
|
williamr@2
|
293 |
@released
|
williamr@2
|
294 |
*/
|
williamr@2
|
295 |
{
|
williamr@2
|
296 |
public:
|
williamr@2
|
297 |
~CContactViewRange();
|
williamr@2
|
298 |
IMPORT_C static CContactViewRange* NewL(const CContactViewBase& aView,const TDesC& aLowMatch,TCriteria aLowCriteria,const TDesC& aHighMatch,TCriteria aHighCriteria);
|
williamr@2
|
299 |
private: // From CContactViewRangeBase.
|
williamr@2
|
300 |
void SetL();
|
williamr@2
|
301 |
private:
|
williamr@2
|
302 |
CContactViewRange(const CContactViewBase& aView,const TDesC& aLowMatch,TCriteria aLowCriteria,const TDesC& aHighMatch,TCriteria aHighCriteria);
|
williamr@2
|
303 |
void ConstructL();
|
williamr@2
|
304 |
private:
|
williamr@2
|
305 |
TBuf<KMaxBoundaryMatchLength> iLowMatch;
|
williamr@2
|
306 |
TCriteria iLowCriteria;
|
williamr@2
|
307 |
TBuf<KMaxBoundaryMatchLength> iHighMatch;
|
williamr@2
|
308 |
TCriteria iHighCriteria;
|
williamr@2
|
309 |
};
|
williamr@2
|
310 |
|
williamr@2
|
311 |
|
williamr@2
|
312 |
class CContactViewLowRange : public CContactViewRangeBase
|
williamr@2
|
313 |
/** A sub view range with an upper limit only.
|
williamr@2
|
314 |
|
williamr@2
|
315 |
This is used by sub views when the range criteria are CContactViewRangeBase::ELessThan
|
williamr@2
|
316 |
or CContactViewRangeBase::ELessThanOrEqualTo.
|
williamr@2
|
317 |
|
williamr@2
|
318 |
@see CContactSubView
|
williamr@2
|
319 |
@publishedAll
|
williamr@2
|
320 |
@released
|
williamr@2
|
321 |
*/
|
williamr@2
|
322 |
{
|
williamr@2
|
323 |
public:
|
williamr@2
|
324 |
IMPORT_C static CContactViewLowRange* NewL(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
|
williamr@2
|
325 |
private: // From CContactViewRangeBase.
|
williamr@2
|
326 |
void SetL();
|
williamr@2
|
327 |
private:
|
williamr@2
|
328 |
CContactViewLowRange(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
|
williamr@2
|
329 |
//ChrisD: why private d'tor
|
williamr@2
|
330 |
~CContactViewLowRange();
|
williamr@2
|
331 |
private:
|
williamr@2
|
332 |
TBuf<KMaxBoundaryMatchLength> iMatch;
|
williamr@2
|
333 |
TCriteria iCriteria;
|
williamr@2
|
334 |
};
|
williamr@2
|
335 |
|
williamr@2
|
336 |
|
williamr@2
|
337 |
class CContactViewHighRange : public CContactViewRangeBase
|
williamr@2
|
338 |
/** A sub view range with a lower limit only.
|
williamr@2
|
339 |
|
williamr@2
|
340 |
This is used by sub views when the range criteria are CContactViewRangeBase::EGreaterThan
|
williamr@2
|
341 |
or CContactViewRangeBase::EGreaterThanOrEqualTo.
|
williamr@2
|
342 |
|
williamr@2
|
343 |
@see CContactSubView
|
williamr@2
|
344 |
@publishedAll
|
williamr@2
|
345 |
@released
|
williamr@2
|
346 |
*/
|
williamr@2
|
347 |
{
|
williamr@2
|
348 |
public:
|
williamr@2
|
349 |
IMPORT_C static CContactViewHighRange* NewL(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
|
williamr@2
|
350 |
private: // From CContactViewRangeBase.
|
williamr@2
|
351 |
void SetL();
|
williamr@2
|
352 |
private:
|
williamr@2
|
353 |
CContactViewHighRange(const CContactViewBase& aView,const TDesC& aMatch,TCriteria aCriteria);
|
williamr@2
|
354 |
//ChrisD: why private d'tor
|
williamr@2
|
355 |
~CContactViewHighRange();
|
williamr@2
|
356 |
private:
|
williamr@2
|
357 |
TBuf<KMaxBoundaryMatchLength> iMatch;
|
williamr@2
|
358 |
TCriteria iCriteria;
|
williamr@2
|
359 |
};
|
williamr@2
|
360 |
|
williamr@2
|
361 |
|
williamr@2
|
362 |
class CContactSubView : public CContactViewBase, public MContactViewObserver
|
williamr@2
|
363 |
/** Provides a view of a range of contact items from a potentially larger underlying
|
williamr@2
|
364 |
view (another CContactViewBase-derived object).
|
williamr@2
|
365 |
|
williamr@2
|
366 |
All contact items between a lower and upper boundary in the underlying view
|
williamr@2
|
367 |
are included in the sub view. For example, the sub view might contain all
|
williamr@2
|
368 |
items whose name begins with a character between 'd' and 'f'.
|
williamr@2
|
369 |
|
williamr@2
|
370 |
The sub view observes its underlying view so that as the underlying view changes,
|
williamr@2
|
371 |
the sub view is kept up to date.
|
williamr@2
|
372 |
@publishedAll
|
williamr@2
|
373 |
@released
|
williamr@2
|
374 |
*/
|
williamr@2
|
375 |
{
|
williamr@2
|
376 |
public:
|
williamr@2
|
377 |
IMPORT_C static CContactSubView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,CContactViewBase& aView,const TDesC& aBoundary);//>= > is infinity <= < =0;
|
williamr@2
|
378 |
IMPORT_C static CContactSubView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,CContactViewBase& aView,const TDesC& aLowBoundary,const TDesC& aHighBoundary);
|
williamr@2
|
379 |
|
williamr@2
|
380 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
381 |
IMPORT_C static CContactSubView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,const TDesC& aBoundary);//>= > is infinity <= < =0;
|
williamr@2
|
382 |
// Factory constructor for version 2 behaviour
|
williamr@2
|
383 |
IMPORT_C static CContactSubView* NewL(CContactViewBase& aView,const CContactDatabase& aDb,MContactViewObserver& aObserver,const TDesC& aLowBoundary,const TDesC& aHighBoundary);
|
williamr@2
|
384 |
|
williamr@2
|
385 |
//All CContactViewBase derived classes in public headers,
|
williamr@2
|
386 |
//should mandatorily implement this reserved function.
|
williamr@2
|
387 |
TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
|
williamr@2
|
388 |
public: // From CContactViewBase.
|
williamr@2
|
389 |
TContactItemId AtL(TInt aIndex) const;
|
williamr@2
|
390 |
TInt CountL() const;
|
williamr@2
|
391 |
TInt FindL(TContactItemId aId) const;
|
williamr@2
|
392 |
HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
|
williamr@2
|
393 |
const CViewContact& ContactAtL(TInt aIndex) const;
|
williamr@2
|
394 |
TContactViewPreferences ContactViewPreferences();
|
williamr@2
|
395 |
const RContactViewSortOrder& SortOrderL() const;
|
williamr@2
|
396 |
private: // From MContactViewObserver.
|
williamr@2
|
397 |
virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
|
williamr@2
|
398 |
private:
|
williamr@2
|
399 |
//ChrisD: why private d'tor
|
williamr@2
|
400 |
~CContactSubView();
|
williamr@2
|
401 |
CContactSubView(const CContactDatabase& aDb,CContactViewBase& aView);
|
williamr@2
|
402 |
CContactSubView(const CContactDatabase& aDb,const CContactSubView& aView);
|
williamr@2
|
403 |
void CommonConstructL(MContactViewObserver& aObserver);
|
williamr@2
|
404 |
void ConstructL(MContactViewObserver& aObserver,const TDesC& aBoundary);
|
williamr@2
|
405 |
void ConstructL(MContactViewObserver& aObserver,const CContactSubView& aView);
|
williamr@2
|
406 |
void ConstructL(MContactViewObserver& aObserver,const CContactSubView& aView,const TDesC& aBoundary);
|
williamr@2
|
407 |
void ConstructL(MContactViewObserver& aObserver,const TDesC& aLowBoundary,const TDesC& aHighBoundary);
|
williamr@2
|
408 |
CContactViewRangeBase::TCriteria DecodeBoundary(TDes& aBoundary) const;
|
williamr@2
|
409 |
TInt MapToUnderlyingViewIndex(TInt aSubViewIndex) const;
|
williamr@2
|
410 |
TInt MapToSubViewIndex(TInt aUnderlyingViewIndex) const;
|
williamr@2
|
411 |
private:
|
williamr@2
|
412 |
CContactViewBase& iView;
|
williamr@2
|
413 |
CContactViewRangeBase* iRange;
|
williamr@2
|
414 |
TUint iClassVersion; //version class - used for TContactViewEvent dispatching
|
williamr@2
|
415 |
};
|
williamr@2
|
416 |
|
williamr@2
|
417 |
|
williamr@2
|
418 |
class CContactConcatenatedView : public CContactViewBase, public MContactViewObserver
|
williamr@2
|
419 |
/** Concatenates multiple contact views into a single contiguous view.
|
williamr@2
|
420 |
|
williamr@2
|
421 |
The component views are ordered according to their order in the array passed
|
williamr@2
|
422 |
into the NewL().
|
williamr@2
|
423 |
@publishedAll
|
williamr@2
|
424 |
@released
|
williamr@2
|
425 |
*/
|
williamr@2
|
426 |
{
|
williamr@2
|
427 |
public:
|
williamr@2
|
428 |
IMPORT_C static CContactConcatenatedView* NewL(MContactViewObserver& aObserver,const CContactDatabase& aDb,RPointerArray<CContactViewBase>& aComponentViews);
|
williamr@2
|
429 |
//All CContactViewBase derived classes in public headers,
|
williamr@2
|
430 |
//should mandatorily implement this reserved function.
|
williamr@2
|
431 |
TAny* CContactViewBase_Reserved_1(TFunction aFunction,TAny* aParams);
|
williamr@2
|
432 |
public: // From CContactViewBase.
|
williamr@2
|
433 |
TContactItemId AtL(TInt aIndex) const;
|
williamr@2
|
434 |
TInt CountL() const;
|
williamr@2
|
435 |
TInt FindL(TContactItemId aId) const;
|
williamr@2
|
436 |
HBufC* AllFieldsLC(TInt aIndex,const TDesC& aSeparator) const;
|
williamr@2
|
437 |
const CViewContact& ContactAtL(TInt aIndex) const;
|
williamr@2
|
438 |
TContactViewPreferences ContactViewPreferences();
|
williamr@2
|
439 |
const RContactViewSortOrder& SortOrderL() const;
|
williamr@2
|
440 |
private: // From MContactViewObserver.
|
williamr@2
|
441 |
virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
|
williamr@2
|
442 |
private:
|
williamr@2
|
443 |
struct TComponentView
|
williamr@2
|
444 |
{
|
williamr@2
|
445 |
TComponentView(CContactViewBase& aView,TState aState);
|
williamr@2
|
446 |
CContactViewBase& iView;
|
williamr@2
|
447 |
TState iState;
|
williamr@2
|
448 |
};
|
williamr@2
|
449 |
private:
|
williamr@2
|
450 |
~CContactConcatenatedView();
|
williamr@2
|
451 |
CContactConcatenatedView(const CContactDatabase& aDb);
|
williamr@2
|
452 |
void ConstructL(MContactViewObserver& aObserver,RPointerArray<CContactViewBase>& aComponentViews);
|
williamr@2
|
453 |
void CopyComponentViewsL(RPointerArray<CContactViewBase>& aComponentViews);
|
williamr@2
|
454 |
void OpenComponentViewsL();
|
williamr@2
|
455 |
void CloseComponentViews();
|
williamr@2
|
456 |
TBool ComponentViewsReady();
|
williamr@2
|
457 |
void SetComponentViewReady(const CContactViewBase& aView);
|
williamr@2
|
458 |
TInt OffsetL(const CContactViewBase& aView);
|
williamr@2
|
459 |
static TBool ComponentViewsEqual(const TComponentView& aFirst,const TComponentView& aSecond);
|
williamr@2
|
460 |
TInt FindComponentView(const CContactViewBase& aView);
|
williamr@2
|
461 |
private:
|
williamr@2
|
462 |
RArray<TComponentView> iComponentView;
|
williamr@2
|
463 |
};
|
williamr@2
|
464 |
|
williamr@2
|
465 |
|
williamr@2
|
466 |
inline TInt CContactViewRangeBase::LowIndex() const
|
williamr@2
|
467 |
/** Gets the index into the sub view's underlying view of the item at the bottom
|
williamr@2
|
468 |
of the range.
|
williamr@2
|
469 |
|
williamr@2
|
470 |
@return The index of the item at the bottom of the range. */
|
williamr@2
|
471 |
{ return iLow; }
|
williamr@2
|
472 |
|
williamr@2
|
473 |
inline TInt CContactViewRangeBase::HighIndex() const
|
williamr@2
|
474 |
/** Gets the index into the sub view's underlying view of the item at the top of
|
williamr@2
|
475 |
the range.
|
williamr@2
|
476 |
|
williamr@2
|
477 |
@return The index of the item at the top of the range. */
|
williamr@2
|
478 |
{ return iHigh; }
|
williamr@2
|
479 |
|
williamr@2
|
480 |
#endif
|