Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <cntview.h>
Link against: cntview.lib

Class CContactFindView

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

Members

Defined in CContactFindView:

Inherited from CBase:

Inherited from CContactViewBase:

Related Topics


Construction and destruction


NewL()

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

CContactFindView *

The newly constructed find view object.


NewL()

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

CContactFindView *

The newly constructed find view object.


NewL()

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

CContactFindView *

The newly constructed find view object.


NewL()

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

CContactFindView *

The newly constructed find view object.

[Top]


Member functions


AtL()

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

TContactItemId

The contact item ID.

Leave codes

KErrNotFound

aIndex is outside the bounds of the array.


CountL()

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.


FindL()

virtual TInt FindL(TContactItemId aId) const;

Description

Finds the index into the array of the specified contact item.

Parameters

TContactItemId aId

The contact item ID to search for.

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.


AllFieldsLC()

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.


ContactAtL()

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

const CViewContact &

The contact item.

Leave codes

KErrNotFound

aIndex is outside the bounds of the array.


ContactViewPreferences()

virtual TContactViewPreferences ContactViewPreferences();

Description

Gets the underlying view's view preferences.

Return value

TContactViewPreferences

The view preferences.


SortOrderL()

virtual const RContactViewSortOrder &SortOrderL() const;

Description

Gets the underlying view's sort order.

Return value

const RContactViewSortOrder &

The sort order.


UpdateFindViewL()

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.


RefineFindViewL()

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.


HandleContactViewEvent()

private: virtual void HandleContactViewEvent(const CContactViewBase &aView, const TContactViewEvent &aEvent);

Description

Handles an event in an observed contact view.

Parameters

const CContactViewBase &aView

The contact view causing the notification.

const TContactViewEvent &aEvent

The event.