williamr@4: /* williamr@4: * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: An observer interface for contact store events williamr@4: * williamr@4: */ williamr@4: williamr@4: williamr@4: #ifndef MVPBKCONTACTSTOREOBSERVER_H williamr@4: #define MVPBKCONTACTSTOREOBSERVER_H williamr@4: williamr@4: williamr@4: // INCLUDES williamr@4: #include williamr@4: williamr@4: // FORWARD DECLARATIONS williamr@4: class MVPbkContactStore; williamr@4: class MVPbkContactLink; williamr@4: williamr@4: // CLASS DECLARATIONS williamr@4: williamr@4: /** williamr@4: * A class for a contact store event. williamr@4: * williamr@4: * The contact store event contains the type of the event and williamr@4: * possibly a contact link to a changed contact. williamr@4: */ williamr@4: class TVPbkContactStoreEvent williamr@4: { williamr@4: public: // Types williamr@4: /** williamr@4: * The type of the event williamr@4: */ williamr@4: enum TVPbkContactStoreEventType williamr@4: { williamr@4: /// No event occured williamr@4: ENullEvent, williamr@4: /// A contact has been added to the contact store williamr@4: EContactAdded, williamr@4: /// A contact has been deleted from the contact store williamr@4: EContactDeleted, williamr@4: /// An existing contact in the contact store has been changed williamr@4: EContactChanged, williamr@4: /// A contact group has been added to the contact store williamr@4: EGroupAdded, williamr@4: /// A contact group has been deleted from the contact store williamr@4: EGroupDeleted, williamr@4: /// An existing contact group in the contact store has been changed williamr@4: EGroupChanged, williamr@4: /// Contact store backup is beginning williamr@4: EStoreBackupBeginning, williamr@4: /// Contact store restore is beginning williamr@4: EStoreRestoreBeginning, williamr@4: /// Contact store backup or restore is completed williamr@4: EStoreBackupRestoreCompleted, williamr@4: /// There has been some unknown changes in the contact store williamr@4: EUnknownChanges williamr@4: }; williamr@4: williamr@4: public: // Interface williamr@4: /** williamr@4: * Constructor williamr@4: * williamr@4: * @param aEventType The type of the contact store event williamr@4: * @param aContactLink The identifier of the changed contact or NULL. williamr@4: * The link is not owned by this class. williamr@4: */ williamr@4: TVPbkContactStoreEvent( williamr@4: TVPbkContactStoreEventType aEventType, williamr@4: MVPbkContactLink* aContactLink); williamr@4: williamr@4: public: // Contact store event data williamr@4: /// Own: Type of the event that has happened williamr@4: TVPbkContactStoreEventType iEventType; williamr@4: /// Ref: Link to the contact that is accociated with the event or NULL. williamr@4: /// The link is valid only during HandleStoreEventL function call williamr@4: /// and client can not take the ownership of the instance. williamr@4: // Client must clone the link if it needs it later. williamr@4: MVPbkContactLink* iContactLink; williamr@4: ///Own: Spare for future extension williamr@4: TAny* iSpare; williamr@4: ///Own: Spare for future extension williamr@4: TAny* iSpare2; williamr@4: }; williamr@4: williamr@4: inline TVPbkContactStoreEvent::TVPbkContactStoreEvent( williamr@4: TVPbkContactStoreEventType aEventType, williamr@4: MVPbkContactLink* aContactLink) : williamr@4: iEventType(aEventType), williamr@4: iContactLink(aContactLink) williamr@4: { williamr@4: } williamr@4: williamr@4: /** williamr@4: * An observer interface for contact store events williamr@4: * williamr@4: * The client of the contact store must implement this interface. The contact williamr@4: * store informs client about its state using this interface. The client is williamr@4: * also able to get store events about changes in the store content. williamr@4: */ williamr@4: class MVPbkContactStoreObserver williamr@4: { williamr@4: public: // New functions williamr@4: /** williamr@4: * Called when a contact store is ready to use. williamr@4: * williamr@4: * @param aContactStore The store that is ready. williamr@4: */ williamr@4: virtual void StoreReady(MVPbkContactStore& aContactStore) =0; williamr@4: williamr@4: /** williamr@4: * Called when a contact store becomes unavailable. williamr@4: * williamr@4: * Client may inspect the reason of the unavailability and decide williamr@4: * whether or not it will keep the store opened (ie. listen to williamr@4: * the store events). williamr@4: * williamr@4: * @param aContactStore The store that became unavailable. williamr@4: * @param aReason The reason why the store is unavailable. williamr@4: * This is one of the system wide error codes. williamr@4: */ williamr@4: virtual void StoreUnavailable(MVPbkContactStore& aContactStore, williamr@4: TInt aReason) =0; williamr@4: williamr@4: /** williamr@4: * Called when changes occur in the contact store. williamr@4: * williamr@4: * @see TVPbkContactStoreEvent williamr@4: * @param aContactStore A store whose event it is. williamr@4: * @param aStoreEvent The event that has occurred. williamr@4: */ williamr@4: virtual void HandleStoreEventL( williamr@4: MVPbkContactStore& aContactStore, williamr@4: TVPbkContactStoreEvent aStoreEvent) =0; williamr@4: williamr@4: /** williamr@4: * Returns an extension point for this interface or NULL. williamr@4: * williamr@4: * @param aExtensionUid no extensions defined currently. williamr@4: * @return an extension point for this interface or NULL. williamr@4: */ williamr@4: virtual TAny* ContactStoreObserverExtension(TUid /*aExtensionUid*/) williamr@4: { return NULL; } williamr@4: williamr@4: protected: // Destructor williamr@4: virtual ~MVPbkContactStoreObserver() { } williamr@4: williamr@4: }; williamr@4: williamr@4: williamr@4: #endif // MVPBKCONTACTSTOREOBSERVER_H williamr@4: williamr@4: //End of file