diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-6A2160F0-6062-4E77-ABA3-B829AF9689FA.dita --- a/Symbian3/PDK/Source/GUID-6A2160F0-6062-4E77-ABA3-B829AF9689FA.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-6A2160F0-6062-4E77-ABA3-B829AF9689FA.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,80 +1,82 @@ - - - - - -Contacts -database events -

A client application of the Contacts Server can be set to observe changes -in the contacts database. When a change in the database occurs, the application -gets an event. The event carries information about the type of the event, -the contact ID, and the connection ID.

-struct TContactDbObserverEvent - { - TContactDbObserverEventType iType; - TContactItemId iContactId; - TUint iConnectionId; - }; - -

The following event types are defined in the cntdbobs.h header:

-enum TContactDbObserverEventType - { - EContactDbObserverEventNull, - EContactDbObserverEventUnused, - EContactDbObserverEventContactChanged, - EContactDbObserverEventContactDeleted, - EContactDbObserverEventContactAdded, - EContactDbObserverEventUnknownChanges, - EContactDbObserverEventRecover, - EContactDbObserverEventRollback, - EContactDbObserverEventTablesClosed, - EContactDbObserverEventTablesOpened, - EContactDbObserverEventTemplateChanged, - EContactDbObserverEventTemplateDeleted, - EContactDbObserverEventTemplateAdded, - EContactDbObserverEventCurrentItemDeleted, - EContactDbObserverEventCurrentItemChanged, - EContactDbObserverEventOwnCardChanged, - EContactDbObserverEventPreferredTemplateChanged, - EContactDbObserverEventOwnCardDeleted, - EContactDbObserverEventGroupAdded, - EContactDbObserverEventGroupChanged, - EContactDbObserverEventGroupDeleted, - EContactDbObserverEventCurrentDatabaseChanged, - EContactDbObserverEventSpeedDialsChanged - EContactDbObserverEventSortOrderChanged, - EContactDbObserverEventBackupBeginning, - EContactDbObserverEventRestoreBeginning, - EContactDbObserverEventBackupRestoreCompleted, - EContactDbObserverEventRestoreBadDatabase, - }; - -

In order to make an application receive events about contact database -changes, the MContactDbObserver base class must be inherited and HandleDatabaseEventL() virtual function must be implemented. -The function is called by the system when a contact database event occurs.

-class CMyContactObserver : public CBase, public MContactDbObserver - { - public: - // any public data and functions - CMyContactObserver (); - // override the virtual function from the base class - virtual void HandleDatabaseEventL( TContactDbObserverEvent aEvent ); - }; - // handling contact database events - void CMyContactObserver::HandleDatabaseEventL( TContactDbObserverEvent aEvent ) - { - // Event handling code - } - -

In addition, the application must create the CContactChangeNotifier object to register itself to receive events.

-CContactDatabase* contactDb = CContactDatabase::OpenL(); -//iContactDbObserver is a CMyContactObserver pointer -CContactChangeNotifier* notifier = CContactChangeNotifier::NewL( *contactDb, iContactDbObserver ); - + + + + + +Contacts +database events +

A client application of the Contacts Server can be set to observe changes +in the contacts database. When a change in the database occurs, the application +gets an event. The event carries information about the type of the event, +the contact ID, and the connection ID.

+struct TContactDbObserverEvent + { + TContactDbObserverEventType iType; + TContactItemId iContactId; + TUint iConnectionId; + }; + +

The following event types are defined in the cntdbobs.h:

+enum TContactDbObserverEventType + { + EContactDbObserverEventNull, + EContactDbObserverEventUnused, + EContactDbObserverEventContactChanged, + EContactDbObserverEventContactDeleted, + EContactDbObserverEventContactAdded, + EContactDbObserverEventUnknownChanges, + EContactDbObserverEventRecover, + EContactDbObserverEventRollback, + EContactDbObserverEventTablesClosed, + EContactDbObserverEventTablesOpened, + EContactDbObserverEventTemplateChanged, + EContactDbObserverEventTemplateDeleted, + EContactDbObserverEventTemplateAdded, + EContactDbObserverEventCurrentItemDeleted, + EContactDbObserverEventCurrentItemChanged, + EContactDbObserverEventOwnCardChanged, + EContactDbObserverEventPreferredTemplateChanged, + EContactDbObserverEventOwnCardDeleted, + EContactDbObserverEventGroupAdded, + EContactDbObserverEventGroupChanged, + EContactDbObserverEventGroupDeleted, + EContactDbObserverEventCurrentDatabaseChanged, + EContactDbObserverEventSpeedDialsChanged + EContactDbObserverEventSortOrderChanged, + EContactDbObserverEventBackupBeginning, + EContactDbObserverEventRestoreBeginning, + EContactDbObserverEventBackupRestoreCompleted, + EContactDbObserverEventRestoreBadDatabase, + }; + +

To receive events on contact database changes, the application must +derive MContactDbObserver base class and implement MContactDbObserver::HandleDatabaseEventL() virtual +function. The function is called by the system when a contact database event +occurs.

+class CMyContactObserver : public CBase, public MContactDbObserver + { + public: + // any public data and functions + CMyContactObserver (); + // override the virtual function from the base class + virtual void HandleDatabaseEventL( TContactDbObserverEvent aEvent ); + }; + // handling contact database events + void CMyContactObserver::HandleDatabaseEventL( TContactDbObserverEvent aEvent ) + { + // Event handling code + } + +

In addition, the application must create the CContactChangeNotifier object +to register itself to receive events.

+CContactDatabase* contactDb = CContactDatabase::OpenL(); +//iContactDbObserver is a CMyContactObserver pointer +CContactChangeNotifier* notifier = CContactChangeNotifier::NewL( *contactDb, iContactDbObserver ); +
\ No newline at end of file