#include <cntviewbase.h>
Link against:
cntmodel.lib
class CContactLocalView : public CContactViewBase, public MContactDbObserver;
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.
Derivation
MContactDbObserver
- The interface for an observer that handles changes to a contact database
CBase
- Base class for all classes to be instantiated on the heap
CContactLocalView
- An instantiable base class for contact views
Members
Defined in CContactLocalView
:
Inherited from CBase
:
Inherited from CContactViewBase
:
Close()
Removes an observer from the view's observer array
CompareFieldsL()
Collates two contact items' field contents
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 CContactLocalView *NewL(MContactViewObserver &aObserver, const CContactDatabase &aDb, const RContactViewSortOrder
&aSortOrder, TContactViewPreferences aContactTypes);
Description
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
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. Any attempt to use the view before this notification will Leave with KErrNotReady
|
const CContactDatabase &aDb |
The underlying database that contains the contact items. The view observes the database, so that it handles change events
sent from the database.
|
const RContactViewSortOrder &aSortOrder |
Specifies the fields to use to sort the items in the view.
|
TContactViewPreferences aContactTypes |
Specifies 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
static IMPORT_C CContactLocalView *NewL(MContactViewObserver &aObserver, const CContactDatabase &aDb, const RContactViewSortOrder
&aSortOrder, TContactViewPreferences aContactTypes, const TDesC8 &aSortPluginName);
Description
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
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. Any attempt to use the view before this notification will Leave with KErrNotReady
|
const CContactDatabase &aDb |
The underlying database that contains the contact items. The view observes the database, so that it handles change events
sent from the database.
|
const RContactViewSortOrder &aSortOrder |
Specifies the fields to use to sort the items in the view.
|
TContactViewPreferences aContactTypes |
Specifies 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.
|
const TDesC8 &aSortPluginName |
Specifies 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
protected: IMPORT_C ~CContactLocalView();
Description
Destructor.
Deletes all resources owned by the object, and removes itself as the contact database observer.
protected: IMPORT_C CContactLocalView(const CContactDatabase &aDb, TContactViewPreferences aContactTypes);
Description
Protected C++ constructor.
Called by NewL()
.
Parameters
const CContactDatabase &aDb |
The underlying database that contains the contact items.
|
TContactViewPreferences aContactTypes |
Specifies 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.
|
|
protected: IMPORT_C void ConstructL(MContactViewObserver &aObserver, const RContactViewSortOrder &aSortOrder);
Description
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
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. Any attempt to use the view before this notification will Leave with KErrNotReady.
|
const RContactViewSortOrder &aSortOrder |
Specifies the fields to use to sort the items in the view.
|
|
IMPORT_C const RContactViewSortOrder &SortOrder() const;
Description
Gets the sort order, as set during construction.
Return value
virtual TContactItemId AtL(TInt aIndex) const;
Description
Returns the ID of the contact item at a specified index into the view.
Parameters
TInt aIndex |
An index into the view.
|
|
Return value
Leave codes
KErrNotFound |
The index is out of bounds.
|
KErrNotReady |
The view is not ready for use.
|
|
virtual TInt CountL() const;
Description
Gets the total number of contact items in the view.
Return value
TInt
|
The number of contact items in the view. This includes both sorted and unsorted items.
|
|
Leave codes
KErrNotReady |
The view is not ready for use.
|
|
virtual TInt FindL(TContactItemId aId) const;
Description
Searches for a contact item in the view with the specified ID.
Parameters
Return value
TInt
|
If found, the index into the view of the matching item. Otherwise, KErrNotFound.
|
|
Leave codes
KErrNotReady |
The view is not ready for use.
|
|
virtual HBufC *AllFieldsLC(TInt aIndex, const TDesC &aSeparator) const;
Description
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
TInt aIndex |
The index of the contact item into the view.
|
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
Returns the contact item at a specified index into the view.
Parameters
TInt aIndex |
An index into the view.
|
|
Return value
const CViewContact & |
The contact item at the specified index.
|
|
Leave codes
KErrNotFound |
The index is out of bounds.
|
KErrNotReady |
The view is not ready for use.
|
|
virtual TContactViewPreferences ContactViewPreferences();
Description
Gets the view preferences, as set during construction.
Return value
virtual const RContactViewSortOrder &SortOrderL() const;
Description
Gets the sort order, as set during construction.
This function cannot leave.
Return value
CContactViewBase_Reserved_1()
virtual IMPORT_C TAny *CContactViewBase_Reserved_1(TFunction aFunction, TAny *aParams);
Description
This is a reserved virtual exported function that is used for BC proofing against addition of new exported virtual functions.
This function now aids addition of new exported virtual methods without having to break BC,by simply having those virtual
methods as non-virtual and helper methods, called from this one and only reserved virtual exported method.A public enumeration
type that is defined in the base class CContactViewBase
identifies which of the helper 'virtual' methods are being called. All derived classes of CContactViewBase
that are public should mandatorily implement this method.
Returns any return values of the helper methods called from this function.
Parameters
TFunction aFunction |
an enum value that identifies which helper method is called.
|
TAny *aParams |
parameters to the helper method being called.
|
|
Return value
TAny *
|
Any return values of the helper methods called from this function or NULL.
|
|
protected: virtual IMPORT_C void SortL(const RContactViewSortOrder &aSortOrder);
Description
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
protected: virtual IMPORT_C TInt InsertL(TContactItemId aId);
Description
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
TContactItemId aId |
The ID of a contact item that exists in the underlying database.
|
|
Return value
TInt
|
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.
|
|
protected: virtual IMPORT_C TInt RemoveL(TContactItemId aId);
Description
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
TContactItemId aId |
The ID of the contact item to remove from the view.
|
|
Return value
TInt
|
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.
|
|
private: virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent);
Description
Tests the contact database observer event type and handles it. The ID of a contact affected by the change event, if relevant,
can be retrieved via TContactDbObserverEvent::iContactId
.
Parameters
CContactLocalView_Reserved_1()
private: virtual IMPORT_C void CContactLocalView_Reserved_1();
Description
CContactLocalView_Reserved_2()
private: virtual IMPORT_C void CContactLocalView_Reserved_2();
Description
protected: RContactViewSortOrder iSortOrder;
Description
The sort order. This is set during construction or when SortL()
is called.