class CPbkContactEngine : public CBase |
The main entrypoint to the Phonebook contact engine. The Phonebook contact engine builds on top of the Symbian Contacts model and implements platform specific functionality and policies that can be reused and followed by clients to implement functionality that is better integrated to the platform functionality. Functionality like contact field typing is implemented by this engine.
Private Member Functions | |
---|---|
CPbkContactEngine () | |
void | AddObserverL ( MPbkContactDbObserver *) |
void | ConnectFsL ( RFs *) |
void | ConstructL (const TDesC *, TBool , RFs *) |
void | CreateDbConnectionL (const TDesC *, TBool , TInt &, TBool ) |
void | HandleDatabaseEventL ( TContactDbObserverEvent ) |
void | ReadResourcesL ( TBool &) |
void | RemoveObserver ( MPbkContactDbObserver *) |
void | SendEventToAllObservers (const TContactDbObserverEvent &) |
void | SendImmidiateEventToAllObservers ( TContactDbObserverEventType , TContactItemId , TBool ) |
void | doDeleteContactL ( TContactItemId ) |
Public Member Enumerations | |
---|---|
enum | TPbkNameOrder { EPbkNameOrderLastNameFirstName = 0, EPbkNameOrderFirstNameLastName , EPbkNameOrderNotDefined } |
~CPbkContactEngine | ( | ) |
Destructor. Destroys this object and closes the contact database connection. REComSession::FinalClose() is called. Notice that FinalClose -call releases resource handles of already destroyed ECom plugins also outside CPbkContactEngine . See REComSession documentation.
IMPORT_C void | AddContactToGroupL | ( | TContactItemId | aItemId, |
TContactItemId | aGroupId | |||
) |
Adds a Contact to a group.
TContactItemId aItemId | Contact to be added to group. |
TContactItemId aGroupId | Group where the contact will be added to. |
IMPORT_C TContactItemId | AddNewContactL | ( | CPbkContactItem & | aContact, |
TBool | aImmediateNotify = EFalse | |||
) |
Adds a new contact to the contact database.
CPbkContactItem & aContact | The new contact item to add. |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
void | AddObserverL | ( | MPbkContactDbObserver * | aObserver | ) | [private] |
MPbkContactDbObserver * aObserver |
IMPORT_C CContactViewBase & | AllContactsView | ( | ) |
Returns a contact view object containing all the contacts in the database.
IMPORT_C CContactViewBase & | AllGroupsViewL | ( | ) |
Returns a contact view object containing all the groups in the database.
IMPORT_C void | CloseContactL | ( | TContactItemId | aContactId | ) |
Closes a previously opened contact item without saving changes. CContactDatabase::CloseContactL
TContactItemId aContactId | Contact item to be closed. |
IMPORT_C void | CommitContactGroupL | ( | CContactGroup & | aGroup, |
TBool | aImmediateNotify = EFalse | |||
) |
Commits changes to a contact group to the database.
CContactGroup & aGroup | |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
IMPORT_C void | CommitContactL | ( | CPbkContactItem & | aContact, |
TBool | aImmediateNotify = EFalse | |||
) |
Commit changes to a previously opened contact item into the contact database.
CPbkContactItem & aContact | Contact item to be updated in the database. |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
void | ConstructL | ( | const TDesC * | aFileName, |
TBool | aReplace, | |||
RFs * | aFs | |||
) | [private] |
IMPORT_C CPbkContactChangeNotifier * | CreateContactChangeNotifierL | ( | MPbkContactDbObserver * | aObserver | ) |
Creates and returns a new CPbkContactChangeNotifier for the default contact database. The returned object attaches aObserver to this engine instance as long as the object exists.
MPbkContactDbObserver * aObserver | Observer to attach to this object. |
IMPORT_C CContactGroup * | CreateContactGroupL | ( | const TDesC & | aGroupLabel, |
TBool | aInTransaction = EFalse | |||
) |
Creates a new contact group.
IMPORT_C CPbkContactIter * | CreateContactIteratorLC | ( | TBool | aUseMinimalRead = EFalse | ) |
Returns a Phonebook contact iterator. CPbkContactIter::NewL . CContactDatabase::ReadMinimalContactL
TBool aUseMinimalRead = EFalse | If ETrue the iterator will use the Symbian Contacts model CContactDatabase::ReadMinimalContactL, EFalse will read all the contact fields. Default behaviour is to read all fields. |
void | CreateDbConnectionL | ( | const TDesC * | aFileName, |
TBool | aReplace, | |||
TInt & | aDbOpenError, | |||
TBool | aSettingsVisible | |||
) | [private, inline] |
IMPORT_C CPbkContactItem * | CreateEmptyContactL | ( | ) |
Returns a new contact card with default fields.
IMPORT_C CContactDatabase & | Database | ( | ) |
Returns the underlying CContactDatabase object. Use only if this class's API is not enough for your purposes.
IMPORT_C void | DeleteContactGroupL | ( | TContactItemId | aContactId, |
TBool | aImmediateNotify = EFalse | |||
) |
Deletes a contact group from the database. CContactDatabase::DeleteContactL
TContactItemId aContactId | Contact group to be deleted. |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
IMPORT_C void | DeleteContactL | ( | TContactItemId | aContactId, |
TBool | aImmediateNotify = EFalse | |||
) |
Deletes a contact item from the database. CContactDatabase::DeleteContactL
TContactItemId aContactId | Contact item to be deleted. |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
IMPORT_C void | DeleteContactsL | ( | const CContactIdArray & | aContactIds, |
TBool | aImmediateNotify = EFalse | |||
) |
Deletes multiple contact items from the database. CContactDatabase::DeleteContactsL
const CContactIdArray & aContactIds | Contact items to be deleted. |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
IMPORT_C void | DeleteContactsOnBackgroundL | ( | const CContactIdArray & | aContactIds | ) |
Deletes multiple contacts from the database in an active object -driven asynchronous background process.
const CContactIdArray & aContactIds | Contacts to delete. |
IMPORT_C TContactItemId | DuplicateContactL | ( | TContactItemId | aId, |
TBool | aImmediateNotify = EFalse | |||
) |
Duplicates a contact in the database.
TContactItemId aId | Id of the contact to duplicate. |
TBool aImmediateNotify = EFalse | Send notification to observers immediately. NOTE: send immediately will result in observers (MPbkContactDbObserver) receiving the event twice! |
IMPORT_C const CPbkFieldsInfo & | FieldsInfo | ( | ) |
Returns the field type info array. CPbkFieldsInfo
IMPORT_C CContactViewBase & | FilteredContactsViewL | ( | TInt | aFilter | ) |
Returns a contact view object containing all the contacts in the database that match a filter.
TInt aFilter | Use CContactDatabase::TContactViewFilter. |
IMPORT_C CPbkIdleFinder * | FindAsyncL | ( | const TDesC & | aText, |
const CPbkFieldIdArray * | aFieldTypes = NULL, | |||
MIdleFindObserver * | aObserver = NULL | |||
) |
Searches all contacts in the database for aText asynchronously.
const TDesC & aText | Text to search. |
const CPbkFieldIdArray * aFieldTypes = NULL | Phonebook fields types to at least include in the search. If NULL searches all fields. PLEASE NOTE: The find matches in most cases also other fields than those specified in aFieldTypes. Always loop through the returned contacts to check match in the required fields. |
MIdleFindObserver * aObserver = NULL | Observer for this operation. |
IMPORT_C CContactIdArray * | FindLC | ( | const TDesC & | aText, |
const CPbkFieldIdArray * | aFieldTypes = NULL | |||
) |
Searches all contacts in the database for aText.
const TDesC & aText | Text to search. |
const CPbkFieldIdArray * aFieldTypes = NULL | Phonebook fields types to at least include in the search. If NULL searches all fields. PLEASE NOTE: The find matches in most cases also other fields than those specified in aFieldTypes. Always loop through the returned contacts to check match in the required fields. |
IMPORT_C HBufC * | GetContactTitleL | ( | const CPbkContactItem & | aItem | ) | const |
Gets a title text for a contact or localised text for unnamed contact if contact contains no title.
const CPbkContactItem & aItem | Contact item for which to make the title. |
IMPORT_C HBufC * | GetContactTitleOrNullL | ( | const MPbkFieldDataArray & | aContactData | ) |
Similar to GetContactTitleL but returns NULL if contact contains no title. Uses the MPbkFieldDataArray interface to access the field content. CPbkContactEngine::GetContactTitleL
const MPbkFieldDataArray & aContactData | The contact field data array. |
IMPORT_C TContactItemId | GetSpeedDialFieldL | ( | TInt | aSpeedDialPosition, |
TDes & | aPhoneNumber | |||
) | const |
Returns a speed dial contact.
void | HandleDatabaseEventL | ( | TContactDbObserverEvent | aEvent | ) | [private] |
Distributes CContactDatabase observer events in Phonebook.
TContactDbObserverEvent aEvent |
IMPORT_C TBool | IsSpeedDialAssigned | ( | const CPbkContactItem & | aItem, |
TInt | aFieldIndex | |||
) | const |
Returns ETrue if this field has been assigned a speed dial position.
const CPbkContactItem & aItem | contact Item to check for speed dial. |
TInt aFieldIndex | Index of the field to check. This is an index into aItem.CardFields(). |
IMPORT_C TBool | IsTitleField | ( | TPbkFieldId | aFieldId | ) | const |
Returns ETrue if field is one of the fields used in building the contact title.
TPbkFieldId aFieldId | The id of the field. |
IMPORT_C CContactIdArray * | MatchPhoneNumberL | ( | const TDesC & | aNumber, |
const TInt | aMatchLengthFromRight | |||
) |
Call-through for new Phone number matching function in 6.2 version of class CContactDatabase . If you don't need any other functionality from CPbkContactEngine than this consider using the CContactDatabase API directly. See Symbian Contacts Model documentation for CContactDatabase::MatchPhoneNumberL use.
CContactDatabase::MatchPhoneNumberL(const TDesC&,const TInt)
IMPORT_C CPbkContactEngine * | NewL | ( | RFs * | aFs = NULL | ) | [static] |
Creates a new Phonebook engine object and connects to the default contact database. If the default database does not exist it is created.
KErrCorrupt |
if the database is corrupted. |
RFs * aFs = NULL | An open file server connection. If !=NULL aFs is used instead of a locally created RFs connection. aFs must remain connected for the lifetime of the returned object. |
IMPORT_C CPbkContactEngine * | NewL | ( | const TDesC & | aFileName, |
TBool | aReplace = EFalse, | |||
RFs * | aFs = NULL | |||
) | [static] |
IMPORT_C CContactGroup * | OpenContactGroupL | ( | TContactItemId | aId | ) |
Opens a Contact group for modification.
TContactItemId aId | Groups id |
IMPORT_C CContactGroup * | OpenContactGroupLCX | ( | TContactItemId | aId | ) |
Opens a Contact group for modification. Pushes the returned contact group object and a lock item on the cleanup stack.
TContactItemId aId | Groups id |
IMPORT_C CPbkContactItem * | OpenContactL | ( | TContactItemId | aContactId | ) |
Opens a contact and returns a phonebook contact item. CContactDatabase::OpenContactL
TContactItemId aContactId | Contact item id to be opened. |
IMPORT_C CPbkContactItem * | OpenContactLCX | ( | TContactItemId | aContactId | ) |
Same as OpenContactL, but leaves a lock record AND the opened contact object on the cleanup stack. Use CleanupStack::PopAndDestroy(2) to close the contact and destroy the returned object. First pop pops the contact object and second the lock object. CContactDatabase::OpenContactLX
TContactItemId aContactId | Contact item id to open. |
IMPORT_C CContactGroup * | ReadContactGroupL | ( | TContactItemId | aId | ) |
Reads a Contact group.
TContactItemId aId | Group id. |
IMPORT_C CPbkContactItem * | ReadContactL | ( | TContactItemId | aContactId, |
const CPbkFieldIdArray * | aFieldTypes = NULL | |||
) |
Reads a contact and returns a phonebook contact item.
TContactItemId aContactId | Contact item id to be read. |
const CPbkFieldIdArray * aFieldTypes = NULL | Array of types of fields to read in, all fields are read if NULL (which is default). NOTE: when using this parameter ReadContactL may return more fields than expected; for example if aFieldTypes contains any phonenumber the method may return all phone number fields of the contact. |
IMPORT_C CPbkContactItem * | ReadContactLC | ( | TContactItemId | aContactId, |
const CPbkFieldIdArray * | aFieldTypes = NULL | |||
) |
Same as ReadContactL, but leaves the returned contact item on the cleanup stack.
TContactItemId aContactId | Contact item id to be read. |
const CPbkFieldIdArray * aFieldTypes = NULL | Array of types of fields to read in, all fields are read if NULL (which is default). NOTE: when using this parameter ReadContactL may return more fields than expected; for example if aFieldTypes contains any phonenumber the method may return all phone number fields of the contact. |
IMPORT_C CPbkContactItem * | ReadMinimalContactLC | ( | TContactItemId | aContactId | ) |
Same as ReadContactLC but reads only minimal information. See Symbian Contacts Model documentation for definition of "minimal" in this case.
TContactItemId aContactId | Contact item id to be read. |
void | ReadResourcesL | ( | TBool & | aSettingsVisibility | ) | [private, inline] |
TBool & aSettingsVisibility |
IMPORT_C void | RemoveContactFromGroupL | ( | TContactItemId | aItemId, |
TContactItemId | aGroupId | |||
) |
Removes a contact from a group
TContactItemId aItemId | Contact to be removed from group. |
TContactItemId aGroupId | Group where the contact will be removed from. |
void | RemoveObserver | ( | MPbkContactDbObserver * | aObserver | ) | [private] |
MPbkContactDbObserver * aObserver |
IMPORT_C void | RemoveSpeedDialFieldL | ( | TContactItemId | aContactId, |
TInt | aSpeedDialPosition | |||
) |
Removes a speed dial from a contact.
TContactItemId aContactId | Contact item to remove the speed dial from. |
TInt aSpeedDialPosition | Speed dial position number to remove. |
IMPORT_C CPbkContactEngine * | ReplaceL | ( | RFs * | aFs = NULL | ) | [static] |
Replaces the default contact database and connects to it. See Symbian Contacs model documentation for CContactDatabase::ReplaceL for possible leave codes. PLEASE NOTE: all data in the existing database will be lost!
RFs * aFs = NULL | An open file server connection. If !=NULL aFs is used instead of a locally created RFs connection. aFs must remain connected for the lifetime of the returned object. |
void | SendEventToAllObservers | ( | const TContactDbObserverEvent & | aEvent | ) | [private] |
const TContactDbObserverEvent & aEvent |
void | SendImmidiateEventToAllObservers | ( | TContactDbObserverEventType | aEventType, |
TContactItemId | aContactId, | |||
TBool | aSendEvent | |||
) | [private] |
TContactDbObserverEventType aEventType | |
TContactItemId aContactId | |
TBool aSendEvent |
IMPORT_C void | SetCompressUi | ( | MPbkCompressUi * | aCompressiUi | ) |
MPbkCompressUi * aCompressiUi |
IMPORT_C void | SetFieldAsSpeedDialL | ( | CPbkContactItem & | aItem, |
TInt | aFieldIndex, | |||
TInt | aSpeedDialPosition | |||
) |
Sets a speed dial to a contact field.
CPbkContactItem & aItem | Contact item to add speed dial to. |
TInt aFieldIndex | Field index to add Speed dial to. |
TInt aSpeedDialPosition | Speed dial position number to set to the field. |
IMPORT_C void | SetNameDisplayOrderL | ( | TPbkNameOrder | aNameOrder | ) |
TPbkNameOrder aNameOrder |
IMPORT_C void | SetNameSeparatorL | ( | TChar | aSeparator | ) |
TChar aSeparator |
IMPORT_C CPbkContactEngine * | Static | ( | ) | [static] |
Returns the global Phonebook engine instance, NULL if no instance created yet. Note1: Uses thread local storage (TLS), which is slow. Cache the returned pointer if it is used more than one time! Note2: Only the first engine instance created in calling thread can be accessed with this function.
IMPORT_C const TDesC & | UnnamedTitle | ( | ) | const |
Returns the localised title text to use for unnamed contacts.
void | doDeleteContactL | ( | TContactItemId | aContactId | ) | [private] |
TContactItemId aContactId |
EPbkNameOrderLastNameFirstName = 0 | |
EPbkNameOrderFirstNameLastName | |
EPbkNameOrderNotDefined |
undefined name order |
CArrayPtr < MPbkContactDbObserver > * | iObservers | [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.