#include <cntview.h>
Link against:
cntview.lib
class CContactFindView : public CContactViewBase, public MContactViewObserver;
Description
Provides a view of an existing CContactViewBase-derived object, populated using search criteria.
The find view only contains contact items from the underlying view that match the search criteria.
The find view observes its underlying view so that it is kept up to date if the contents of the underlying view change.
The search criteria (one or more words) are held in an MDesCArray object. The fields involved in the search are those that
have been used to sort the underlying view.
Derivation
CBase
- Base class for all classes to be instantiated on the heap
CContactFindView
- Provides a view of an existing CContactViewBase-derived object, populated using search criteria
Members
Defined in CContactFindView
:
AllFieldsLC()
Returns a descriptor containing the contents of all fields in an item in the view
AtL()
Gets the contact item ID at the specified index into the find view
CContactViewBase_Reserved_1()
This is a reserved virtual exported function that is used for BC proofing against present and future additions of new exported
virtual functions
ContactAtL()
Gets the contact item at the specified index into the view
ContactViewPreferences()
Gets the underlying view's view preferences
CountL()
Gets the number of contact item IDs in the find view
FindL()
Finds the index into the array of the specified contact item
HandleContactViewEvent()
Handles an event in an observed contact view
NewL()
Allocates and constructs a new CContactFindView version 1 object, using a default search type of CContactViewBase::EFullSearch
NewL()
Allocates and constructs a new CContactFindView version 1 object, specifying a search type
NewL()
Allocates and constructs a new CContactFindView version 2 object, using a default search type of CContactViewBase::EFullSearch
NewL()
Allocates and constructs a new CContactFindView version 2 object, specifying a search type
RefineFindViewL()
Refines the search criteria and updates the find view
SortOrderL()
Gets the underlying view's sort order
UpdateFindViewL()
Populates the view
Inherited from CBase
:
Inherited from CContactViewBase
:
Close()
Removes an observer from the view's observer array
CompareFieldsL()
Collates two contact items' field contents
ConstructL()
Protected second phase constructor
ContactsMatchingCriteriaL()
Searches all contact items in the view for fields that contain all of the search strings specified
ContactsMatchingPrefixL()
Searches all contact items in the view for fields that contain all of the search strings specified
ECContactViewBaseVirtualFunction1
Identifies the function CContactViewBase::GetContactIdsL()
ECContactViewBaseVirtualFunction2
Identifies the function CContactViewBase::GetContactsMatchingFilterL()
ECContactViewBaseVirtualFunction3
Identifies the function CContactViewBase::InsertContactInView()
EFullSearch
The search uses full wildcard matching so that the search string can occur anywhere in the item's fields
EInitializing
The view is initialising
ENotReady
The view is not ready to be used, for instance immediately after the sort order has changed, or after an error has occurred
EPrefixSearch
The search uses partial wildcard matching so that the search string can only occur at the beginning of the item's fields
EReady
The view is ready to be used
Error()
Gets the recorded error value
FieldsWithSeparatorLC()
Allocates and returns a descriptor filled with the contents of all the fields in a contact item
GetContactIdsL()
Gets an array containing the IDs of the contact items at the specified view indexes
GetViewFindConfigPlugin()
Gets the UID of the view's find configuration plug-in, as set by SetViewFindConfigPlugin()
IdsEqual()
Tests whether the IDs of two contact items are the same
IdsMatch()
Tests whether the IDs of two contact items are the same
IndexesEqual()
Tests whether the view indexes of two contact items are the same
MatchesCriteriaL()
Searches a single contact item for fields that contain one or more search strings
NotifyObserverAsync()
Called to notify a single view observer asynchronously of an event
NotifyObservers()
Called by derived view classes to notify their observers synchronously of an event, by calling their HandleContactViewEvent()
function
Open()
Appends an observer to the view's observer array
OpenL()
Appends an observer to the view's observer array
SetViewFindConfigPlugin()
Sets the UID of the view's find configuration plug-in to use in calls to ContactsMatchingCriteriaL(), ContactsMatchingPrefixL()
and MatchesCriteriaL()
TFunction
Identifies the functions that have been added to CContactViewBase, or that may be added in the future
TSearchType
Search type
TState
Defines the contact view states
TVirtualFunction1Params
Holds the two parameters passed to the helper method GetContactIdsL() from the reserved function CContactViewBase_Reserved_1()
TVirtualFunction2Params
Holds the two parameters passed to the method GetContactsMatchingFilterL() from the reserved function CContactViewBase_Reserved_1()
iDb
iExtension
iState
Related Topics
»
Symbian OS v9.4 »
Examples »
Application Engines example code »
ContactViews: Using Contact Database views
Construction and destruction
static IMPORT_C CContactFindView *NewL(const CContactDatabase &aDb, CContactViewBase &aView, MContactViewObserver &aObserver,
MDesC16Array *aFindWords);
Description
Allocates and constructs a new CContactFindView version 1 object, using a default search type of CContactViewBase::EFullSearch
.
When adding/deleting contacts in the view, MContactViewObserver
observer will receive TContactViewEvent
events with iInt parameter set to KErrNone.
Parameters
const CContactDatabase &aDb |
The database containing the contact items.
|
CContactViewBase &aView |
The underlying contact view.
|
MContactViewObserver &aObserver |
An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives
a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.
|
MDesC16Array *aFindWords |
The array of search terms. The view does not take ownership of this - it makes its own copy of it to prevent it from going
out of scope.
|
|
Return value
static IMPORT_C CContactFindView *NewL(const CContactDatabase &aDb, CContactViewBase &aView, MContactViewObserver &aObserver,
MDesC16Array *aFindWords, TSearchType aSearchType);
Description
Allocates and constructs a new CContactFindView version 1 object, specifying a search type.
When adding/deleting contacts in the view, MContactViewObserver
observer will receive TContactViewEvent
events with iInt parameter set to KErrNone.
Parameters
const CContactDatabase &aDb |
The database containing the contact items.
|
CContactViewBase &aView |
The underlying contact view.
|
MContactViewObserver &aObserver |
An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives
a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.
|
MDesC16Array *aFindWords |
The array of search terms. The view does not take ownership of this - it makes its own copy of it to prevent it from going
out of scope.
|
TSearchType aSearchType |
The search type. This controls whether a search term can occur anywhere in a contact item field, or just at the beginning
of the field.
|
|
Return value
static IMPORT_C CContactFindView *NewL(CContactViewBase &aView, const CContactDatabase &aDb, MContactViewObserver &aObserver,
MDesC16Array *aFindWords);
Description
Allocates and constructs a new CContactFindView version 2 object, using a default search type of CContactViewBase::EFullSearch
.
When adding/deleting contacts in the view, MContactViewObserver
observer will receive TContactViewEvent
events with iInt parameter set to index into the observed view of the added/deleted item
Parameters
CContactViewBase &aView |
The underlying contact view.
|
const CContactDatabase &aDb |
The database containing the contact items.
|
MContactViewObserver &aObserver |
An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives
a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.
|
MDesC16Array *aFindWords |
The array of search terms. The view does not take ownership of this - it makes its own copy of it to prevent it from going
out of scope.
|
|
Return value
static IMPORT_C CContactFindView *NewL(CContactViewBase &aView, const CContactDatabase &aDb, MContactViewObserver &aObserver,
MDesC16Array *aFindWords, TSearchType aSearchType);
Description
Allocates and constructs a new CContactFindView version 2 object, specifying a search type.
When adding/deleting contacts in the view, MContactViewObserver
observer will receive TContactViewEvent
events with iInt parameter set to index into the observed view of the added/deleted item
Parameters
CContactViewBase &aView |
The underlying contact view.
|
const CContactDatabase &aDb |
The database containing the contact items.
|
MContactViewObserver &aObserver |
An observer that receives notifications when this view is ready for use and when changes take place in it. The observer receives
a TContactViewEvent::EReady event when the view is ready. An attempt to use the view before this notification causes a panic.
|
MDesC16Array *aFindWords |
The array of search terms. The view does not take ownership of this - it makes its own copy of it to prevent it from going
out of scope.
|
TSearchType aSearchType |
The search type. This controls whether a search term can occur anywhere in a contact item field, or just at the beginning
of the field.
|
|
Return value
virtual TContactItemId AtL(TInt aIndex) const;
Description
Gets the contact item ID at the specified index into the find view.
Parameters
TInt aIndex |
Index of the contact item ID into the find view.
|
|
Return value
Leave codes
KErrNotFound |
aIndex is outside the bounds of the array.
|
|
virtual TInt CountL() const;
Description
Gets the number of contact item IDs in the find view.
Return value
TInt
|
The number of contact items in the find view.
|
|
virtual TInt FindL(TContactItemId aId) const;
Description
Finds the index into the array of the specified contact item.
Parameters
Return value
TInt
|
The index of the first matching item in the find view or KErrNotFound if no matching item can be found.
|
|
Leave codes
KErrNotReady |
The view is not ready for use.
|
|
virtual HBufC *AllFieldsLC(TInt aIndex, const TDesC &aSeparator) const;
Description
Returns a descriptor containing the contents of all fields in an item in the view.
The fields are separated by aSeparator.
Parameters
TInt aIndex |
The index into the view of the contact item.
|
const TDesC &aSeparator |
The string to use to separate the fields.
|
|
Return value
HBufC * |
Pointer to the contact item descriptor.
|
|
virtual const CViewContact &ContactAtL(TInt aIndex) const;
Description
Gets the contact item at the specified index into the view.
Parameters
TInt aIndex |
Index into the view of the required item.
|
|
Return value
Leave codes
KErrNotFound |
aIndex is outside the bounds of the array.
|
|
virtual TContactViewPreferences ContactViewPreferences();
Description
Gets the underlying view's view preferences.
Return value
virtual const RContactViewSortOrder &SortOrderL() const;
Description
Gets the underlying view's sort order.
Return value
protected: virtual IMPORT_C void UpdateFindViewL();
Description
Populates the view.
This deletes any existing matching contacts list and searches the underlying view for items matching the search criteria.
IMPORT_C void RefineFindViewL(MDesC16Array *aFindWords);
Description
Refines the search criteria and updates the find view.
This may involve either narrowing or replacing the search criteria.
This function can be used to narrow the existing search criteria, by specifying an array of search terms that consists of
the existing search terms (as passed to the NewL()
) with additional terms appended to it. In this case, the function searches the existing list of matching contact items only.
This assumes that UpdateFindViewL()
has previously been called.
It can alternatively be used to replace entirely the existing search criteria. In this case, the whole underlying view is
searched again.
Parameters
MDesC16Array *aFindWords |
The new search criteria. This can be a superset of the existing search criteria, i.e. the existing criteria with additional
terms appended to it; otherwise it replaces the existing search criteria entirely.
|
|
CContactViewBase_Reserved_1()
virtual TAny *CContactViewBase_Reserved_1(TFunction aFunction, TAny *aParams);
Description
This is a reserved virtual exported function that is used for BC proofing against present and future additions of new exported
virtual functions.
Parameters
TFunction aFunction |
|
TAny *aParams |
|
|
Return value
TAny * |
Any return values of the helper methods called from this function or NULL.
|
|
private: virtual void HandleContactViewEvent(const CContactViewBase &aView, const TContactViewEvent &aEvent);
Description
Handles an event in an observed contact view.
Parameters