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.
Public Member Functions | |
---|---|
HBufC * | AllFieldsLC ( TInt , const TDesC &) |
TContactItemId | AtL ( TInt ) |
IMPORT_C TAny * | CContactViewBase_Reserved_1 ( TFunction , TAny *) |
IMPORT_C TBool | Close (const MContactViewObserver &) |
const CViewContact & | ContactAtL ( TInt ) |
TContactViewPreferences | ContactViewPreferences () |
IMPORT_C void | ContactsMatchingCriteriaL (const MDesCArray &, RPointerArray < CViewContact > &) |
IMPORT_C void | ContactsMatchingPrefixL (const MDesCArray &, RPointerArray < CViewContact > &) |
TInt | CountL () |
IMPORT_C TInt | Error () |
TInt | FindL ( TContactItemId ) |
IMPORT_C void | GetContactIdsL (const CArrayFix < TInt > &, CContactIdArray &) |
IMPORT_C TUid | GetViewFindConfigPlugin () |
IMPORT_C TUid | GetViewSortPluginImplUid () |
IMPORT_C TInt | Open ( MContactViewObserver &) |
IMPORT_C void | OpenL ( MContactViewObserver &) |
IMPORT_C void | SetViewFindConfigPlugin ( TUid ) |
const RContactViewSortOrder & | SortOrderL () |
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 &) |
Public Member Enumerations | |
---|---|
enum | TFunction { ECContactViewBaseVirtualFunction1 , ECContactViewBaseVirtualFunction2 , ECContactViewBaseVirtualFunction3 } |
enum | TSearchType { EFullSearch , EPrefixSearch } |
Protected Member Enumerations | |
---|---|
enum | TState { EInitializing , EReady , ENotReady } |
Protected Attributes | |
---|---|
const CContactDatabase & | iDb |
CContactViewBaseExtension * | iExtension |
TState | iState |
Private Attributes | |
---|---|
CIdle * | iAsyncNotifier |
RPointerArray < MContactViewObserver > | iObserverArray |
RArray < TObserverAndEvent > | iOutstandingNotifications |
IMPORT_C | CContactViewBase | ( | const CContactDatabase & | aDb | ) | [protected] |
Protected C++ constructor.
Initialises the view's state to EInitializing.
const CContactDatabase & aDb | The database that contains the contact items. |
IMPORT_C | ~CContactViewBase | ( | ) | [protected] |
Destructor.
Cancels all outstanding notifications and deletes all resources owned by the object.
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.
TInt | AsyncNotifyCallBack | ( | TAny * | aSelf | ) | [private, static] |
TAny * aSelf |
TContactItemId | AtL | ( | TInt | aIndex | ) | const [pure virtual] |
Returns the contact item ID at the specified index into the view.
TInt aIndex | Index of the contact item ID into the view. |
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.
IMPORT_C TBool | Close | ( | const MContactViewObserver & | aObserver | ) |
Removes an observer from the view's observer array.
Any outstanding notifications for aObserver are first cancelled.
const MContactViewObserver & aObserver | The contact view observer to be removed. |
IMPORT_C TInt | CompareContactIds | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | [protected, static] |
const CViewContact & aFirst | |
const CViewContact & aSecond |
IMPORT_C TInt | CompareContactsAndIdsL | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | const [protected] |
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.
const CViewContact & aFirst | |
const CViewContact & aSecond |
IMPORT_C TInt | CompareFieldsL | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | [protected, static] |
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.
const CViewContact & aFirst | The first contact item. |
const CViewContact & aSecond | The second contact item. |
TInt | CompareFieldsWithCollationLevel | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond, | |||
TInt | aCollationLevel, | |||
TCollationMethod * | aCollateMethod | |||
) | [private, static] |
const CViewContact & aFirst | |
const CViewContact & aSecond | |
TInt aCollationLevel | |
TCollationMethod * aCollateMethod |
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.
const CViewContact & | ContactAtL | ( | TInt | aIndex | ) | const [pure virtual] |
Returns the contact item at the specified index into the view.
TInt aIndex | Index of the contact item into the view. |
IMPORT_C TBool | ContactIsSortable | ( | const CViewContact & | aContact | ) | [protected, static] |
Asks the contact if it is sortable. 'static' function used by Sort Plugin.
const CViewContact & aContact |
TBool | ContactMatchesCriteriaL | ( | const CViewContact & | aContact, |
const MDesCArray & | aFindWords, | |||
CContactViewBase::CContactViewBaseExtension * | aExtension | |||
) | [private, static] |
const CViewContact & aContact | |
const MDesCArray & aFindWords | |
CContactViewBase::CContactViewBaseExtension * aExtension |
TContactViewPreferences | ContactViewPreferences | ( | ) | [pure virtual] |
Gets the view preferences.
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.
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
RPointerArray < CViewContact > & aMatchedContacts | On return, an array of matching contact items. |
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.
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
RPointerArray < CViewContact > & aMatchedContacts | On return, an array of matching contact items. |
TInt | CountL | ( | ) | const [pure virtual] |
Returns the number of contact items in the view.
CDesCArrayFlat * | CreateFindWordArrayLC | ( | const MDesCArray & | aFindWords, |
TSearchType | aSearchType | |||
) | [private, static] |
const MDesCArray & aFindWords | |
TSearchType aSearchType |
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.
IMPORT_C HBufC * | FieldsWithSeparatorLC | ( | const RPointerArray < CViewContact > & | aContacts, |
TInt | aIndex, | |||
const TDesC & | aSeparator | |||
) | const [protected] |
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.
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. |
TInt | FindL | ( | TContactItemId | aId | ) | const [pure virtual] |
Returns the index into the view of the specified contact item.
TContactItemId aId | The contact item ID to search for. |
TUid | FindSortPluginImplL | ( | const TDesC8 & | aSortPluginName, |
TBool | aWildCard = EFalse | |||
) | const [protected] |
IMPORT_C void | GetContactIdsL | ( | const CArrayFix < TInt > & | aIndexes, |
CContactIdArray & | aContactIds | |||
) | [virtual] |
Gets an array containing the IDs of the contact items at the specified view indexes.
The IDs are appended to the array.
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. |
void | GetContactsMatchingFilterL | ( | TInt | aFilter, |
RArray < TContactIdWithMapping > & | aMatchingContacts | |||
) | [private] |
Gets an array containing the IDs of the contact items that match the filter supplied by the client.
TInt aFilter | Filter The filter to use |
RArray < TContactIdWithMapping > & aMatchingContacts | Array of matching contact IDs |
IMPORT_C TUid | GetViewFindConfigPlugin | ( | ) |
Gets the UID of the view's find configuration plug-in, as set by SetViewFindConfigPlugin() .
IMPORT_C TBool | IdsEqual | ( | const TContactIdWithMapping & | aFirst, |
const TContactIdWithMapping & | aSecond | |||
) | [protected, static] |
Tests whether the IDs of two contact items are the same.
const TContactIdWithMapping & aFirst | The contact ID/view index struct representing the first item. |
const TContactIdWithMapping & aSecond | The contact ID/view index struct representing the second item. |
IMPORT_C TBool | IdsMatch | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | [protected, static] |
Tests whether the IDs of two contact items are the same.
const CViewContact & aFirst | The first contact item. |
const CViewContact & aSecond | The second contact item. |
IMPORT_C TBool | IndexesEqual | ( | const TContactIdWithMapping & | aFirst, |
const TContactIdWithMapping & | aSecond | |||
) | [protected, static] |
Tests whether the view indexes of two contact items are the same.
const TContactIdWithMapping & aFirst | The contact ID/view index struct representing the first item. |
const TContactIdWithMapping & aSecond | The contact ID/view index struct representing the second item. |
TInt | InsertContactInView | ( | RPointerArray < CViewContact > & | aContacts, |
const CViewContact * | aNewContact, | |||
TBool | aSortByIdOnly, | |||
TInt * | aIndex | |||
) | const [protected] |
Does a binary search of the contacts array, and inserts a new contact. Uses the current sort plugin, if any.
RPointerArray < CViewContact > & aContacts | |
const CViewContact * aNewContact | |
TBool aSortByIdOnly | |
TInt * aIndex |
TBool | IsContactSortable | ( | const CViewContact & | aContact, |
TContactViewPreferences & | aViewPreferences | |||
) | const [protected] |
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.
const CViewContact & aContact | |
TContactViewPreferences & aViewPreferences |
void | LoadViewSortPluginL | ( | TUid | aSortPluginUid, |
TContactViewPreferences & | aViewPreferences | |||
) | [protected] |
TUid aSortPluginUid | |
TContactViewPreferences & aViewPreferences |
void | MatchContactsL | ( | const MDesCArray & | aFindWords, |
RPointerArray < CViewContact > & | aMatchedContacts, | |||
TSearchType | aSearchType | |||
) | [private] |
const MDesCArray & aFindWords | |
RPointerArray < CViewContact > & aMatchedContacts | |
TSearchType aSearchType |
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.
const CViewContact & aContact | The contact item to search. |
const MDesCArray & aFindWords | A descriptor array containing one or more search strings. |
IMPORT_C TBool | MatchesCriteriaL | ( | const CViewContact & | aContact, |
const MDesCArray & | aFindWords, | |||
TSearchType | aSearchType | |||
) | [protected, static] |
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.
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. |
IMPORT_C TBool | MatchesCriteriaL | ( | const CViewContact & | aContact, |
const MDesCArray & | aFindWords, | |||
TSearchType | aSearchType, | |||
CContactViewBase::CContactViewBaseExtension * | aExtension | |||
) | [protected, static] |
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() .
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(). |
IMPORT_C TInt | NotifyObserverAsync | ( | MContactViewObserver & | aObserver, |
const TContactViewEvent & | aEvent | |||
) | [protected] |
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.
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. |
IMPORT_C void | NotifyObservers | ( | const TContactViewEvent & | aEvent | ) | [protected] |
Called by derived view classes to notify their observers synchronously of an event, by calling their HandleContactViewEvent() function.
const TContactViewEvent & aEvent | Identifies the event that occurred. |
IMPORT_C TInt | Open | ( | MContactViewObserver & | aObserver | ) |
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.
MContactViewObserver & aObserver | The contact view observer to add. |
IMPORT_C void | OpenL | ( | MContactViewObserver & | aObserver | ) |
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.
MContactViewObserver & aObserver | The contact view observer to be added. |
IMPORT_C void | SetViewFindConfigPlugin | ( | TUid | aUid | ) |
Sets the UID of the view's find configuration plug-in to use in calls to ContactsMatchingCriteriaL() , ContactsMatchingPrefixL() and MatchesCriteriaL() .
TUid aUid | The UID of the view's find configuration plug-in. |
const RContactViewSortOrder & | SortOrderL | ( | ) | const [pure virtual] |
Gets the view's sort order.
TInt | TextCompareFieldsL | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | const [private] |
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.
const CViewContact & aFirst | The first contact item. |
const CViewContact & aSecond | The second contact item. |
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.
ECContactViewBaseVirtualFunction1 |
Identifies the function CContactViewBase::GetContactIdsL() . |
ECContactViewBaseVirtualFunction2 |
Identifies the function CContactViewBase::GetContactsMatchingFilterL() . |
ECContactViewBaseVirtualFunction3 |
Identifies the function CContactViewBase::InsertContactInView() . |
Search type.
This controls whether a search term can occur anywhere in a contact item field, or just at the beginning of the field.
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. |
Defines the contact view states.
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. |
RPointerArray < MContactViewObserver > | iObserverArray | [private] |
RArray < TObserverAndEvent > | iOutstandingNotifications | [private] |
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.