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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __CALCHANGECALLBACK_H__
17 #define __CALCHANGECALLBACK_H__
19 #include <calcommon.h>
21 class TCalChangeEntry;
23 class MCalChangeCallBack
24 /** A call back class for observing changes in the model view.
26 A client will not be notified of a change if it is the source of
34 /** Instance view change type
40 /** Entries are added */
42 /** Entries are deleted */
44 /** Entries are modified */
46 /** Undefined entries */
48 /** Entries cause overflow error */
52 /** Instance view entry type
58 /** Entry type is todo */
60 /** Entry type is event */
62 /** All entry types */
65 /** A call back function for change notification
66 @param aChangeEntryType Filters notifications to only notify about entries of this type (event/todo/all).
69 virtual void CalChangeNotification(TChangeEntryType aChangeEntryType) = 0;
72 /** A call back class for observing changes in the model view.
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.
78 A client will not be notified of a change if it is the source of
84 class MCalChangeCallBack2
88 Type of change to the entry.
92 /** Calendar entry added. */
94 /** Calendar entry deleted. */
96 /** Calendar entry modified. */
98 /** Undefined Calendar entry change. */
100 /** The time zone rules for one or more Calendar entries have changed. */
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.
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.
117 * When the backup event is completed, the Calendar file is unlocked.
118 * The application can continue to operate on the current Calendar file.
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.
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
135 ERestoredFileCanNotBeOpened
141 enum TChangeEntryType
143 /** Entry type is todo. */
145 /** Entry type is event. */
147 /** All entry types. */
152 A call back function for change notification.
154 @param aChangeItems List of changes since the last notification.
156 virtual void CalChangeNotification(RArray<TCalChangeEntry>& aChangeItems) = 0;
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.
163 The iChangeEntryType member may be set to MCalChangeCallBack2::EChangeEntryTodo
164 or MCalChangeCallBack2::EChangeEntryEvent. MCalChangeCallBack2::EChangeEntryAll
165 is provided for call back registration only.
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.
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.
178 struct TCalChangeEntry
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;
188 /** Class to encapsulate call back registration parameters.
190 The type of entries, the date range and whether undated todos are included
196 class CCalChangeNotificationFilter
199 IMPORT_C static CCalChangeNotificationFilter* NewL(MCalChangeCallBack2::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, const CalCommon::TCalTimeRange& aTimeRange);
200 IMPORT_C ~CCalChangeNotificationFilter();
202 MCalChangeCallBack2::TChangeEntryType ChangeEntryType() const;
203 TCalTime StartTime() const;
204 TCalTime EndTime() const;
205 TBool IncludeUndatedTodos() const;
208 CCalChangeNotificationFilter(MCalChangeCallBack2::TChangeEntryType aChangeEntryType, TBool aIncludeUndatedTodos, const CalCommon::TCalTimeRange& aTimeRange);
210 MCalChangeCallBack2::TChangeEntryType iChangeEntryType;
211 CalCommon::TCalTimeRange iTimeRange;
212 TBool iIncludeUndatedTodos;
215 #endif // __CALCHANGECALLBACK_H__