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