|
1 // Copyright (c) 2005-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 #ifndef __CALCHANGECALLBACK_H__ |
|
17 #define __CALCHANGECALLBACK_H__ |
|
18 |
|
19 #include <calcommon.h> |
|
20 |
|
21 class TCalChangeEntry; |
|
22 |
|
23 class MCalChangeCallBack |
|
24 /** A call back class for observing changes in the model view. |
|
25 |
|
26 A client will not be notified of a change if it is the source of |
|
27 the change. |
|
28 |
|
29 @publishedAll |
|
30 @deprecated |
|
31 */ |
|
32 { |
|
33 public: |
|
34 /** Instance view change type |
|
35 @publishedAll |
|
36 @deprecated |
|
37 */ |
|
38 enum TChangeType |
|
39 { |
|
40 /** Entries are added */ |
|
41 EChangeAdd, |
|
42 /** Entries are deleted */ |
|
43 EChangeDelete, |
|
44 /** Entries are modified */ |
|
45 EChangeModify, |
|
46 /** Undefined entries */ |
|
47 EChangeUndefined, |
|
48 /** Entries cause overflow error */ |
|
49 EChangeOverflowError |
|
50 }; |
|
51 |
|
52 /** Instance view entry type |
|
53 @publishedAll |
|
54 @deprecated |
|
55 */ |
|
56 enum TChangeEntryType |
|
57 { |
|
58 /** Entry type is todo */ |
|
59 EChangeEntryTodo, |
|
60 /** Entry type is event */ |
|
61 EChangeEntryEvent, |
|
62 /** All entry types */ |
|
63 EChangeEntryAll |
|
64 }; |
|
65 /** A call back function for change notification |
|
66 @param aChangeEntryType Filters notifications to only notify about entries of this type (event/todo/all). |
|
67 |
|
68 */ |
|
69 virtual void CalChangeNotification(TChangeEntryType aChangeEntryType) = 0; |
|
70 }; |
|
71 |
|
72 /** A call back class for observing changes in the model view. |
|
73 |
|
74 The call back returns an array containing information about at least |
|
75 one change to the database. The information includes the type of change |
|
76 and the identity of the item being changed. |
|
77 |
|
78 A client will not be notified of a change if it is the source of |
|
79 the change. |
|
80 |
|
81 @publishedAll |
|
82 @released |
|
83 */ |
|
84 class MCalChangeCallBack2 |
|
85 { |
|
86 public: |
|
87 /** |
|
88 Type of change to the entry. |
|
89 */ |
|
90 enum TChangeType |
|
91 { |
|
92 /** Calendar entry added. */ |
|
93 EChangeAdd, |
|
94 /** Calendar entry deleted. */ |
|
95 EChangeDelete, |
|
96 /** Calendar entry modified. */ |
|
97 EChangeModify, |
|
98 /** Undefined Calendar entry change. */ |
|
99 EChangeUndefined, |
|
100 /** The time zone rules for one or more Calendar entries have changed. */ |
|
101 EChangeTzRules, |
|
102 /** Backup Starts |
|
103 * When the backup event is in process, the Calendar file is locked. |
|
104 * Most of operations are not permitted when it happens. However, few |
|
105 * operations, such as notification request, enabling broadcast |
|
106 * and closing Calendar is still permitted. |
|
107 * */ |
|
108 EBackupStart, |
|
109 /** Restore Starts |
|
110 * When the restore event is in process, the Calendar file is locked. |
|
111 * Most of operations are not permitted when it happens. However, few |
|
112 * operations, such as notification request, enabling broadcast |
|
113 * and closing Calendar is still permitted. |
|
114 */ |
|
115 ERestoreStart, |
|
116 /** Backup Ends |
|
117 * When the backup event is completed, the Calendar file is unlocked. |
|
118 * The application can continue to operate on the current Calendar file. |
|
119 */ |
|
120 EBackupEnd, |
|
121 /** Restore Ends |
|
122 * When the restore event is completed, the Calendar file is unlocked. |
|
123 * The application can operate on the restored Calendar file after the application |
|
124 * is notified with the message. However, if the application has cached any |
|
125 * Calendar objects, such as Calendar file ID, Calendar entries, Calendar instances, |
|
126 * they are not necessarily synched with the data in the newly restored Calendar file. |
|
127 */ |
|
128 ERestoreEnd, |
|
129 /** The restored Calendar file can not be opened |
|
130 * When the restore event is completed, the newly restored Calendar file can not |
|
131 * be opened. It is because either the file version is not supported or the data is corrupted. |
|
132 * Apart from closing the session and delete the file, no any other operation is permitted |
|
133 * when it happens. |
|
134 */ |
|
135 ERestoredFileCanNotBeOpened |
|
136 }; |
|
137 |
|
138 /** |
|
139 Type of entry. |
|
140 */ |
|
141 enum TChangeEntryType |
|
142 { |
|
143 /** Entry type is todo. */ |
|
144 EChangeEntryTodo, |
|
145 /** Entry type is event. */ |
|
146 EChangeEntryEvent, |
|
147 /** All entry types. */ |
|
148 EChangeEntryAll |
|
149 }; |
|
150 |
|
151 /** |
|
152 A call back function for change notification. |
|
153 |
|
154 @param aChangeItems List of changes since the last notification. |
|
155 */ |
|
156 virtual void CalChangeNotification(RArray<TCalChangeEntry>& aChangeItems) = 0; |
|
157 }; |
|
158 |
|
159 /** |
|
160 A structure for storing Calendar change notification data. This contains the |
|
161 Calendar entry local UID, the type of change and the entry type. |
|
162 |
|
163 The iChangeEntryType member may be set to MCalChangeCallBack2::EChangeEntryTodo |
|
164 or MCalChangeCallBack2::EChangeEntryEvent. MCalChangeCallBack2::EChangeEntryAll |
|
165 is provided for call back registration only. |
|
166 |
|
167 If the iChangeType member is MCalChangeCallBack2::EChangeUndefined or |
|
168 MCalChangeCallBack2::EChangeTzRules, iEntryId and iEntryType are undefined and |
|
169 should not be used by clients. |
|
170 |
|
171 When the iChangeType member is MCalChangeCallBack2::EChangeTzRules a change in |
|
172 time zone rules has been detected and processed by the Calendar server. The |
|
173 client should refresh any instance data they own as a result of this change. |
|
174 |
|
175 @publishedAll |
|
176 @released |
|
177 */ |
|
178 struct TCalChangeEntry |
|
179 { |
|
180 /** Local UID of the entry. */ |
|
181 TCalLocalUid iEntryId; |
|
182 /** Type of change to the entry. */ |
|
183 MCalChangeCallBack2::TChangeType iChangeType; |
|
184 /** Type of entry. */ |
|
185 MCalChangeCallBack2::TChangeEntryType iEntryType; |
|
186 }; |
|
187 |
|
188 /** Class to encapsulate call back registration parameters. |
|
189 |
|
190 The type of entries, the date range and whether undated todos are included |
|
191 can be specified. |
|
192 |
|
193 @publishedAll |
|
194 @released |
|
195 */ |
|
196 class CCalChangeNotificationFilter |
|
197 { |
|
198 public: |
|
199 IMPORT_C static CCalChangeNotificationFilter* NewL(MCalChangeCallBack2::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, const CalCommon::TCalTimeRange& aTimeRange); |
|
200 IMPORT_C ~CCalChangeNotificationFilter(); |
|
201 |
|
202 MCalChangeCallBack2::TChangeEntryType ChangeEntryType() const; |
|
203 TCalTime StartTime() const; |
|
204 TCalTime EndTime() const; |
|
205 TBool IncludeUndatedTodos() const; |
|
206 |
|
207 private: |
|
208 CCalChangeNotificationFilter(MCalChangeCallBack2::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, const CalCommon::TCalTimeRange& aTimeRange); |
|
209 |
|
210 MCalChangeCallBack2::TChangeEntryType iChangeEntryType; |
|
211 CalCommon::TCalTimeRange iTimeRange; |
|
212 TBool iIncludeUndatedTodos; |
|
213 }; |
|
214 |
|
215 #endif // __CALCHANGECALLBACK_H__ |