#include <app/cntviewbase.h>
class CContactViewBase : public CBase |
Protected Attributes | |
---|---|
const CContactDatabase & | iDb |
CContactViewBaseExtension * | iExtension |
TState | iState |
Public Member Enumerations | |
---|---|
enum | TFunction { ECContactViewBaseVirtualFunction1, ECContactViewBaseVirtualFunction2, ECContactViewBaseVirtualFunction3 } |
enum | TSearchType { EFullSearch, EPrefixSearch } |
Protected Member Enumerations | |
---|---|
enum | TState { EInitializing, EReady, ENotReady } |
Public Member Functions | |
---|---|
pure virtual HBufC * | AllFieldsLC(TInt, const TDesC &) |
pure virtual TContactItemId | AtL(TInt) |
virtual IMPORT_C TAny * | CContactViewBase_Reserved_1(TFunction, TAny *) |
IMPORT_C TBool | Close(const MContactViewObserver &) |
pure virtual const CViewContact & | ContactAtL(TInt) |
pure virtual TContactViewPreferences | ContactViewPreferences() |
virtual IMPORT_C void | ContactsMatchingCriteriaL(const MDesCArray &, RPointerArray< CViewContact > &) |
virtual IMPORT_C void | ContactsMatchingPrefixL(const MDesCArray &, RPointerArray< CViewContact > &) |
pure virtual TInt | CountL() |
IMPORT_C TInt | Error() |
pure virtual TInt | FindL(TContactItemId) |
virtual 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) |
pure virtual const RContactViewSortOrder & | SortOrderL() |
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.
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.
Enumerator | Value | Description |
---|---|---|
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.
Defines the contact view states.
IMPORT_C | CContactViewBase | ( | const CContactDatabase & | aDb | ) | [protected] |
Protected C++ constructor.
Initialises the view's state to EInitializing.
Parameter | Description |
---|---|
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.
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.
Parameter | Description |
---|---|
aIndex | The index of the contact item into the view. |
aSeparator | The string to use to separate the fields. |
Returns: Pointer to the contact item descriptor.
TContactItemId | AtL | ( | TInt | aIndex | ) | const [pure virtual] |
Returns the contact item ID at the specified index into the view.
Parameter | Description |
---|---|
aIndex | Index of the contact item ID into the view. |
Returns: The contact item ID.
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.
Parameter | Description |
---|---|
aFunction | an enum value that identifies which helper method is called. |
aParams | parameters to the helper method being called. |
Returns: Any return values of the helper methods called from this function or NULL.
IMPORT_C TBool | Close | ( | const MContactViewObserver & | aObserver | ) |
Removes an observer from the view's observer array.
Any outstanding notifications for aObserver are first cancelled.
Parameter | Description |
---|---|
aObserver | The contact view observer to be removed. |
Returns: ETrue if the view's observer array is empty as a result of the removal; EFalse if it is not empty or if aObserver could not be found in the observer array.
IMPORT_C TInt | CompareContactIds | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | [protected, static] |
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.
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.
Parameter | Description |
---|---|
aFirst | The first contact item. |
aSecond | The second contact item. |
Returns: A positive value indicates that aFirst's field contents are greater than aSecond's (so that aFirst would occur after aSecond in a sort order). A negative value indicates that aFirst's field contents are less than aSecond's (so that aFirst would occur before aSecond in a sort order). Zero indicates that aFirst and aSecond have identical field contents.
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.
Parameter | Description |
---|---|
aIndex | Index of the contact item into the view. |
Returns: The contact item.
IMPORT_C TBool | ContactIsSortable | ( | const CViewContact & | aContact | ) | [protected, static] |
Asks the contact if it is sortable. 'static' function used by Sort Plugin.
TContactViewPreferences | ContactViewPreferences | ( | ) | [pure virtual] |
Gets the view preferences.
Returns: 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.
Parameter | Description |
---|---|
aFindWords | A descriptor array containing one or more search strings. |
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.
Parameter | Description |
---|---|
aFindWords | A descriptor array containing one or more search strings. |
aMatchedContacts | On return, an array of matching contact items. |
TInt | CountL | ( | ) | const [pure virtual] |
Returns the number of contact items in the view.
Returns: The number of contact items in the view.
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.
Returns: The recorded error value. If this does not equal KErrNone, then something is wrong with the view.
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.
Parameter | Description |
---|---|
aContacts | An array of contact items. |
aIndex | An index into the specified array. |
aSeparator | The text to use to separate the fields. |
Returns: A pointer to a heap descriptor containing the contents of each of the contact item's fields. The field separator is appended to each field except the last one. The pointer is left on the cleanup stack.
TInt | FindL | ( | TContactItemId | aId | ) | const [pure virtual] |
Returns the index into the view of the specified contact item.
Parameter | Description |
---|---|
aId | The contact item ID to search for. |
Returns: The index into the view of the contact item ID, or KErrNotFound if no matching ID can be found.
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.
Parameter | Description |
---|---|
aIndexes | An array of indexes into this view. |
aContactIds | On return, an array to which the contact item IDs of each of the indexed items are appended. |
IMPORT_C TUid | GetViewFindConfigPlugin | ( | ) |
Gets the UID of the view's find configuration plug-in, as set by SetViewFindConfigPlugin().
See also: CContactViewFindConfigInterface
Returns: The UID of the view's find configuration plug-in. KNullUid if none has been set.
IMPORT_C TBool | IdsEqual | ( | const TContactIdWithMapping & | aFirst, |
const TContactIdWithMapping & | aSecond | |||
) | [protected, static] |
Tests whether the IDs of two contact items are the same.
Parameter | Description |
---|---|
aFirst | The contact ID/view index struct representing the first item. |
aSecond | The contact ID/view index struct representing the second item. |
Returns: True if the IDs match, false if not.
IMPORT_C TBool | IdsMatch | ( | const CViewContact & | aFirst, |
const CViewContact & | aSecond | |||
) | [protected, static] |
Tests whether the IDs of two contact items are the same.
Parameter | Description |
---|---|
aFirst | The first contact item. |
aSecond | The second contact item. |
Returns: True if the IDs match, otherwise false.
IMPORT_C TBool | IndexesEqual | ( | const TContactIdWithMapping & | aFirst, |
const TContactIdWithMapping & | aSecond | |||
) | [protected, static] |
Tests whether the view indexes of two contact items are the same.
Parameter | Description |
---|---|
aFirst | The contact ID/view index struct representing the first item. |
aSecond | The contact ID/view index struct representing the second item. |
Returns: True if the indexes match, false if not.
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.
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.
void | LoadViewSortPluginL | ( | TUid | aSortPluginUid, |
TContactViewPreferences & | aViewPreferences | |||
) | [protected] |
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.
Parameter | Description |
---|---|
aContact | The contact item to search. |
aFindWords | A descriptor array containing one or more search strings. |
Returns: True if all of the search strings were present in the contact item's fields. False if not.
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.
Parameter | Description |
---|---|
aContact | The contact item to search. |
aFindWords | A descriptor array containing one or more search strings. |
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. |
Returns: True if all of the search strings were present in the contact item's fields. False if not.
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().
Parameter | Description |
---|---|
aContact | The contact item to search. |
aFindWords | A descriptor array containing one or more search strings. |
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. |
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(). |
Returns: True if all of the search strings were present in the contact item's fields. False if not.
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.
Parameter | Description |
---|---|
aObserver | The contact view observer to notify. This must have previously been added to the view's observer array. |
aEvent | Identifies the event that occurred. |
Returns: KErrNone if the function completed without error, otherwise one of the standard error codes.
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.
Parameter | Description |
---|---|
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.
Parameter | Description |
---|---|
aObserver | The contact view observer to add. |
Returns: A standard error code, or KErrNone if the function completed without an error.
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.
Parameter | Description |
---|---|
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().
See also: CContactViewFindConfigInterface
Parameter | Description |
---|---|
aUid | The UID of the view's find configuration plug-in. |
const RContactViewSortOrder & | SortOrderL | ( | ) | const [pure virtual] |
Gets the view's sort order.
Returns: The sort order.