CContactLocalView Class Reference

#include <app/cntviewbase.h>

class CContactLocalView : public CContactViewBase, public MContactDbObserver, public CContactViewBase, public MContactDbObserver
Protected Attributes
RContactViewSortOrder iSortOrder
Public Member Functions
virtual HBufC *AllFieldsLC(TInt, const TDesC &)
virtual TContactItemId AtL(TInt)
virtual IMPORT_C TAny *CContactViewBase_Reserved_1(TFunction, TAny *)
virtual const CViewContact &ContactAtL(TInt)
virtual TContactViewPreferences ContactViewPreferences()
virtual TInt CountL()
virtual TInt FindL(TContactItemId)
IMPORT_C CContactLocalView *NewL(MContactViewObserver &, const CContactDatabase &, const RContactViewSortOrder &, TContactViewPreferences)
IMPORT_C CContactLocalView *NewL(MContactViewObserver &, const CContactDatabase &, const RContactViewSortOrder &, TContactViewPreferences, const TDesC8 &)
IMPORT_C CContactLocalView *NewL(MContactViewObserver &, const CContactDatabase &, const RContactViewSortOrder &, TContactViewPreferences, MLplPersistenceLayerFactory *, const TDesC8 &)
voidNotifySortError(TInt)
IMPORT_C const RContactViewSortOrder &SortOrder()
virtual const RContactViewSortOrder &SortOrderL()
Protected Member Functions
CContactLocalView(const CContactDatabase &, TContactViewPreferences)
CContactLocalView(const CContactDatabase &, TContactViewPreferences, MLplPersistenceLayerFactory *)
~CContactLocalView()
IMPORT_C voidConstructL(MContactViewObserver &, const RContactViewSortOrder &)
voidConstructL(MContactViewObserver &, const RContactViewSortOrder &, const TBool, const TDesC8 &)
virtual IMPORT_C TIntInsertL(TContactItemId)
virtual IMPORT_C TIntRemoveL(TContactItemId)
voidSetState(TState)
virtual IMPORT_C voidSortL(const RContactViewSortOrder &)
Inherited Attributes
CContactViewBase::iDb
CContactViewBase::iExtension
CContactViewBase::iState
Inherited Enumerations
CContactViewBase:TFunction
CContactViewBase:TSearchType
CContactViewBase:TState
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 MDesC16Array &,RPointerArray< CViewContact > &)
CContactViewBase::ContactsMatchingCriteriaL(const MDesCArray &,RPointerArray< CViewContact > &)
CContactViewBase::ContactsMatchingPrefixL(const MDesC16Array &,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 MDesC16Array &)
CContactViewBase::MatchesCriteriaL(const CViewContact &,const MDesC16Array &,TSearchType)
CContactViewBase::MatchesCriteriaL(const CViewContact &,const MDesC16Array &,TSearchType,CContactViewBase::CContactViewBaseExtension *)
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()

Detailed Description

An instantiable base class for contact views.

The data associated with a local view is allocated within the client's memory space; CContactRemoteView should be used in preference if the view is likely to be shared between multiple clients. It is kept up to date by receiving change events from the underlying CContactDatabase object which it observes. The view preferences and sort order are specified on construction.

Member Attribute Documentation

iSortOrder

RContactViewSortOrder iSortOrder[protected]

The sort order. This is set during construction or when SortL() is called.

Constructor & Destructor Documentation

CContactLocalView ( const CContactDatabase &, TContactViewPreferences )

IMPORT_CCContactLocalView(const CContactDatabase &aDb,
TContactViewPreferencesaContactTypes
)[protected]

Protected C++ constructor.

Called by NewL().

Parameters
aDbThe underlying database that contains the contact items.
aContactTypesSpecifies which types of contact items should be included in the view and the behaviour for items that do not have content in any of the fields specified in the sort order.

CContactLocalView ( const CContactDatabase &, TContactViewPreferences, MLplPersistenceLayerFactory * )

CContactLocalView(const CContactDatabase &aDb,
TContactViewPreferencesaContactTypes,
MLplPersistenceLayerFactory *aIterFactory
)[protected]

~CContactLocalView ( )

IMPORT_C~CContactLocalView()[protected]

Destructor.

Deletes all resources owned by the object, and removes itself as the contact database observer.

Member Function Documentation

AllFieldsLC ( TInt, const TDesC & )

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

Gets a descriptor containing the contents of all fields specified in the view's sort order for an item in the view.

The field separator is used to separate the contents of each field. It is not appended to the last field.

Parameters
aIndexThe index of the contact item into the view.
aSeparatorThe string to use to separate the fields.
Return Value
Pointer to the contact item descriptor.

AtL ( TInt )

TContactItemId AtL(TIntaIndex)const [virtual]

Returns the ID of the contact item at a specified index into the view.

Parameters
aIndexAn index into the view.
Return Value
The ID of the contact item at the specified index.
Leave Codes
KErrNotFoundThe index is out of bounds.
KErrNotReadyThe view is not ready for use.

CContactViewBase_Reserved_1 ( TFunction, TAny * )

IMPORT_C 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.

Return Value
Any return values of the helper methods called from this function or NULL.

ConstructL ( MContactViewObserver &, const RContactViewSortOrder & )

IMPORT_C voidConstructL(MContactViewObserver &aObserver,
const RContactViewSortOrder &aSortOrder
)[protected]

Protected second phase constructor.

The view is sorted according to the sort order and view preferences specified, using a low priority idle time active object. The specified view observer is notified when the view is sorted and ready for use.

Called by NewL().

Parameters
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. Any attempt to use the view before this notification will Leave with KErrNotReady.
aSortOrderSpecifies the fields to use to sort the items in the view.

ConstructL ( MContactViewObserver &, const RContactViewSortOrder &, const TBool, const TDesC8 & )

voidConstructL(MContactViewObserver &aObserver,
const RContactViewSortOrder &aSortOrder,
const TBoolaUseNamedPlugin,
const TDesC8 &aSortPluginName
)[protected]

Protected second phase constructor.

The view is sorted according to the sort order and view preferences specified, using a low priority idle time active object. The specified view observer is notified when the view is sorted and ready for use.

Called by NewL().

Parameters
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. Any attempt to use the view before this notification will Leave with KErrNotReady.
aSortOrderSpecifies the fields to use to sort the items in the view.
aUseNamedPluginA flag indicates whether the aSortPluginName parameter is valid.
aSortPluginNameSpecifies a plug-in that will be used to compare view contacts when the the view is sorted. This name is used by ECOM to select the plugin, and is matched with the "default_data" of all ECOM plugins that support the required interface.

ContactAtL ( TInt )

const CViewContact &ContactAtL(TIntaIndex)const [virtual]

Returns the contact item at a specified index into the view.

Parameters
aIndexAn index into the view.
Return Value
The reference to the copy of contact item at the specified index.
Leave Codes
KErrNotFoundThe index is out of bounds.
KErrNotReadyThe view is not ready for use.

ContactViewPreferences ( )

TContactViewPreferences ContactViewPreferences()[virtual]

Gets the view preferences, as set during construction.

Return Value
The view preferences.

CountL ( )

TInt CountL()const [virtual]

Gets the total number of contact items in the view.

Return Value
The number of contact items in the view. This includes both sorted and unsorted items.
Leave Codes
KErrNotReadyThe view is not ready for use.

FindL ( TContactItemId )

TInt FindL(TContactItemIdaId)const [virtual]

Searches for a contact item in the view with the specified ID.

Parameters
aIdThe ID of the contact item to search for.
Return Value
If found, the index into the view of the matching item. Otherwise, KErrNotFound.
Leave Codes
KErrNotReadyThe view is not ready for use.

InsertL ( TContactItemId )

IMPORT_C TIntInsertL(TContactItemIdaId)[protected, virtual]

Inserts a contact item into the view, maintaining the view's sort order.

For the item to be inserted, it must exist in the underlying database, and it must be of the correct type according to the view preferences.

This function is called when a contact item or group is added to or changed in the underlying database.

Parameters
aIdThe ID of a contact item that exists in the underlying database.
Return Value
The index at which the item was inserted into the view, or KErrNotFound if the contact item was not found in the underlying database, or it already exists in the view.

NewL ( MContactViewObserver &, const CContactDatabase &, const RContactViewSortOrder &, TContactViewPreferences )

IMPORT_C CContactLocalView *NewL(MContactViewObserver &aObserver,
const CContactDatabase &aDb,
const RContactViewSortOrder &aSortOrder,
TContactViewPreferencesaContactTypes
)[static]

Allocates and constructs the local view object.

The view is sorted according to the sort order and view preferences specified, using a low priority idle time active object. The specified view observer is notified when the view is sorted and ready for use.

Parameters
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. Any attempt to use the view before this notification will Leave with KErrNotReady
aDbThe underlying database that contains the contact items. The view observes the database, so that it handles change events sent from the database.
aSortOrderSpecifies the fields to use to sort the items in the view.
aContactTypesSpecifies which types of contact items should be included in the view and the behaviour for items that do not have content in any of the fields specified in the sort order.
Return Value
The newly constructed local view object.

NewL ( MContactViewObserver &, const CContactDatabase &, const RContactViewSortOrder &, TContactViewPreferences, const TDesC8 & )

IMPORT_C CContactLocalView *NewL(MContactViewObserver &aObserver,
const CContactDatabase &aDb,
const RContactViewSortOrder &aSortOrder,
TContactViewPreferencesaContactTypes,
const TDesC8 &aSortPluginName
)[static]

Allocates and constructs the local view object.

The view is sorted according to the sort order and view preferences specified, using a low priority idle time active object. The specified view observer is notified when the view is sorted and ready for use.

Parameters
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. Any attempt to use the view before this notification will Leave with KErrNotReady
aDbThe underlying database that contains the contact items. The view observes the database, so that it handles change events sent from the database.
aSortOrderSpecifies the fields to use to sort the items in the view.
aContactTypesSpecifies which types of contact items should be included in the view and the behaviour for items that do not have content in any of the fields specified in the sort order.
aSortPluginNameSpecifies a plug-in that will be used to compare view contacts when the the view is sorted. This name is used by ECOM to select the plugin, and is matched with the "default_data" of all ECOM plugins that support the required interface.
Return Value
The newly constructed local view object.

NewL ( MContactViewObserver &, const CContactDatabase &, const RContactViewSortOrder &, TContactViewPreferences, MLplPersistenceLayerFactory *, const TDesC8 & )

IMPORT_C CContactLocalView *NewL(MContactViewObserver &aObserver,
const CContactDatabase &aDb,
const RContactViewSortOrder &aSortOrder,
TContactViewPreferencesaContactTypes,
MLplPersistenceLayerFactory *aFactory,
const TDesC8 &aSortPluginName
)[static]

CContactLocalView contructor, used in the server

NotifySortError ( TInt )

voidNotifySortError(TIntaError)

Notify observers that view construction failed. The error is stored so that if another client tries to open the view they will receive the same error.

Parameters
aErrorLeave code from CIdleContactSorter::RunL

RemoveL ( TContactItemId )

IMPORT_C TIntRemoveL(TContactItemIdaId)[protected, virtual]

Removes a contact item from the view.

This function is called when a contact item or group is deleted from or changed in the underlying database.

Parameters
aIdThe ID of the contact item to remove from the view.
Return Value
The index of the removed item into the view's list of sorted or unsorted contact items, or KErrNotFound if the item was not found in the view.

SetState ( TState )

voidSetState(TStateaState)[protected]

Set database state

Parameters
aStatedatabase state to set.

SortL ( const RContactViewSortOrder & )

IMPORT_C voidSortL(const RContactViewSortOrder &aSortOrder)[protected, virtual]

Sorts the view using the specified sort order, using a low priority idle time active object.

This function is called during view construction and on receipt of certain change events from the underlying database.

Parameters
aSortOrderSpecifies the fields to use to sort the items in the view.

SortOrder ( )

IMPORT_C const RContactViewSortOrder &SortOrder()const

Gets the sort order, as set during construction.

Return Value
The sort order.

SortOrderL ( )

const RContactViewSortOrder &SortOrderL()const [virtual]

Gets the sort order, as set during construction.

This function cannot leave.

Return Value
The sort order.