|
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #if !defined(__CNTDBOBS_H__) |
|
17 #define __CNTDBOBS_H__ |
|
18 |
|
19 #if !defined(__E32DEF_H__) |
|
20 #include <e32def.h> |
|
21 #endif |
|
22 |
|
23 #if !( defined __SYMBIAN_CNTMODEL_HIDE_DBMS__ ) && !defined __D32DBMS_H__ |
|
24 #include <d32dbms.h> |
|
25 #else |
|
26 #include <s32std.h> |
|
27 #include <f32file.h> |
|
28 #endif |
|
29 |
|
30 #include <cntdef.h> //for tcontactitemid |
|
31 |
|
32 /** Change event type. For events which update, delete or add a contact item, the |
|
33 ID of the item affected is provided in the TContactDbObserverEvent struct. |
|
34 @publishedAll |
|
35 @released |
|
36 */ |
|
37 enum TContactDbObserverEventType |
|
38 { |
|
39 /** Null event type. */ |
|
40 EContactDbObserverEventNull, |
|
41 /** Not currently used. */ |
|
42 EContactDbObserverEventUnused, |
|
43 /** A contact item (not a template, group or own card) has been changed. */ |
|
44 EContactDbObserverEventContactChanged, |
|
45 /** A contact item (not a template, group or own card) has been deleted. */ |
|
46 EContactDbObserverEventContactDeleted, |
|
47 /** A contact item (not a template or group) has been added. */ |
|
48 EContactDbObserverEventContactAdded, |
|
49 /** Unknown change event type. */ |
|
50 EContactDbObserverEventUnknownChanges, |
|
51 /** Recover from a damaged database. */ |
|
52 EContactDbObserverEventRecover, |
|
53 /** Rollback from a change to the database. */ |
|
54 EContactDbObserverEventRollback, |
|
55 /** Database tables closed. */ |
|
56 EContactDbObserverEventTablesClosed, |
|
57 /** Database tables opened. */ |
|
58 EContactDbObserverEventTablesOpened, |
|
59 /** A contact card template has changed. */ |
|
60 EContactDbObserverEventTemplateChanged, |
|
61 /** A contact card template has been deleted. */ |
|
62 EContactDbObserverEventTemplateDeleted, |
|
63 /** A contact card template has been added. */ |
|
64 EContactDbObserverEventTemplateAdded, |
|
65 /** The database's current item has been deleted. */ |
|
66 EContactDbObserverEventCurrentItemDeleted, |
|
67 /** The database's current item has changed. */ |
|
68 EContactDbObserverEventCurrentItemChanged, |
|
69 /** The database's own card has changed. */ |
|
70 EContactDbObserverEventOwnCardChanged, |
|
71 /** The database's preferred template has been set. (See CContactDatabase::SetPrefTemplateL()). */ |
|
72 EContactDbObserverEventPreferredTemplateChanged, |
|
73 /** An own card has been deleted from the database. */ |
|
74 EContactDbObserverEventOwnCardDeleted, |
|
75 /** A contact item group has been added. */ |
|
76 EContactDbObserverEventGroupAdded, |
|
77 /** A contact item group has been updated. */ |
|
78 EContactDbObserverEventGroupChanged, |
|
79 /** A contact item group has been deleted from the database. */ |
|
80 EContactDbObserverEventGroupDeleted, |
|
81 /** The current database has changed. */ |
|
82 EContactDbObserverEventCurrentDatabaseChanged, |
|
83 /** The phone number assigned to one of the speed dial positions |
|
84 has been replaced, removed or modified.*/ |
|
85 EContactDbObserverEventSpeedDialsChanged, |
|
86 /** Not currently used. */ |
|
87 EContactDbObserverEventSortOrderChanged, |
|
88 /** Contacts DB about to be backed up */ |
|
89 EContactDbObserverEventBackupBeginning, |
|
90 /** Contacts DB about to be restored */ |
|
91 EContactDbObserverEventRestoreBeginning, |
|
92 /** The backup/restore operation has completed. */ |
|
93 EContactDbObserverEventBackupRestoreCompleted, |
|
94 /** The restore operation has completed but the database could not be opened. */ |
|
95 EContactDbObserverEventRestoreBadDatabase, |
|
96 /** Database has been compressed. */ |
|
97 EContactDbObserverEventCompress |
|
98 }; |
|
99 |
|
100 struct TContactDbObserverEvent |
|
101 /** Contact database change event details. These include the type of change event |
|
102 and the ID of the contact item affected by the change, if relevant. |
|
103 |
|
104 An object of this type is passed to a contact database's change observer, |
|
105 see MContactDbObserver::HandleDatabaseEventL(). |
|
106 @publishedAll |
|
107 @released |
|
108 */ |
|
109 { |
|
110 /** The change event type. */ |
|
111 TContactDbObserverEventType iType; |
|
112 /** The ID of the contact item affected. */ |
|
113 TContactItemId iContactId; |
|
114 /** Identifies which connection to the contacts server generated the event. Use |
|
115 CContactDatabase::ConnectionId() to get the ID of the current connection. |
|
116 |
|
117 Set to zero if the event has no meaningful connection ID. */ |
|
118 TUint iConnectionId; |
|
119 }; |
|
120 |
|
121 class MContactDbObserver |
|
122 /** The interface for an observer that handles changes to a contact database. |
|
123 |
|
124 It specifies a single pure virtual function which should be implemented by |
|
125 the observer class to test the type of the change event (see the TContactDbObserverEventType |
|
126 enum) and handle it. |
|
127 |
|
128 There is no need for the observer class to explicitly test for all possible |
|
129 event types - the event is for information only and event types which are of no interest |
|
130 to the observer class can safely be ignored. |
|
131 |
|
132 The change event type (TContactDbObserverEventType) may be augmented |
|
133 in future releases with additional values. |
|
134 |
|
135 A contact database observer pointer is passed to the NewL() function for the |
|
136 CContactChangeNotifier class. |
|
137 @publishedAll |
|
138 @released |
|
139 */ |
|
140 { |
|
141 public: |
|
142 /** Tests the contact database observer event type and handles it. The ID of a |
|
143 contact affected by the change event, if relevant, can be retrieved via TContactDbObserverEvent::iContactId. |
|
144 |
|
145 @param aEvent Provides information about the change event. */ |
|
146 virtual void HandleDatabaseEventL(TContactDbObserverEvent aEvent)=0; |
|
147 }; |
|
148 |
|
149 |
|
150 #endif |