CContactViewBase Class Reference
class CContactViewBase : public CBase |
The abstract base class for all contact view classes.
All contact views operate asynchronously, so users of the view must observe it, by implementing the MContactViewObserver interface. Immediately after construction, views are not in a usable state (the underlying data may be being sorted, for instance). Only after the user has received a TContactViewEvent::EReady event may the view be used.
View observers are also notified when changes occur, for instance when the view's state changes (see TState), when an error occurs, or when an item is added or removed.
Nested Classes and Structures
Protected Member Functions |
---|
| CContactViewBase(const CContactDatabase &) |
| ~CContactViewBase() |
IMPORT_C TInt | CompareContactIds(const CViewContact &, const CViewContact &) |
IMPORT_C TInt | CompareContactsAndIdsL(const CViewContact &, const CViewContact &) |
IMPORT_C TInt | CompareFieldsL(const CViewContact &, const CViewContact &) |
IMPORT_C void | ConstructL() |
IMPORT_C TBool | ContactIsSortable(const CViewContact &) |
IMPORT_C HBufC * | FieldsWithSeparatorLC(const RPointerArray< CViewContact > &, TInt, const TDesC &) |
TUid
| FindDefaultViewSortPluginImplL() |
TUid
| FindSortPluginImplL(const TDesC8 &, TBool) |
IMPORT_C TBool | IdsEqual(const TContactIdWithMapping &, const TContactIdWithMapping &) |
IMPORT_C TBool | IdsMatch(const CViewContact &, const CViewContact &) |
IMPORT_C TBool | IndexesEqual(const TContactIdWithMapping &, const TContactIdWithMapping &) |
TInt
| InsertContactInView(RPointerArray< CViewContact > &, const CViewContact *, TBool, TInt *) |
TBool
| IsContactSortable(const CViewContact &, TContactViewPreferences &) |
void | LoadViewSortPluginL(TUid, TContactViewPreferences &) |
IMPORT_C TBool | MatchesCriteriaL(const CViewContact &, const MDesCArray &) |
IMPORT_C TBool | MatchesCriteriaL(const CViewContact &, const MDesCArray &, TSearchType) |
IMPORT_C TBool | MatchesCriteriaL(const CViewContact &, const MDesCArray &, TSearchType, CContactViewBase::CContactViewBaseExtension *) |
IMPORT_C TInt | NotifyObserverAsync(MContactViewObserver &, const TContactViewEvent &) |
IMPORT_C void | NotifyObservers(const TContactViewEvent &) |
CViewContactSortPlugin * | SortPluginImpl() |
Private Member Functions |
---|
TInt
| AsyncNotifyCallBack(TAny *) |
TInt
| CompareFieldsWithCollationLevel(const CViewContact &, const CViewContact &, TInt, TCollationMethod *) |
TBool
| ContactMatchesCriteriaL(const CViewContact &, const MDesCArray &, CContactViewBase::CContactViewBaseExtension *) |
CDesCArrayFlat * | CreateFindWordArrayLC(const MDesCArray &, TSearchType) |
void | GetContactsMatchingFilterL(TInt, RArray< TContactIdWithMapping > &) |
TInt
| GetErrorValueFromExtensionClass() |
void | MatchContactsL(const MDesCArray &, RPointerArray< CViewContact > &, TSearchType) |
TInt
| TextCompareFieldsL(const CViewContact &, const CViewContact &) |
Constructor & Destructor Documentation
CContactViewBase(const CContactDatabase &)
Protected C++ constructor.
Initialises the view's state to EInitializing.
~CContactViewBase()
IMPORT_C | ~CContactViewBase | ( | ) | [protected] |
Destructor.
Cancels all outstanding notifications and deletes all resources owned by the object.
Member Functions Documentation
AllFieldsLC(TInt, const TDesC &)
HBufC * | AllFieldsLC | ( | TInt | aIndex, |
| const TDesC & | aSeparator |
| ) | const [pure virtual] |
Returns a descriptor containing the contents of all fields 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. |
AsyncNotifyCallBack(TAny *)
TInt
| AsyncNotifyCallBack | ( | TAny * | aSelf | ) | [private, static] |
AtL(TInt)
Returns the contact item ID at the specified index into the view.
Parameters
TInt aIndex | Index of the contact item ID into the view. |
CContactViewBase_Reserved_1(TFunction, TAny *)
IMPORT_C TAny * | CContactViewBase_Reserved_1 | ( | TFunction | aFunction, |
| TAny * | aParams |
| ) | [virtual] |
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. |
Close(const MContactViewObserver &)
Removes an observer from the view's observer array.
Any outstanding notifications for aObserver are first cancelled.
CompareContactIds(const CViewContact &, const CViewContact &)
CompareContactsAndIdsL(const CViewContact &, const CViewContact &)
Used for view sorting and insersion. In order to give a stable result if contact details match, it falls back to comparing contact IDs. If a contact view sort plugin is loaded it uses its SortCompareViewContactsL() method.
CompareFieldsL(const CViewContact &, const CViewContact &)
Collates two contact items' field contents.
This is done by comparing each contact item on a field by field basis starting with the loosest collation level initially, and then progressing to tighter collation levels only if the items are considered the same at the looser level. This is required so that items differing by case only are sorted correctly. If a field isn't present, then the comparison is done using the first field that is present.
CompareFieldsWithCollationLevel(const CViewContact &, const CViewContact &, TInt, TCollationMethod *)
ConstructL()
IMPORT_C void | ConstructL | ( | ) | [protected] |
Protected second phase constructor.
Called from a derived class's ConstructL(). Creates the view's asynchronous notifier and adds it to the active scheduler.
ContactAtL(TInt)
Returns the contact item at the specified index into the view.
Parameters
TInt aIndex | Index of the contact item into the view. |
ContactIsSortable(const CViewContact &)
Asks the contact if it is sortable. 'static' function used by Sort Plugin.
ContactMatchesCriteriaL(const CViewContact &, const MDesCArray &, CContactViewBase::CContactViewBaseExtension *)
ContactViewPreferences()
Gets the view preferences.
ContactsMatchingCriteriaL(const MDesCArray &, RPointerArray< CViewContact > &)
IMPORT_C void | ContactsMatchingCriteriaL | ( | const MDesCArray & | aFindWords, |
| RPointerArray< CViewContact > & | aMatchedContacts |
| ) | [virtual] |
Searches all contact items in the view for fields that contain all of the search strings specified.
The search uses wildcard matching so that the search strings can occur anywhere in the item's fields. For a match to occur, all of the search strings must be found in a contact item.
Parameters
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
RPointerArray< CViewContact > & aMatchedContacts | On return, an array of matching contact items. |
ContactsMatchingPrefixL(const MDesCArray &, RPointerArray< CViewContact > &)
IMPORT_C void | ContactsMatchingPrefixL | ( | const MDesCArray & | aFindWords, |
| RPointerArray< CViewContact > & | aMatchedContacts |
| ) | [virtual] |
Searches all contact items in the view for fields that contain all of the search strings specified.
Unlike ContactsMatchingCriteriaL(), the search term can only occur at the beginning of a field.
Parameters
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
RPointerArray< CViewContact > & aMatchedContacts | On return, an array of matching contact items. |
CountL()
TInt
| CountL | ( | ) | const [pure virtual] |
Returns the number of contact items in the view.
CreateFindWordArrayLC(const MDesCArray &, TSearchType)
Error()
IMPORT_C TInt | Error | ( | ) | const |
Gets the recorded error value. If an error occurs within the view, before each of the views observers are notified, then the view records the error code internally. This function provides access to a copy of that error code.
FieldsWithSeparatorLC(const RPointerArray< CViewContact > &, TInt, const TDesC &)
Allocates and returns a descriptor filled with the contents of all the fields in a contact item.
The fields are separated by the specified separator.
Parameters
const RPointerArray< CViewContact > & aContacts | An array of contact items. |
TInt aIndex | An index into the specified array. |
const TDesC & aSeparator | The text to use to separate the fields. |
FindDefaultViewSortPluginImplL()
TUid
| FindDefaultViewSortPluginImplL | ( | ) | const [protected] |
FindL(TContactItemId)
Returns the index into the view of the specified contact item.
FindSortPluginImplL(const TDesC8 &, TBool)
TUid
| FindSortPluginImplL | ( | const TDesC8 & | aSortPluginName, |
| TBool | aWildCard = EFalse |
| ) | const [protected] |
Parameters
const TDesC8 & aSortPluginName | |
TBool aWildCard = EFalse | |
GetContactIdsL(const CArrayFix< TInt > &, CContactIdArray &)
Gets an array containing the IDs of the contact items at the specified view indexes.
The IDs are appended to the array.
Parameters
const CArrayFix< TInt > & aIndexes | An array of indexes into this view. |
CContactIdArray & aContactIds | On return, an array to which the contact item IDs of each of the indexed items are appended. |
GetContactsMatchingFilterL(TInt, RArray< TContactIdWithMapping > &)
Gets an array containing the IDs of the contact items that match the filter supplied by the client.
GetErrorValueFromExtensionClass()
TInt
| GetErrorValueFromExtensionClass | ( | ) | [private] |
GetViewFindConfigPlugin()
IMPORT_C TUid | GetViewFindConfigPlugin | ( | ) | |
GetViewSortPluginImplUid()
IMPORT_C TUid | GetViewSortPluginImplUid | ( | ) | const |
IdsEqual(const TContactIdWithMapping &, const TContactIdWithMapping &)
Tests whether the IDs of two contact items are the same.
IdsMatch(const CViewContact &, const CViewContact &)
Tests whether the IDs of two contact items are the same.
IndexesEqual(const TContactIdWithMapping &, const TContactIdWithMapping &)
Tests whether the view indexes of two contact items are the same.
InsertContactInView(RPointerArray< CViewContact > &, const CViewContact *, TBool, TInt *)
Does a binary search of the contacts array, and inserts a new contact. Uses the current sort plugin, if any.
IsContactSortable(const CViewContact &, TContactViewPreferences &)
This function determines whether a contact should be added to the normal sorted array (iContacts) or put into the alternative iUnSortedContacts array. Depending on the view preferences, these "unsorted" contacts are either ignored (deleted), or added to the beginning or end of the iContacts sorted list by At(), Find() etc... methods.
LoadViewSortPluginL(TUid, TContactViewPreferences &)
MatchContactsL(const MDesCArray &, RPointerArray< CViewContact > &, TSearchType)
MatchesCriteriaL(const CViewContact &, const MDesCArray &)
IMPORT_C TBool | MatchesCriteriaL | ( | const CViewContact & | aContact, |
| const MDesCArray & | aFindWords |
| ) | [protected, virtual] |
Searches a single contact item for fields that contain one or more search strings.
The search uses wildcard matching so that the search strings can occur anywhere in any of the item's fields. For a match to occur, all of the search strings must be found in the contact item.
Any find configuration plug-in that has been set (by calling SetViewFindConfigPlugin()) will be used.
Parameters
const CViewContact & aContact | The contact item to search. |
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
MatchesCriteriaL(const CViewContact &, const MDesCArray &, TSearchType)
Searches a single contact item for fields that contain one or more search strings.
The search type indicates whether the search strings can occur anywhere in a field, or must occur at the start of a field only. For a match to occur, all of the search strings must be found in the contact item.
This function does not use any find configuration plug-in that has been set (by calling SetViewFindConfigPlugin()), so new code should use one of the other overloads instead. This function has been maintained for binary compatibility with previous OS versions.
Parameters
const CViewContact & aContact | The contact item to search. |
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
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 a field. |
MatchesCriteriaL(const CViewContact &, const MDesCArray &, TSearchType, CContactViewBase::CContactViewBaseExtension *)
Searches a single contact item for fields that contain one or more search strings.
The search type indicates whether the search strings can occur anywhere in a field, or must occur at the start of a field only. For a match to occur, all of the search strings must be found in the contact item.
If a find configuration plug-in UID is specified in the fourth parameter, this overload uses it, loading it first if necessary. This overrides any plug-in that had previously been set by a call to SetViewFindConfigPlugin().
Parameters
const CViewContact & aContact | The contact item to search. |
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
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 a field. |
CContactViewBase::CContactViewBaseExtension * aExtension | Optionally, this can be used to specify the UID of a find configuration plug-in, overriding any that has previously been set by a call to SetViewFindConfigPlugin(). |
NotifyObserverAsync(MContactViewObserver &, const TContactViewEvent &)
Called to notify a single view observer asynchronously of an event.
If other notifications are outstanding, this notification is appended to the queue.
If the view's asynchronous notifier is not active, it is started as a background task.
This function is called by OpenL() and Open() to notify the observer that the view is ready.
Parameters
MContactViewObserver & aObserver | The contact view observer to notify. This must have previously been added to the view's observer array. |
const TContactViewEvent & aEvent | Identifies the event that occurred. |
NotifyObservers(const TContactViewEvent &)
Called by derived view classes to notify their observers synchronously of an event, by calling their HandleContactViewEvent() function.
Open(MContactViewObserver &)
Appends an observer to the view's observer array.
If the view's state is EReady, the observer is notified asynchronously that the view is ready.
This function does not leave; an error code is returned instead.
OpenL(MContactViewObserver &)
Appends an observer to the view's observer array.
If the view's state is EReady, the observer is notified asynchronously that the view is ready.
An error causes the function to leave.
SetViewFindConfigPlugin(TUid)
IMPORT_C void | SetViewFindConfigPlugin | ( | TUid | aUid | ) | |
Parameters
TUid aUid | The UID of the view's find configuration plug-in. |
SortOrderL()
Gets the view's sort order.
TextCompareFieldsL(const CViewContact &, const CViewContact &)
Collates two contact items' field contents.
This is done by comparing each contact item on a field by field basis starting with the loosest collation level initially, and then progressing to tighter collation levels only if the items are considered the same at the looser level. This is required so that items differing by case only are sorted correctly. If a field isn't present, then the comparison is done using the first field that is present.
Faster than static CompareFieldsL() method as it uses prefetched collation method.
Member Enumerations Documentation
Enum TFunction
Identifies the functions that have been added to CContactViewBase, or that may be added in the future. This identifier is passed to the reserved virtual function CContactViewBase_Reserved_1() and enables the addition of new virtual methods without breaking binary compatibility.
Enum TSearchType
Search type.
This controls whether a search term can occur anywhere in a contact item field, or just at the beginning of the field.
Enumerators
EFullSearch |
The search uses full wildcard matching so that the search string can occur anywhere in the item's fields.
|
EPrefixSearch |
The search uses partial wildcard matching so that the search string can only occur at the beginning of the item's fields.
|
Enum TState
Defines the contact view states.
Enumerators
EInitializing |
The view is initialising.
This is the view's state immediately after construction or after a significant change (e.g CurrentDatabaseChanged or UnknownChanges), indicating that it can't be used yet.
|
EReady |
The view is ready to be used.
|
ENotReady |
The view is not ready to be used, for instance immediately after the sort order has changed, or after an error has occurred.
|
Member Data Documentation
CIdle * iAsyncNotifier
CIdle * | iAsyncNotifier | [private] |
const CContactDatabase & iDb
CContactViewBaseExtension * iExtension
RPointerArray< MContactViewObserver > iObserverArray
RArray< TObserverAndEvent > iOutstandingNotifications
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.