2 * Copyright (c) 2004-2007 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: An observer interface for contact store events
19 #ifndef MVPBKCONTACTSTOREOBSERVER_H
20 #define MVPBKCONTACTSTOREOBSERVER_H
26 // FORWARD DECLARATIONS
27 class MVPbkContactStore;
28 class MVPbkContactLink;
33 * A class for a contact store event.
35 * The contact store event contains the type of the event and
36 * possibly a contact link to a changed contact.
38 class TVPbkContactStoreEvent
42 * The type of the event
44 enum TVPbkContactStoreEventType
48 /// A contact has been added to the contact store
50 /// A contact has been deleted from the contact store
52 /// An existing contact in the contact store has been changed
54 /// A contact group has been added to the contact store
56 /// A contact group has been deleted from the contact store
58 /// An existing contact group in the contact store has been changed
60 /// Contact store backup is beginning
61 EStoreBackupBeginning,
62 /// Contact store restore is beginning
63 EStoreRestoreBeginning,
64 /// Contact store backup or restore is completed
65 EStoreBackupRestoreCompleted,
66 /// There has been some unknown changes in the contact store
74 * @param aEventType The type of the contact store event
75 * @param aContactLink The identifier of the changed contact or NULL.
76 * The link is not owned by this class.
78 TVPbkContactStoreEvent(
79 TVPbkContactStoreEventType aEventType,
80 MVPbkContactLink* aContactLink);
82 public: // Contact store event data
83 /// Own: Type of the event that has happened
84 TVPbkContactStoreEventType iEventType;
85 /// Ref: Link to the contact that is accociated with the event or NULL.
86 /// The link is valid only during HandleStoreEventL function call
87 /// and client can not take the ownership of the instance.
88 // Client must clone the link if it needs it later.
89 MVPbkContactLink* iContactLink;
90 ///Own: Spare for future extension
92 ///Own: Spare for future extension
96 inline TVPbkContactStoreEvent::TVPbkContactStoreEvent(
97 TVPbkContactStoreEventType aEventType,
98 MVPbkContactLink* aContactLink) :
99 iEventType(aEventType),
100 iContactLink(aContactLink)
105 * An observer interface for contact store events
107 * The client of the contact store must implement this interface. The contact
108 * store informs client about its state using this interface. The client is
109 * also able to get store events about changes in the store content.
111 class MVPbkContactStoreObserver
113 public: // New functions
115 * Called when a contact store is ready to use.
117 * @param aContactStore The store that is ready.
119 virtual void StoreReady(MVPbkContactStore& aContactStore) =0;
122 * Called when a contact store becomes unavailable.
124 * Client may inspect the reason of the unavailability and decide
125 * whether or not it will keep the store opened (ie. listen to
128 * @param aContactStore The store that became unavailable.
129 * @param aReason The reason why the store is unavailable.
130 * This is one of the system wide error codes.
132 virtual void StoreUnavailable(MVPbkContactStore& aContactStore,
136 * Called when changes occur in the contact store.
138 * @see TVPbkContactStoreEvent
139 * @param aContactStore A store whose event it is.
140 * @param aStoreEvent The event that has occurred.
142 virtual void HandleStoreEventL(
143 MVPbkContactStore& aContactStore,
144 TVPbkContactStoreEvent aStoreEvent) =0;
147 * Returns an extension point for this interface or NULL.
149 * @param aExtensionUid no extensions defined currently.
150 * @return an extension point for this interface or NULL.
152 virtual TAny* ContactStoreObserverExtension(TUid /*aExtensionUid*/)
155 protected: // Destructor
156 virtual ~MVPbkContactStoreObserver() { }
161 #endif // MVPBKCONTACTSTOREOBSERVER_H