RCntModel Class Reference

class RCntModel : public RSessionBase

Client-side Contacts Model session handle.

Inherits from

Public Member Functions
RCntModel ()
void AddObserverL ( MContactDbObserver &)
TInt BeginDbTransaction ()
void BeginIterateL ( TInt )
void CancelAsyncOpen ()
void ChangeSortOrderL ( TInt , const CContactTextDef &)
void Close ()
TBool CloseContact ( TContactItemId )
TInt CloseCrud ()
void CloseDatabase ()
TInt CloseIterator ()
TInt CloseProperties ()
void CloseTablesL ()
void CloseView ( TInt )
CContactIdArray * CollectionL ( TInt , TTime , const TDesC &)
void CommitContactL (const CContactItem &, TBool )
TInt CommitDbTransaction ()
void ConnectL ()
TInt ConnectionId ()
TInt ContactCountL ()
TBool ContactMatchesHintFieldL ( TInt , TContactItemId )
TContactItemId CreateContactL ( CContactItem &)
TInt CreateDatabase (const TDesC &)
void CrudAsyncOp ( TInt , TRequestStatus &)
TInt CrudSyncOp ( TInt )
TContactItemId CurrentItem ()
TInt DatabaseDrive ( TDriveUnit &)
TBool DatabaseExistsL (const TDesC &)
TBool DatabaseReadyL ()
TInt DefaultDatabase ( TDes &)
void DeleteContactL (const TContactItemId , TCntSendEventAction , TBool )
TInt DeleteDatabase (const TDesC &)
void EndIterateL ( TInt )
void EndNotificationTransfer ()
CContactIdArray * FetchGroupListIdsL ()
CContactIdArray * FetchTemplateListIdsL ()
TInt FileSize ()
TPtrC FileUidL ()
void FilterDatabaseL ( CCntFilter &)
void FindAsyncInitL (const TDesC &, CContactItemFieldDef *)
TBool FindAsyncL ( CContactIdArray *&)
void FindAsyncTextDefInitL (const CDesCArray &, CContactTextDef *)
CContactIdArray * FindL (const TDesC &, const CContactItemFieldDef *)
TInt GetCurrentDatabase ( TDes &)
TUid GetDbViewContactType ()
void GetDefinitionsOfExistingViewsL (const TDesC &, RPointerArray < CContactDefaultViewDefinition > &)
CArrayFix < CContactDatabase::TSortPref > * GetSortPreferenceL ()
TContactItemId GetSpeedDialFieldL ( TInt , TDes &)
void HandlePrematureServerTerminationL ()
TContactItemId ICCTemplateIdL ( TUid )
CViewContact * ItemAtL ( TContactItemId , TInt )
void IteratorAsyncOp ( TInt , TRequestStatus &)
TInt IteratorSyncOp ( TInt )
CDesCArray * ListDatabasesL ( TDriveUnit *)
TInt64 MachineId ()
CContactIdArray * MatchPhoneNumberL (const TDesC &, const TInt )
CViewContact * NextItemL ( TInt , const TInt )
CContactItem * OpenContactLX (const CContactItemViewDef *, TContactItemId )
TInt OpenCrud ()
TInt OpenDatabase (const TDesC &)
void OpenDatabaseAsyncL ( TRequestStatus &, const TDesC &)
TInt OpenIterator ()
TInt OpenProperties ()
void OpenTablesL ()
TInt OpenViewL (const CContactTextDef &, const TInt )
void OverrideMachineUniqueId ( TInt64 )
TContactItemId OwnCard ()
TContactItemId PhonebookGroupIdL ()
TContactItemId PrefTemplateId ()
void PropertiesAsyncOp ( TInt , TRequestStatus &)
TInt PropertiesSyncOp ( TInt )
TInt ReCreateTemplate ()
CContactItem * ReadContactL (const CContactItemViewDef *, TContactItemId )
void ReadContactTextDefL ( TContactItemId , TDes &, const CContactTextDef &)
TInt RemoveCurrentItem ()
void RemoveObserver (const MContactDbObserver &)
void RemoveSpeedDialFieldL ( TContactItemId , TInt )
TInt ReplaceDatabase (const TDesC &)
void ResetServerSpeedDialsL ()
TInt ResourceCount ()
TInt RollbackDbTransaction ()
TBool SeekContactL ( TContactItemId , TContactItemId &, TUid &, TBool &)
void SetAsyncActivityL ( TBool )
TInt SetCurrentDatabase (const TDesC &)
void SetCurrentItem ( TContactItemId )
void SetDatabaseDriveL ( TDriveUnit , TBool )
void SetDbViewContactType (const TUid )
void SetFieldAsSpeedDialL ( TContactItemId , TInt , TInt )
void SetHeapFailure ( RHeap::TAllocFail , TInt )
void SetOperationTimeOutL (const TInt )
void SetOwnCardL (const CContactItem &)
void SetPrefTemplateL (const TContactItemId )
void SetSortPreferenceL (const CArrayFix < CContactDatabase::TSortPref > &)
void SetViewDefinitionL (const CContactViewDef &)
void StartNotificationTransfer ( TRequestStatus &, TDes8 &)
void TextFieldL ( TInt , TFieldType , TDes &)
void UnlockLastLockedContact ()
Private Member Functions
CContactIdArray * DoGetCollectionChangedSinceL ( TTime )
CContactIdArray * DoGetCollectionGuidL (const TDesC &)
CContactIdArray * DoGetCollectionL ( TInt )
void PushUnlockL ()
TInt SetFileName (const TDesC &)
CContactItem * UnPackContactLC ( TInt , TIpcArgs &)
TVersion Version ()
Inherited Functions
RHandleBase::Attributes()const
RHandleBase::BTraceId()const
RHandleBase::DoExtendedClose()
RHandleBase::Duplicate(const RThread &,TOwnerType)
RHandleBase::FullName()const
RHandleBase::FullName(TDes &)const
RHandleBase::Handle()const
RHandleBase::HandleInfo(THandleInfo *)
RHandleBase::Name()const
RHandleBase::NotifyDestruction(TRequestStatus &)
RHandleBase::Open(const TFindHandleBase &,TOwnerType)
RHandleBase::OpenByName(const TDesC &,TOwnerType,TInt)
RHandleBase::RHandleBase()
RHandleBase::RHandleBase(TInt)
RHandleBase::SetHandle(TInt)
RHandleBase::SetHandleNC(TInt)
RSessionBase::CreateSession(RServer2,const TVersion &)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt)
RSessionBase::CreateSession(RServer2,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TIpcSessionType,const TSecurityPolicy *,TRequestStatus *)
RSessionBase::CreateSession(const TDesC &,const TVersion &,TInt,TRequestStatus *)
RSessionBase::Open(RMessagePtr2,TInt,TOwnerType)
RSessionBase::Open(RMessagePtr2,TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Open(TInt,TOwnerType)
RSessionBase::Open(TInt,const TSecurityPolicy &,TOwnerType)
RSessionBase::Send(TInt)const
RSessionBase::Send(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt)const
RSessionBase::SendReceive(TInt,TRequestStatus &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &)const
RSessionBase::SendReceive(TInt,const TIpcArgs &,TRequestStatus &)const
RSessionBase::SetReturnedHandle(TInt)
RSessionBase::SetReturnedHandle(TInt,RHandleBase &)
RSessionBase::SetReturnedHandle(TInt,const TSecurityPolicy &)
RSessionBase::ShareAuto()
RSessionBase::ShareProtected()
Inherited Enumerations
RHandleBase:TAttributes
RSessionBase:TAttachMode
Private Attributes
TInt iConnectionId
CCntDbNotifyMonitor * iDbNotifyMonitor
TBuf < KCntMaxFilePath > iFileName
TBuf < KUidBufferSize > iFileUid
TInt iNoOfSvrStartAttempts
CCntPackager * iPackager
Inherited Attributes
RHandleBase::iHandle

Constructor & Destructor Documentation

RCntModel()

RCntModel ( )

RCntModel constructor.

Member variables must be initialised (zero'd) in the constructor since RCntModel does not derive from CBase .

Member Functions Documentation

AddObserverL(MContactDbObserver &)

void AddObserverL ( MContactDbObserver & aObserver )

Add a database event observer.

Parameters

MContactDbObserver & aObserver Observer callback inteface used to send database event.

BeginDbTransaction()

TInt BeginDbTransaction ( ) const

Start a database transaction.

BeginIterateL(TInt)

void BeginIterateL ( TInt aViewId )

Parameters

TInt aViewId

CancelAsyncOpen()

void CancelAsyncOpen ( )

Cancel last asynchronous database open request.

capability
None

ChangeSortOrderL(TInt, const CContactTextDef &)

void ChangeSortOrderL ( TInt aViewId,
const CContactTextDef & aTextDef
)

Parameters

TInt aViewId
const CContactTextDef & aTextDef

Close()

void Close ( )

Close session.

CloseContact(TContactItemId)

TBool CloseContact ( TContactItemId aContactId )

Close/unLock an existing contact in the database.

Parameters

TContactItemId aContactId The contact ID of the contact to close.

CloseCrud()

TInt CloseCrud ( ) const

CloseDatabase()

void CloseDatabase ( ) const

Close currently open database.

capability
None

CloseIterator()

TInt CloseIterator ( ) const

CloseProperties()

TInt CloseProperties ( ) const

CloseTablesL()

void CloseTablesL ( )

Close the database tables.

capability
None

CloseView(TInt)

void CloseView ( TInt aViewId )

Parameters

TInt aViewId

CollectionL(TInt, TTime, const TDesC &)

CContactIdArray * CollectionL ( TInt aCollectionType,
TTime aTime = 0,
const TDesC & aGuid =  KNullDesC
)

Get a collection of contact IDs using the specified collection parameters.

Parameters

TInt aCollectionType Type of collection.
TTime aTime = 0 Used if collection type is "changed since".
const TDesC & aGuid =  KNullDesC Used if collection type is "find GUID".

CommitContactL(const CContactItem &, TBool)

void CommitContactL ( const CContactItem & aContact,
TBool aSendChangedEvent = ETrue
) const

Update and unlock an existing contact in the database.

capability
WriteUserData

Parameters

const CContactItem & aContact The contact to be updated and unlocked
TBool aSendChangedEvent = ETrue If ETrue the changed event should be sent after the update/unlock.

CommitDbTransaction()

TInt CommitDbTransaction ( ) const

Commit a database transaction.

ConnectL()

void ConnectL ( )

Open a Contacts server session.

ConnectionId()

TInt ConnectionId ( ) const

Returns the connection ID of the current client session.

ContactCountL()

TInt ContactCountL ( ) const

Get the number of contacts in the database.

ContactMatchesHintFieldL(TInt, TContactItemId)

TBool ContactMatchesHintFieldL ( TInt aBitWiseFilter,
TContactItemId aContactId
)

Tests whether a contact item's hint bit field matches a filter.

capability
None

Parameters

TInt aBitWiseFilter The filter to compare the item against. This is a combination of TContactViewFilter values.
TContactItemId aContactId The ID of the item in the database.

CreateContactL(CContactItem &)

TContactItemId CreateContactL ( CContactItem & aContact ) const

Add a new contact to the database.

capability
WriteUserData

Parameters

CContactItem & aContact The contact to be added to the database.

CreateDatabase(const TDesC &)

TInt CreateDatabase ( const TDesC & aCntFile =  KNullDesC ) const

Create an empty named contact database.

Creates the default contacts database if the default argument is used. The given descriptor must not contain more than KCntMaxFilePath characters.

capability
WriteUserData

Parameters

const TDesC & aCntFile =  KNullDesC Contacts database filename (in the form drive:database). Defaults to KCntDefaultDrive.

CrudAsyncOp(TInt, TRequestStatus &)

void CrudAsyncOp ( TInt aParam,
TRequestStatus & aStatus
) const

Parameters

TInt aParam
TRequestStatus & aStatus

CrudSyncOp(TInt)

TInt CrudSyncOp ( TInt aParam ) const

Parameters

TInt aParam

CurrentItem()

TContactItemId CurrentItem ( ) const

Gets the ID of the current item, as set by SetCurrentItem() . The current item ID is initialised to KNullContactId when the database is opened.

capability
None

DatabaseDrive(TDriveUnit &)

TInt DatabaseDrive ( TDriveUnit & aDriveUnit ) const

Retrieve the current contact database drive.

capability
None

Parameters

TDriveUnit & aDriveUnit Contains the current contact database drive unit on return.

DatabaseExistsL(const TDesC &)

TBool DatabaseExistsL ( const TDesC & aCntFile =  KNullDesC ) const

Determine if the named contact database file exists.

If the aCntFile argument is the default, determines if default contact database file exists.

leave
KErrArgument if the given descriptor contains more than the maximum length of 190 characters, otherwise one of the System error codes.
capability
None

Parameters

const TDesC & aCntFile =  KNullDesC Contacts database filename (in the form drive:database).

DatabaseReadyL()

TBool DatabaseReadyL ( ) const

Determine if the database is ready. Ready in this context means that the database is open and readable/writable (i.e. the state machine is in CStateWritable).

capability
None

DefaultDatabase(TDes &)

TInt DefaultDatabase ( TDes & aCntFile ) const

Get the name of the default contact database file.

The given descriptor must have room for minimum of KCntMaxFilePath characters.

capability
None

Parameters

TDes & aCntFile Contains the default contact database name on return.

DeleteContactL(const TContactItemId, TCntSendEventAction, TBool)

void DeleteContactL ( const TContactItemId aCntId,
TCntSendEventAction aCntEventType,
TBool aDecAccessCount = EFalse
) const

Delete a contact from the database.

capability
WriteUserData

Parameters

const TContactItemId aCntId
TCntSendEventAction aCntEventType The event type to pass on to the observers.
TBool aDecAccessCount = EFalse If ETrue access count should be decremented prior to the deletion.

DeleteDatabase(const TDesC &)

TInt DeleteDatabase ( const TDesC & aCntFile =  KNullDesC ) const

Delete a named contact database.

Deletes the default contacts database if the default argument is used. The given descriptor must not contain more than KCntMaxFilePath characters.

capability
WriteUserData

Parameters

const TDesC & aCntFile =  KNullDesC Contacts database filename (in the form drive:database). Defaults to KCntDefaultDrive.

DoGetCollectionChangedSinceL(TTime)

CContactIdArray * DoGetCollectionChangedSinceL ( TTime aTime ) [private]

Get a collection of contact IDs which have changed since the given time.

Parameters

TTime aTime Changed since time.

DoGetCollectionGuidL(const TDesC &)

CContactIdArray * DoGetCollectionGuidL ( const TDesC & aGuid ) [private]

Get a collection of contact IDs which have the given GUID. Since GUIDs are unique (i.e. no two contacts can have the same GUID) there will only ever be one contact ID in this collection.

Parameters

const TDesC & aGuid Contact GUID.

DoGetCollectionL(TInt)

CContactIdArray * DoGetCollectionL ( TInt aCollectionType ) [private]

Get a collection of contact IDs for the given collection type.

Parameters

TInt aCollectionType Collection type.

EndIterateL(TInt)

void EndIterateL ( TInt aViewId )

Parameters

TInt aViewId

EndNotificationTransfer()

void EndNotificationTransfer ( )

End (cancel) request for database event from server.

FetchGroupListIdsL()

CContactIdArray * FetchGroupListIdsL ( )

Get a list of group IDs from the server.

FetchTemplateListIdsL()

CContactIdArray * FetchTemplateListIdsL ( )

Get a list of template IDs from the server.

FileSize()

TInt FileSize ( ) const

Gets the size of the database file in bytes.

capability
None

FileUidL()

TPtrC FileUidL ( ) const

Get the database file UID.

capability
None

FilterDatabaseL(CCntFilter &)

void FilterDatabaseL ( CCntFilter & aFilter )

Filter the database using the given filter.

Parameters

CCntFilter & aFilter Filter to use. On return the contact IDs in this filter will be augmented with those contact IDs which match the given filter.

FindAsyncInitL(const TDesC &, CContactItemFieldDef *)

void FindAsyncInitL ( const TDesC & aText,
CContactItemFieldDef * aFieldDef
)

Initialise the Persistence Layer collection class ready for iterative calls to the FindAsyncL() method. This form of initialisation is for an asynchronous find which uses text and a field definition.

Parameters

const TDesC & aText Find text.
CContactItemFieldDef * aFieldDef Field definition to use in find.

FindAsyncL(CContactIdArray *&)

TBool FindAsyncL ( CContactIdArray *& aIdArray )

Perform an asynchronous find iteration. Either the FindAsyncTextDefInitL() or the FindAsyncInitL() method above must have first been called.

Parameters

CContactIdArray *& aIdArray Set of contacts IDs from previous calls to FindAsyncL(). Will be NULL if this is the first iteration.

FindAsyncTextDefInitL(const CDesCArray &, CContactTextDef *)

void FindAsyncTextDefInitL ( const CDesCArray & aWords,
CContactTextDef * aTextDef
)

Initialise the Persistence Layer collection class ready for iterative calls to the FindAsyncL() method. This form of initialisation is for an asynchronous find which uses a text definition and an array of "find words".

Parameters

const CDesCArray & aWords "Find words" array.
CContactTextDef * aTextDef Text definition to use in find.

FindL(const TDesC &, const CContactItemFieldDef *)

CContactIdArray * FindL ( const TDesC & aText,
const CContactItemFieldDef * aFieldDef
)

Parameters

const TDesC & aText
const CContactItemFieldDef * aFieldDef

GetCurrentDatabase(TDes &)

TInt GetCurrentDatabase ( TDes & aDatabase ) const

When there are multiple contact databases on a device this method can be used to enquire which database is the current one.

The current database functions are provided as part of current item functionality. In order to pass a current item from one contacts model client to another, the receiving client needs to be using the same database.

The current database is a path and filename, set using SetCurrentDatabase() , which is persisted by the contacts server.

capability
None

Parameters

TDes & aDatabase The path and filename of the current database. KNullDesC if no current database has been set.

GetDbViewContactType()

TUid GetDbViewContactType ( ) const

GetDefinitionsOfExistingViewsL(const TDesC &, RPointerArray< CContactDefaultViewDefinition > &)

void GetDefinitionsOfExistingViewsL ( const TDesC & aDbName,
RPointerArray < CContactDefaultViewDefinition > & aViewDefs
)

Parameters

const TDesC & aDbName
RPointerArray < CContactDefaultViewDefinition > & aViewDefs

GetSortPreferenceL()

CArrayFix < CContactDatabase::TSortPref > * GetSortPreferenceL ( ) const

Get the sort preferences from the server.

GetSpeedDialFieldL(TInt, TDes &)

TContactItemId GetSpeedDialFieldL ( TInt aSpeedDialPosition,
TDes & aPhoneNumber
)

Returns the ID of the contact item whose telephone number field is mapped to the speed dial position specified.

This function is provided so that information may be displayed about a contact item whose telephone number is being dialled using speed dialling.

The function also retrieves the telephone number stored in the field.

capability
ReadUserData

Parameters

TInt aSpeedDialPosition The speed dial position. This is an integer in the range 1 to 9 inclusive. If outside this range, the function leaves with KErrArgument.
TDes & aPhoneNumber On return contains the telephone number which is mapped to the speed dial position specified. Returns KNullDesC if the speed dial position requested has not been set.

HandlePrematureServerTerminationL()

void HandlePrematureServerTerminationL ( )

Handle a premature termination of the contact server process by re-connecting the session and re-opening the database.

capability
ReadUserData

ICCTemplateIdL(TUid)

TContactItemId ICCTemplateIdL ( TUid aPhonebookUid = KNullUid )

Returns the ID of the template that should be used with CContactICCEntry items. If aPhonebookUid is set, the ID of the template belonging to the phonebook with TUid aPhonebookUid is returned.

Parameters

TUid aPhonebookUid = KNullUid The phonebook ID with default KNullUid.

ItemAtL(TContactItemId, TInt)

CViewContact * ItemAtL ( TContactItemId aContactId,
TInt aViewId
)

Parameters

TContactItemId aContactId
TInt aViewId

IteratorAsyncOp(TInt, TRequestStatus &)

void IteratorAsyncOp ( TInt aParam,
TRequestStatus & aStatus
) const

Parameters

TInt aParam
TRequestStatus & aStatus

IteratorSyncOp(TInt)

TInt IteratorSyncOp ( TInt aParam ) const

Parameters

TInt aParam

ListDatabasesL(TDriveUnit *)

CDesCArray * ListDatabasesL ( TDriveUnit * aDriveUnit = NULL ) const

List the contact database files for any given drive unit. Lists all databases on all drives if aDriveUnit is set to NULL.

leave
KErrNoMemory if not enough free memory, KErrNotReady if drive does not, otherwise one of the System error codes.
capability
ReadUserData

Parameters

TDriveUnit * aDriveUnit = NULL The drive unit to search. Searches all drives if default argument is used.

MachineId()

TInt64 MachineId ( ) const

Get the machine ID.

Note: This function can leave.

leave
KErrNone The send operation is successful
leave
KErrServerTerminated The server no longer present
leave
KErrServerBusy There are no message slots available
leave
KErrNoMemory There is insufficient memory available
capability
None

MatchPhoneNumberL(const TDesC &, const TInt)

CContactIdArray * MatchPhoneNumberL ( const TDesC & aNumber,
const TInt aMatchLengthFromRight
)

Returns an array of contact item IDs for all the contact items which may contain the specified telephone number in a telephone, fax or SMS type field.

CContactDatabase::MatchPhoneNumberL() for more details on the match.
capability
ReadUserData

Parameters

const TDesC & aNumber Phone number string
const TInt aMatchLengthFromRight Number of digits from the right of the phone number to use. Up to 15 digits can be specified and it is recommended that at least 7 match digits are specified.

NextItemL(TInt, const TInt)

CViewContact * NextItemL ( TInt aViewId,
const TInt aViewPrefs
)

Parameters

TInt aViewId
const TInt aViewPrefs

OpenContactLX(const CContactItemViewDef *, TContactItemId)

CContactItem * OpenContactLX ( const CContactItemViewDef * aCntItemVDef,
TContactItemId aCntId
) const

Open and lock an existing contact in the database. The contact item lock is pushed onto the cleanup stack.

Parameters

const CContactItemViewDef * aCntItemVDef The view definition to use.
TContactItemId aCntId Contact ID to read.

OpenCrud()

TInt OpenCrud ( ) const

OpenDatabase(const TDesC &)

TInt OpenDatabase ( const TDesC & aCntFile =  KNullDesC ) const

Open a named contact database.

Opens the default contacts database if the default argument is used. The given descriptor must not contain more than KCntMaxFilePath characters.

capability
ReadUserData

Parameters

const TDesC & aCntFile =  KNullDesC Filename (in the form drive:database). Defaults to KCntDefaultDrive.

OpenDatabaseAsyncL(TRequestStatus &, const TDesC &)

void OpenDatabaseAsyncL ( TRequestStatus & aStatus,
const TDesC & aCntFile =  KNullDesC
)

Open a named contact database asynchronously.

Opens the default contacts database if the default argument is used. The given descriptor must not contain more than KCntMaxFilePath characters.

capability
ReadUserData

Parameters

TRequestStatus & aStatus Asynchronous request object. Request is completed when database has been opened.
const TDesC & aCntFile =  KNullDesC Contacts database filename (in the form drive:database). Defaults to KCntDefaultDrive.

OpenIterator()

TInt OpenIterator ( ) const

OpenProperties()

TInt OpenProperties ( ) const

OpenTablesL()

void OpenTablesL ( )

Open the database tables.

capability
ReadUserData

OpenViewL(const CContactTextDef &, const TInt)

TInt OpenViewL ( const CContactTextDef & aTextDef,
const TInt aViewPrefs
)

Parameters

const CContactTextDef & aTextDef
const TInt aViewPrefs

OverrideMachineUniqueId(TInt64)

void OverrideMachineUniqueId ( TInt64 aMachineUniqueId )

Set the machine ID (debug only).

capability
None

Parameters

TInt64 aMachineUniqueId New machine ID.

OwnCard()

TContactItemId OwnCard ( ) const

Returns the ID of the database's current own card.

Having obtained this ID, the client may then open the own card in the same way as an ordinary contact card (using ReadContactL() or OpenContactL()).

PhonebookGroupIdL()

TContactItemId PhonebookGroupIdL ( )

Returns the ID of the contacts model group which represents the ADN phonebook.

PrefTemplateId()

TContactItemId PrefTemplateId ( ) const

Returns the ID of the database's preferred template, as set by the method SetPrefTemplateL() . The preferred template is for clients who may have multiple templates but want to identify one as preferred.

PropertiesAsyncOp(TInt, TRequestStatus &)

void PropertiesAsyncOp ( TInt aParam,
TRequestStatus & aStatus
) const

Parameters

TInt aParam
TRequestStatus & aStatus

PropertiesSyncOp(TInt)

TInt PropertiesSyncOp ( TInt aParam ) const

Parameters

TInt aParam

PushUnlockL()

void PushUnlockL ( ) const [private]

Push a Contact item unlock cleanup item on the cleanup stack.

ReCreateTemplate()

TInt ReCreateTemplate ( ) const

Create the system template.

capability
WriteUserData

ReadContactL(const CContactItemViewDef *, TContactItemId)

CContactItem * ReadContactL ( const CContactItemViewDef * aCntItemVDef,
TContactItemId aCntId
) const

Read an existing contact in the database.

Parameters

const CContactItemViewDef * aCntItemVDef The view definition to use.
TContactItemId aCntId Contact ID to read.

ReadContactTextDefL(TContactItemId, TDes &, const CContactTextDef &)

void ReadContactTextDefL ( TContactItemId aContactId,
TDes & aResult,
const CContactTextDef & aTextDef
)

Parameters

TContactItemId aContactId
TDes & aResult
const CContactTextDef & aTextDef

RemoveCurrentItem()

TInt RemoveCurrentItem ( )

RemoveObserver(const MContactDbObserver &)

void RemoveObserver ( const MContactDbObserver & aObserver )

Remove a database event observer.

Parameters

const MContactDbObserver & aObserver Observer callback inteface to be removed.

RemoveSpeedDialFieldL(TContactItemId, TInt)

void RemoveSpeedDialFieldL ( TContactItemId aContactId,
TInt aSpeedDialPosition
)

Removes the mapping between a contact item field and a speed dial position.

Removes the KUidSpeedDialXxx UID from the field's content type, removes the field's speed dial attribute and commits the changes to the item.

leave
KErrDiskFull The disk does not have enough free space to perform the operation.
capability
ReadUserData
capability
WriteUserData

Parameters

TContactItemId aContactId The ID of the contact item containing the speed dial field.
TInt aSpeedDialPosition The speed dial position. This is an integer in the range 1 to 9 inclusive. If outside this range, the function leaves with KErrArgument.

ReplaceDatabase(const TDesC &)

TInt ReplaceDatabase ( const TDesC & aCntFile =  KNullDesC ) const

Replace a named contact database with an empty one, replacing any database with the same name. Replaces the default contacts database if the default argument is used. The given descriptor must not contain more than KCntMaxFilePath characters.

capability
WriteUserData

Parameters

const TDesC & aCntFile =  KNullDesC Contacts database filename (in the form drive:database). Defaults to KCntDefaultDrive.

ResetServerSpeedDialsL()

void ResetServerSpeedDialsL ( )

ResourceCount()

TInt ResourceCount ( )

Debug only.

capability
None

RollbackDbTransaction()

TInt RollbackDbTransaction ( ) const

Rollback a database transaction.

SeekContactL(TContactItemId, TContactItemId &, TUid &, TBool &)

TBool SeekContactL ( TContactItemId aContactId,
TContactItemId & aId,
TUid & aContactType,
TBool & aDeleted
)

Seek to the given contact ID.

Parameters

TContactItemId aContactId Contact ID to seek to.
TContactItemId & aId On return the contact ID that the seek found. This will be the nearest contact ID if the given aContactID cannot be found.
TUid & aContactType On return the contact type of the contact that the seek found.
TBool & aDeleted On return ETrue if the contact that the seek found is marked as deleted, EFalse otherwise.

SetAsyncActivityL(TBool)

void SetAsyncActivityL ( TBool aAsyncActivity )

Set the asynchronous activity flag in the server. Any asynchronous activity such as asynchronous find or asynchronous sort prevent the database from being closed and should set this flag. When all asynchronous activites are finished this flag should be cleared.

capability
None

Parameters

TBool aAsyncActivity ETrue if at least one asynchronous activity, EFalse if no asynchronous activities.

SetCurrentDatabase(const TDesC &)

TInt SetCurrentDatabase ( const TDesC & aDatabase ) const

When there are multiple contact databases on a device this method can be used to set a database as the current one.

Note: this function simply updates a file name which is stored by the Contacts server and its use is optional. It is provided as part of current item functionality.

In order to pass a current item from one contacts model client to another, the receiving client needs to be using the same database.

capability
WriteUserData

Parameters

const TDesC & aDatabase The path and filename of the current database.

SetCurrentItem(TContactItemId)

void SetCurrentItem ( TContactItemId aContactId ) const

Sets the ID of the current item and persists it in the database. The current item is provided for use by clients who want to identify one contact item in the database as the currently selected item.

capability
WriteUserData

Parameters

TContactItemId aContactId The ID of the current item.

SetDatabaseDriveL(TDriveUnit, TBool)

void SetDatabaseDriveL ( TDriveUnit aDriveUnit,
TBool aCopy = ETrue
)

Sets the contact database drive and optionally moves the default contact database from its current location to the new drive. This function guarantees an all or nothing operation. If the database is not successfully moved, the drive setting is not updated to reflect the change.

capability
WriteUserData

Parameters

TDriveUnit aDriveUnit The drive to which to move the contact database.
TBool aCopy = ETrue ETrue moves the existing file to the specified drive. Deletion of the source file will fail if it is in use. EFalse does not move the file. The default argument value is ETrue.

SetDbViewContactType(const TUid)

void SetDbViewContactType ( const TUid aUid )

Parameters

const TUid aUid

SetFieldAsSpeedDialL(TContactItemId, TInt, TInt)

void SetFieldAsSpeedDialL ( TContactItemId aContactId,
TInt aFieldIndex,
TInt aSpeedDialPosition
)

Sets a field containing a telephone number as a speed dial field. The field is identified by aFieldIndex within the contact item aItem. It is assigned a speed dial position between 1 and 9 inclusive.

The field's speed dial and user added attributes are set and the appropriate UID (KUidSpeedDialXxx) is added to the field's content type. The changes are committed to the database.

Notes:

  • If an item's telephone number field has already been assigned to position aSpeedDialPosition, that item is updated so that the speed dial attribute is removed from its field and the speed dial field type UID is removed from the field's content type, before the new speed dial field is set.

  • The contact item passed to this function (aItem) must have been obtained using one of the variants of CContactDatabase::OpenContactL() . This is because it is modified and committed to the database by this function - no further commits are necessary.

leave
KErrDiskFull The disk does not have enough free space to perform the operation.
capability
ReadUserData
capability
WriteUserData

Parameters

TContactItemId aContactId
TInt aFieldIndex Index of a field in aItem's field set to set as a speed dial field.
TInt aSpeedDialPosition The speed dial position. This is an integer in the range 1 to 9 inclusive. If outside this range, the function leaves with KErrArgument.

SetFileName(const TDesC &)

TInt SetFileName ( const TDesC & aCntFile ) const [private]

Set the database filename. Used to re-open the database if the server is terminated prematurely.

Parameters

const TDesC & aCntFile Contacts database filename (in the form drive:database).

SetHeapFailure(RHeap::TAllocFail, TInt)

void SetHeapFailure ( RHeap::TAllocFail aType,
TInt aRate
)

Debug only.

capability
None

Parameters

RHeap::TAllocFail aType
TInt aRate

SetOperationTimeOutL(const TInt)

void SetOperationTimeOutL ( const TInt aMicroSeconds ) const

Set the operation timeout value. This value is the length of time that a deferred request will remain in the request queue in the State Machine before being completed with an error code.

Parameters

const TInt aMicroSeconds The operation timeout in microseconds. This timeout will only be applied to requests sent by clients of this database after this point in time.

SetOwnCardL(const CContactItem &)

void SetOwnCardL ( const CContactItem & aContact )

Sets an existing contact item to be the database's current own card.

leave
KErrNotFound aContact does not exist in the database.
leave
KErrDiskFull The disk does not have enough free space to perform the operation.
capability
None

Parameters

const CContactItem & aContact The contact item to set as the database's current own card. It must already exist in the database. It cannot be a group or a template.

SetPrefTemplateL(const TContactItemId)

void SetPrefTemplateL ( const TContactItemId aContactId )

Sets the database's preferred template.

The preferred template's ID persists when the database is opened and closed. If the preferred template is subsequently deleted, the preferred template ID is set to KNullContactId.

leave
KErrNotSupported The item is not a template (i.e. is not of type KUidContactCardTemplate).
leave
KErrDiskFull The disk does not have enough free space to perform the operation.
capability
WriteUserData

Parameters

const TContactItemId aContactId

SetSortPreferenceL(const CArrayFix< CContactDatabase::TSortPref > &)

void SetSortPreferenceL ( const CArrayFix < CContactDatabase::TSortPref > & aSortOrder )

Set the sort preferences in the server.

Parameters

const CArrayFix < CContactDatabase::TSortPref > & aSortOrder Sort order preferences.

SetViewDefinitionL(const CContactViewDef &)

void SetViewDefinitionL ( const CContactViewDef & aView )

Change the existing contact view definition on the server.

Parameters

const CContactViewDef & aView The new contact view defintion.

StartNotificationTransfer(TRequestStatus &, TDes8 &)

void StartNotificationTransfer ( TRequestStatus & aStatus,
TDes8 & aEvent
)

Request a database event from the server.

Parameters

TRequestStatus & aStatus Completed when database event is available.
TDes8 & aEvent When aStatus is completed contains the database event.

TextFieldL(TInt, TFieldType, TDes &)

void TextFieldL ( TInt aCntItemId,
TFieldType aFieldType,
TDes & aText
)

Parameters

TInt aCntItemId
TFieldType aFieldType
TDes & aText

UnPackContactLC(TInt, TIpcArgs &)

CContactItem * UnPackContactLC ( TInt aBufferSize,
TIpcArgs & aArgs
) const [private]

Unpacks a contact item contained within the Packager's internal buffer and creates a contact item object. Within the server, the contact item has been written to the Packager's internal buffer by the RMessage2 .

If the buffer size was returned then the buffer was not large enough to hold a serialised contact item. The buffer must be expanded to the size returned by the server (ie aBufferSize) and the read operation performed again.

CCntPackager::SetBufferFromMessageL()
capability
ReadUserData

Parameters

TInt aBufferSize The new buffer size.
TIpcArgs & aArgs The argument buffer where the serialised contact item is written by the server.

UnlockLastLockedContact()

void UnlockLastLockedContact ( )

Unlock the last locked contact item on the server. Used by OpenLX().

capability
None

Version()

TVersion Version ( ) const [private]

Get the Contacts server version number.

Member Data Documentation

TInt iConnectionId

TInt iConnectionId [private]

CCntDbNotifyMonitor * iDbNotifyMonitor

CCntDbNotifyMonitor * iDbNotifyMonitor [private]

TBuf< KCntMaxFilePath > iFileName

TBuf < KCntMaxFilePath > iFileName [private]

TBuf< KUidBufferSize > iFileUid

TBuf < KUidBufferSize > iFileUid [private]

TInt iNoOfSvrStartAttempts

TInt iNoOfSvrStartAttempts [private]

CCntPackager * iPackager

CCntPackager * iPackager [private]