williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined(__CNTDBOBS_H__) williamr@2: #define __CNTDBOBS_H__ williamr@2: williamr@2: #if !defined(__E32DEF_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@4: #if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ ) && !defined __D32DBMS_H__ williamr@2: #include williamr@2: #else williamr@2: #include williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #include //for tcontactitemid williamr@2: williamr@2: /** Change event type. For events which update, delete or add a contact item, the williamr@2: ID of the item affected is provided in the TContactDbObserverEvent struct. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: enum TContactDbObserverEventType williamr@2: { williamr@2: /** Null event type. */ williamr@2: EContactDbObserverEventNull, williamr@2: /** Not currently used. */ williamr@2: EContactDbObserverEventUnused, williamr@2: /** A contact item (not a template, group or own card) has been changed. */ williamr@2: EContactDbObserverEventContactChanged, williamr@2: /** A contact item (not a template, group or own card) has been deleted. */ williamr@2: EContactDbObserverEventContactDeleted, williamr@2: /** A contact item (not a template or group) has been added. */ williamr@2: EContactDbObserverEventContactAdded, williamr@2: /** Unknown change event type. */ williamr@2: EContactDbObserverEventUnknownChanges, williamr@2: /** Recover from a damaged database. */ williamr@2: EContactDbObserverEventRecover, williamr@2: /** Rollback from a change to the database. */ williamr@2: EContactDbObserverEventRollback, williamr@2: /** Database tables closed. */ williamr@2: EContactDbObserverEventTablesClosed, williamr@2: /** Database tables opened. */ williamr@2: EContactDbObserverEventTablesOpened, williamr@2: /** A contact card template has changed. */ williamr@2: EContactDbObserverEventTemplateChanged, williamr@2: /** A contact card template has been deleted. */ williamr@2: EContactDbObserverEventTemplateDeleted, williamr@2: /** A contact card template has been added. */ williamr@2: EContactDbObserverEventTemplateAdded, williamr@2: /** The database's current item has been deleted. */ williamr@2: EContactDbObserverEventCurrentItemDeleted, williamr@2: /** The database's current item has changed. */ williamr@2: EContactDbObserverEventCurrentItemChanged, williamr@2: /** The database's own card has changed. */ williamr@2: EContactDbObserverEventOwnCardChanged, williamr@2: /** The database's preferred template has been set. (See CContactDatabase::SetPrefTemplateL()). */ williamr@2: EContactDbObserverEventPreferredTemplateChanged, williamr@2: /** An own card has been deleted from the database. */ williamr@2: EContactDbObserverEventOwnCardDeleted, williamr@2: /** A contact item group has been added. */ williamr@2: EContactDbObserverEventGroupAdded, williamr@2: /** A contact item group has been updated. */ williamr@2: EContactDbObserverEventGroupChanged, williamr@2: /** A contact item group has been deleted from the database. */ williamr@2: EContactDbObserverEventGroupDeleted, williamr@2: /** The current database has changed. */ williamr@2: EContactDbObserverEventCurrentDatabaseChanged, williamr@2: /** The phone number assigned to one of the speed dial positions williamr@2: has been replaced, removed or modified.*/ williamr@2: EContactDbObserverEventSpeedDialsChanged, williamr@2: /** Not currently used. */ williamr@2: EContactDbObserverEventSortOrderChanged, williamr@2: /** Contacts DB about to be backed up */ williamr@2: EContactDbObserverEventBackupBeginning, williamr@2: /** Contacts DB about to be restored */ williamr@2: EContactDbObserverEventRestoreBeginning, williamr@2: /** The backup/restore operation has completed. */ williamr@2: EContactDbObserverEventBackupRestoreCompleted, williamr@2: /** The restore operation has completed but the database could not be opened. */ williamr@2: EContactDbObserverEventRestoreBadDatabase, williamr@2: /** Database has been compressed. */ williamr@2: EContactDbObserverEventCompress williamr@2: }; williamr@2: williamr@2: struct TContactDbObserverEvent williamr@2: /** Contact database change event details. These include the type of change event williamr@2: and the ID of the contact item affected by the change, if relevant. williamr@2: williamr@2: An object of this type is passed to a contact database's change observer, williamr@2: see MContactDbObserver::HandleDatabaseEventL(). williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: /** The change event type. */ williamr@2: TContactDbObserverEventType iType; williamr@2: /** The ID of the contact item affected. */ williamr@2: TContactItemId iContactId; williamr@2: /** Identifies which connection to the contacts server generated the event. Use williamr@2: CContactDatabase::ConnectionId() to get the ID of the current connection. williamr@2: williamr@2: Set to zero if the event has no meaningful connection ID. */ williamr@2: TUint iConnectionId; williamr@2: }; williamr@2: williamr@2: class MContactDbObserver williamr@2: /** The interface for an observer that handles changes to a contact database. williamr@2: williamr@2: It specifies a single pure virtual function which should be implemented by williamr@2: the observer class to test the type of the change event (see the TContactDbObserverEventType williamr@2: enum) and handle it. williamr@2: williamr@2: There is no need for the observer class to explicitly test for all possible williamr@2: event types - the event is for information only and event types which are of no interest williamr@2: to the observer class can safely be ignored. williamr@2: williamr@2: The change event type (TContactDbObserverEventType) may be augmented williamr@2: in future releases with additional values. williamr@2: williamr@2: A contact database observer pointer is passed to the NewL() function for the williamr@2: CContactChangeNotifier class. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: /** Tests the contact database observer event type and handles it. The ID of a williamr@2: contact affected by the change event, if relevant, can be retrieved via TContactDbObserverEvent::iContactId. williamr@2: williamr@2: @param aEvent Provides information about the change event. */ williamr@2: virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent)=0; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif