CContactFindView Class Reference

class CContactFindView : public CContactViewBase

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.

Inherits from

Public Member Functions
~CContactFindView()
HBufC *AllFieldsLC(TInt, const TDesC &)
TContactItemId AtL(TInt)
TAny *CContactViewBase_Reserved_1(TFunction, TAny *)
const CViewContact &ContactAtL(TInt)
TContactViewPreferences ContactViewPreferences()
TInt CountL()
TInt FindL(TContactItemId)
IMPORT_C CContactFindView *NewL(const CContactDatabase &, CContactViewBase &, MContactViewObserver &, MDesCArray *)
IMPORT_C CContactFindView *NewL(const CContactDatabase &, CContactViewBase &, MContactViewObserver &, MDesCArray *, TSearchType)
IMPORT_C CContactFindView *NewL(CContactViewBase &, const CContactDatabase &, MContactViewObserver &, MDesCArray *)
IMPORT_C CContactFindView *NewL(CContactViewBase &, const CContactDatabase &, MContactViewObserver &, MDesCArray *, TSearchType)
IMPORT_C voidRefineFindViewL(MDesCArray *)
const RContactViewSortOrder &SortOrderL()
Protected Member Functions
IMPORT_C voidUpdateFindViewL()
Private Member Functions
CContactFindView(const CContactDatabase &, CContactViewBase &, TSearchType)
voidConstructL(MContactViewObserver &, MDesCArray *)
voidCopyNewFindWordsL(MDesCArray *)
voidDeleteFindContacts()
voidDestroyFindWordsArray()
voidHandleAddEventL(TContactViewEvent &)
voidHandleContactViewEvent(const CContactViewBase &, const TContactViewEvent &)
voidHandleRemoveEventL(TContactViewEvent &)
TInt InsertContact(const CViewContact *)
voidTightenFindViewCriteriaL()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
CContactViewBase::CContactViewBase(const CContactDatabase &)
CContactViewBase::Close(const MContactViewObserver &)
CContactViewBase::CompareContactIds(const CViewContact &,const CViewContact &)
CContactViewBase::CompareContactsAndIdsL(const CViewContact &,const CViewContact &)const
CContactViewBase::CompareFieldsL(const CViewContact &,const CViewContact &)
CContactViewBase::ConstructL()
CContactViewBase::ContactIsSortable(const CViewContact &)
CContactViewBase::ContactsMatchingCriteriaL(const MDesCArray &,RPointerArray< CViewContact > &)
CContactViewBase::ContactsMatchingPrefixL(const MDesCArray &,RPointerArray< CViewContact > &)
CContactViewBase::Error()const
CContactViewBase::FieldsWithSeparatorLC(const RPointerArray< CViewContact > &,TInt,const TDesC &)const
CContactViewBase::FindDefaultViewSortPluginImplL()const
CContactViewBase::FindSortPluginImplL(const TDesC8 &,TBool)const
CContactViewBase::GetContactIdsL(const CArrayFix< TInt > &,CContactIdArray &)
CContactViewBase::GetViewFindConfigPlugin()
CContactViewBase::GetViewSortPluginImplUid()const
CContactViewBase::IdsEqual(const TContactIdWithMapping &,const TContactIdWithMapping &)
CContactViewBase::IdsMatch(const CViewContact &,const CViewContact &)
CContactViewBase::IndexesEqual(const TContactIdWithMapping &,const TContactIdWithMapping &)
CContactViewBase::InsertContactInView(RPointerArray< CViewContact > &,const CViewContact *,TBool,TInt *)const
CContactViewBase::IsContactSortable(const CViewContact &,TContactViewPreferences &)const
CContactViewBase::LoadViewSortPluginL(TUid,TContactViewPreferences &)
CContactViewBase::MatchesCriteriaL(const CViewContact &,const MDesCArray &)
CContactViewBase::MatchesCriteriaL(const CViewContact &,const MDesCArray &,TSearchType)
CContactViewBase::MatchesCriteriaL(const CViewContact &,const MDesCArray &,TSearchType,CContactViewBase::CContactViewBaseExtension *)
CContactViewBase::NotifyObserverAsync(MContactViewObserver &,const TContactViewEvent &)
CContactViewBase::NotifyObservers(const TContactViewEvent &)
CContactViewBase::Open(MContactViewObserver &)
CContactViewBase::OpenL(MContactViewObserver &)
CContactViewBase::SetViewFindConfigPlugin(TUid)
CContactViewBase::SortPluginImpl()const
CContactViewBase::~CContactViewBase()
Inherited Enumerations
CContactViewBase:TFunction
CContactViewBase:TSearchType
CContactViewBase:TState
Private Attributes
TUint iClassVersion
RPointerArray< CViewContact >iFindContacts
CPtrCArray *iFindWords
const TSearchTypeiSearchType
CContactViewBase &iView
Inherited Attributes
CContactViewBase::iDb
CContactViewBase::iExtension
CContactViewBase::iState

Constructor & Destructor Documentation

CContactFindView(const CContactDatabase &, CContactViewBase &, TSearchType)

CContactFindView(const CContactDatabase &aDb,
CContactViewBase &aView,
TSearchTypeaSearchType
)[private]

Parameters

const CContactDatabase & aDb
CContactViewBase & aView
TSearchType aSearchType

~CContactFindView()

~CContactFindView()

Destructor

Member Functions Documentation

AllFieldsLC(TInt, const TDesC &)

HBufC *AllFieldsLC(TIntaIndex,
const TDesC &aSeparator
)const [virtual]

Returns a descriptor containing the contents of all fields in an item in the view.

The fields are separated by aSeparator.

Parameters

TInt aIndexThe index into the view of the contact item.
const TDesC & aSeparatorThe string to use to separate the fields.

AtL(TInt)

TContactItemId AtL(TIntaIndex)const [virtual]

Gets the contact item ID at the specified index into the find view.

leave
KErrNotFound aIndex is outside the bounds of the array.

Parameters

TInt aIndexIndex of the contact item ID into the find view.

CContactViewBase_Reserved_1(TFunction, TAny *)

TAny *CContactViewBase_Reserved_1(TFunctionaFunction,
TAny *aParams
)[virtual]

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

ConstructL(MContactViewObserver &, MDesCArray *)

voidConstructL(MContactViewObserver &aObserver,
MDesCArray *aFindWords
)[private]

Parameters

MContactViewObserver & aObserver
MDesCArray * aFindWords

ContactAtL(TInt)

const CViewContact &ContactAtL(TIntaIndex)const [virtual]

Gets the contact item at the specified index into the view.

leave
KErrNotFound aIndex is outside the bounds of the array.

Parameters

TInt aIndexIndex into the view of the required item.

ContactViewPreferences()

TContactViewPreferences ContactViewPreferences()[virtual]

Gets the underlying view's view preferences.

CopyNewFindWordsL(MDesCArray *)

voidCopyNewFindWordsL(MDesCArray *aFindWords)[private]

Parameters

MDesCArray * aFindWords

CountL()

TInt CountL()const [virtual]

Gets the number of contact item IDs in the find view.

DeleteFindContacts()

voidDeleteFindContacts()[private]

DestroyFindWordsArray()

voidDestroyFindWordsArray()[private]

FindL(TContactItemId)

TInt FindL(TContactItemIdaId)const [virtual]

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

leave
KErrNotReady The view is not ready for use.

Parameters

TContactItemId aIdThe contact item ID to search for.

HandleAddEventL(TContactViewEvent &)

voidHandleAddEventL(TContactViewEvent &aEvent)[private]

Parameters

TContactViewEvent & aEvent

HandleContactViewEvent(const CContactViewBase &, const TContactViewEvent &)

voidHandleContactViewEvent(const CContactViewBase &aView,
const TContactViewEvent &aEvent
)[private, virtual]

Parameters

const CContactViewBase & aView
const TContactViewEvent & aEvent

HandleRemoveEventL(TContactViewEvent &)

voidHandleRemoveEventL(TContactViewEvent &aEvent)[private]

Parameters

TContactViewEvent & aEvent

InsertContact(const CViewContact *)

TInt InsertContact(const CViewContact *aNewContact)[private]

Do binary search of Contacts Array, and insert new contact. Uses current Sort Plugin, if any.

Parameters

const CViewContact * aNewContact

NewL(const CContactDatabase &, CContactViewBase &, MContactViewObserver &, MDesCArray *)

IMPORT_C CContactFindView *NewL(const CContactDatabase &aDb,
CContactViewBase &aView,
MContactViewObserver &aObserver,
MDesCArray *aFindWords
)[static]

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 & aDbThe database containing the contact items.
CContactViewBase & aViewThe underlying contact view.
MContactViewObserver & aObserverAn 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.
MDesCArray * aFindWordsThe 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.

NewL(const CContactDatabase &, CContactViewBase &, MContactViewObserver &, MDesCArray *, TSearchType)

IMPORT_C CContactFindView *NewL(const CContactDatabase &aDb,
CContactViewBase &aView,
MContactViewObserver &aObserver,
MDesCArray *aFindWords,
TSearchTypeaSearchType
)[static]

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 & aDbThe database containing the contact items.
CContactViewBase & aViewThe underlying contact view.
MContactViewObserver & aObserverAn 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.
MDesCArray * aFindWordsThe 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 aSearchTypeThe search type. This controls whether a search term can occur anywhere in a contact item field, or just at the beginning of the field.

NewL(CContactViewBase &, const CContactDatabase &, MContactViewObserver &, MDesCArray *)

IMPORT_C CContactFindView *NewL(CContactViewBase &aView,
const CContactDatabase &aDb,
MContactViewObserver &aObserver,
MDesCArray *aFindWords
)[static]

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 & aViewThe underlying contact view.
const CContactDatabase & aDbThe database containing the contact items.
MContactViewObserver & aObserverAn 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.
MDesCArray * aFindWordsThe 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.

NewL(CContactViewBase &, const CContactDatabase &, MContactViewObserver &, MDesCArray *, TSearchType)

IMPORT_C CContactFindView *NewL(CContactViewBase &aView,
const CContactDatabase &aDb,
MContactViewObserver &aObserver,
MDesCArray *aFindWords,
TSearchTypeaSearchType
)[static]

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 & aViewThe underlying contact view.
const CContactDatabase & aDbThe database containing the contact items.
MContactViewObserver & aObserverAn 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.
MDesCArray * aFindWordsThe 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 aSearchTypeThe search type. This controls whether a search term can occur anywhere in a contact item field, or just at the beginning of the field.

RefineFindViewL(MDesCArray *)

IMPORT_C voidRefineFindViewL(MDesCArray *aFindWords)

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

MDesCArray * aFindWordsThe 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.

SortOrderL()

const RContactViewSortOrder &SortOrderL()const [virtual]

Gets the underlying view's sort order.

TightenFindViewCriteriaL()

voidTightenFindViewCriteriaL()[private]

UpdateFindViewL()

IMPORT_C voidUpdateFindViewL()[protected, virtual]

Populates the view.

This deletes any existing matching contacts list and searches the underlying view for items matching the search criteria.

Member Data Documentation

TUint iClassVersion

TUint iClassVersion[private]

RPointerArray< CViewContact > iFindContacts

RPointerArray< CViewContact >iFindContacts[private]

CPtrCArray * iFindWords

CPtrCArray *iFindWords[private]

const TSearchType iSearchType

const TSearchTypeiSearchType[private]

CContactViewBase & iView

CContactViewBase &iView[private]