66
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
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".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: This class contains the actual implementation of the engine.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CAIAGENDAPLUGINENGINEIMPL_H
|
|
20 |
#define CAIAGENDAPLUGINENGINEIMPL_H
|
|
21 |
|
|
22 |
// INCLUDES
|
|
23 |
#include "CalEngineCallback.h"
|
|
24 |
#include "CalenEngine.h"
|
|
25 |
#include "PropertyObserver.h"
|
|
26 |
|
|
27 |
#include <calfilechangenotification.h>
|
|
28 |
|
|
29 |
// FORWARD DECLARATIONS
|
|
30 |
class CEnvironmentChangeNotifier;
|
|
31 |
class CEventExpirationTimer;
|
|
32 |
class CCalInstance;
|
|
33 |
class MPluginDataChangeObserver;
|
|
34 |
class CCalSession;
|
|
35 |
|
|
36 |
// CLASS DECLARATION
|
|
37 |
NONSHARABLE_CLASS( CAIAgendaPluginEngineImpl ) : public CBase,
|
|
38 |
public MCalenEngineListener,
|
|
39 |
public MPropertyChangeHandler,
|
|
40 |
public MCalFileChangeObserver
|
|
41 |
|
|
42 |
{
|
|
43 |
// Allow CAIAgendaPluginEngine to access the SafeRefresh()
|
|
44 |
friend class CAIAgendaPluginEngine;
|
|
45 |
|
|
46 |
public:
|
|
47 |
/**
|
|
48 |
* Two-phased constructor.
|
|
49 |
* @since Series 60 2.6
|
|
50 |
* @param ?arg1 ?description
|
|
51 |
**/
|
|
52 |
static CAIAgendaPluginEngineImpl* NewL(MPluginDataChangeObserver& aDataChangeObserver, TObserverType aObserverType);
|
|
53 |
|
|
54 |
/**
|
|
55 |
* ?member_description.
|
|
56 |
* @since Series 60 2.6
|
|
57 |
**/
|
|
58 |
void ConstructL(void);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Destructor.
|
|
62 |
* @since Series 60 2.6
|
|
63 |
**/
|
|
64 |
virtual ~CAIAgendaPluginEngineImpl(void);
|
|
65 |
|
|
66 |
private:
|
|
67 |
/**
|
|
68 |
* Hide default constructor.
|
|
69 |
* @since Series 60 2.6
|
|
70 |
**/
|
|
71 |
CAIAgendaPluginEngineImpl(MPluginDataChangeObserver& aDataChangeObserver, TObserverType aObserverType);
|
|
72 |
|
|
73 |
public: // From MCalenEngineListener
|
|
74 |
/**
|
|
75 |
* ?member_description.
|
|
76 |
* @since Series 60 2.6
|
|
77 |
**/
|
|
78 |
void OpenDatabaseCompleted(void);
|
|
79 |
|
|
80 |
/**
|
|
81 |
* ?member_description.
|
|
82 |
* @since Series 60 2.6
|
|
83 |
**/
|
|
84 |
void GetEntriesCompleted(void);
|
|
85 |
|
|
86 |
/**
|
|
87 |
* ?member_description.
|
|
88 |
* @since Series 60 2.6
|
|
89 |
**/
|
|
90 |
void DoGetEntriesCompletedL(void);
|
|
91 |
|
|
92 |
/**
|
|
93 |
* ?member_description.
|
|
94 |
* @since Series 60 2.6
|
|
95 |
**/
|
|
96 |
void GetTodosCompleted(void);
|
|
97 |
|
|
98 |
/**
|
|
99 |
* ?member_description.
|
|
100 |
* @since Series 60 2.6
|
|
101 |
**/
|
|
102 |
void GetFutureEventCompleted(void);
|
|
103 |
|
|
104 |
/**
|
|
105 |
* ?member_description.
|
|
106 |
* @since S60 3.1
|
|
107 |
**/
|
|
108 |
void GetCalendarDataCompleted(void);
|
|
109 |
|
|
110 |
/**
|
|
111 |
* ?member_description.
|
|
112 |
* @since S60 3.0
|
|
113 |
**/
|
|
114 |
void HandleError(TInt aError);
|
|
115 |
|
|
116 |
public: // From MPropertyChangeHandler
|
|
117 |
/**
|
|
118 |
* ?member_description.
|
|
119 |
* @since Series 60 3.0
|
|
120 |
**/
|
|
121 |
void HandlePropertyChange(const TUid& /*aCategory*/, const TUint& /*aKey*/, const TInt& /*aValue*/);
|
|
122 |
|
|
123 |
private: //from MCalFileChangeObserver
|
|
124 |
/*
|
|
125 |
* The callback that will recieve 1 or more file change notifications
|
|
126 |
* @param aCalendarInfoChangeEntries Array of CCalFileChangeInfo
|
|
127 |
*/
|
|
128 |
void CalendarInfoChangeNotificationL(RPointerArray<CCalFileChangeInfo>& aCalendarInfoChangeEntries);
|
|
129 |
|
|
130 |
private: // New functions
|
|
131 |
|
|
132 |
/**
|
|
133 |
* ?member_description.
|
|
134 |
* @since S60 3.1
|
|
135 |
**/
|
|
136 |
void DoGetCalendarDataCompletedL(void);
|
|
137 |
|
|
138 |
/**
|
|
139 |
* ?member_description.
|
|
140 |
* @since Series 60 2.6
|
|
141 |
**/
|
|
142 |
void OpenDataBase(void);
|
|
143 |
|
|
144 |
/**
|
|
145 |
* ?member_description.
|
|
146 |
* @since Series 60 2.6
|
|
147 |
**/
|
|
148 |
void DoOpenDataBaseL(void);
|
|
149 |
|
|
150 |
/**
|
|
151 |
* ?member_description.
|
|
152 |
* @since Series 60 2.6
|
|
153 |
**/
|
|
154 |
void GetTodayData(void);
|
|
155 |
|
|
156 |
/**
|
|
157 |
* ?member_description.
|
|
158 |
* @since Series 60 2.6
|
|
159 |
**/
|
|
160 |
void DoGetTodayDataL(void);
|
|
161 |
|
|
162 |
/**
|
|
163 |
* ?member_description.
|
|
164 |
* @since Series 60 2.6
|
|
165 |
**/
|
|
166 |
void GetFutureData(void);
|
|
167 |
|
|
168 |
/**
|
|
169 |
* ?member_description.
|
|
170 |
* @since Series 60 2.6
|
|
171 |
**/
|
|
172 |
void DoGetFutureDataL(void);
|
|
173 |
|
|
174 |
/**
|
|
175 |
* ?member_description.
|
|
176 |
* @since Series 60 2.6
|
|
177 |
* @return ?description
|
|
178 |
**/
|
|
179 |
TBool HasEventsForTodayL(void);
|
|
180 |
|
|
181 |
/**
|
|
182 |
* ?member_description.
|
|
183 |
* @since Series 60 2.6
|
|
184 |
**/
|
|
185 |
void NotifyObserverAndCloseDB(void);
|
|
186 |
|
|
187 |
/**
|
|
188 |
* ?member_description.
|
|
189 |
* @since Series 60 2.6
|
|
190 |
* @param ?arg1 ?description
|
|
191 |
* @return ?description
|
|
192 |
**/
|
|
193 |
static TInt EnvironmentChangeCallBack(TAny* aPtr);
|
|
194 |
|
|
195 |
/**
|
|
196 |
* ?member_description.
|
|
197 |
* @since Series 60 2.6
|
|
198 |
**/
|
|
199 |
void CloseCalendarEngine(void);
|
|
200 |
|
|
201 |
/**
|
|
202 |
* ?member_description.
|
|
203 |
* @since Series 60 2.6
|
|
204 |
**/
|
|
205 |
void RemoveExpiredEntries(void);
|
|
206 |
|
|
207 |
/**
|
|
208 |
* ?member_description.
|
|
209 |
* @since Series 60 2.6
|
|
210 |
**/
|
|
211 |
void DoRemoveExpiredEntriesL(void);
|
|
212 |
|
|
213 |
/**
|
|
214 |
* ?member_description.
|
|
215 |
* @since Series 60 2.6
|
|
216 |
**/
|
|
217 |
void SetTimerForNextExpiringEventL(void);
|
|
218 |
|
|
219 |
/**
|
|
220 |
* Find the difference (in minutes) between meeting in aIndex and next meeting (if exist) with different start time.
|
|
221 |
* @since S60 3.1
|
|
222 |
* @param aIndex Index of the current meeting.
|
|
223 |
* @param aDifference Reference to the result.
|
|
224 |
**/
|
|
225 |
void DiffToNextEventL(const TInt aIndex, TTimeIntervalMinutes& aDifference);
|
|
226 |
|
|
227 |
/**
|
|
228 |
* ?member_description.
|
|
229 |
* @since Series 60 2.6
|
|
230 |
* @param ?arg1 ?description
|
|
231 |
**/
|
|
232 |
void StateMachine(void);
|
|
233 |
|
|
234 |
protected: // for CAIAgendaPluginEngine
|
|
235 |
/**
|
|
236 |
* ?member_description.
|
|
237 |
* @since S60 3.0
|
|
238 |
**/
|
|
239 |
void SafeRefresh(void);
|
|
240 |
|
|
241 |
private: // From MEventExpirationObserver
|
|
242 |
/**
|
|
243 |
* Callback for iEventExpirationTimer.
|
|
244 |
* @since Series 60 2.6
|
|
245 |
**/
|
|
246 |
static TInt EventExpiredCallBack(TAny* aPtr);
|
|
247 |
|
|
248 |
/**
|
|
249 |
* Callback for iRefreshTimer.
|
|
250 |
* @since Series 60 3.0
|
|
251 |
**/
|
|
252 |
static TInt RefreshTimerCallBack(TAny* aPtr);
|
|
253 |
|
|
254 |
private: // Data members
|
|
255 |
// Calendar agenda engine
|
|
256 |
CCalenEngine* iCalendarEngine;
|
|
257 |
|
|
258 |
// ?one_line_short_description_of_data
|
|
259 |
RPointerArray<CCalInstance> iInstanceArray;
|
|
260 |
|
|
261 |
// ?one_line_short_description_of_data
|
|
262 |
MPluginDataChangeObserver& iDataChangeObserver;
|
|
263 |
|
|
264 |
// ?one_line_short_description_of_data
|
|
265 |
TObserverType iObserverType;
|
|
266 |
|
|
267 |
// ?one_line_short_description_of_data
|
|
268 |
CEnvironmentChangeNotifier* iEnvironmentChangeNotifier;
|
|
269 |
|
|
270 |
// ?one_line_short_description_of_data
|
|
271 |
enum TDBState
|
|
272 |
{
|
|
273 |
EDBOffline,
|
|
274 |
EDBInitializing,
|
|
275 |
EDBInitialized,
|
|
276 |
EDBOpening,
|
|
277 |
EDBOpen,
|
|
278 |
EDBReading
|
|
279 |
};
|
|
280 |
|
|
281 |
// ?one_line_short_description_of_data
|
|
282 |
enum TFetchState
|
|
283 |
{
|
|
284 |
EFetchNormal,
|
|
285 |
EFetchFuture
|
|
286 |
};
|
|
287 |
|
|
288 |
// ?one_line_short_description_of_data
|
|
289 |
TDBState iDBState;
|
|
290 |
|
|
291 |
// ?one_line_short_description_of_data
|
|
292 |
TFetchState iFetchState;
|
|
293 |
|
|
294 |
// ?one_line_short_description_of_data
|
|
295 |
TBool iNeedsUpdate;
|
|
296 |
|
|
297 |
// ?one_line_short_description_of_data
|
|
298 |
TBool iHadEvents;
|
|
299 |
|
|
300 |
// Timer for event expirations
|
|
301 |
CEventExpirationTimer* iExpirationTimer;
|
|
302 |
|
|
303 |
// timer for SafeRefresh
|
|
304 |
CEventExpirationTimer* iRefreshTimer;
|
|
305 |
|
|
306 |
// ?one_line_short_description_of_data
|
|
307 |
CPropertyObserver* iEventChangeObserver;
|
|
308 |
|
|
309 |
// ?one_line_short_description_of_data
|
|
310 |
CPropertyObserver* iTodoChangeObserver;
|
|
311 |
|
|
312 |
// Counter for SafeRefresh calls
|
|
313 |
TUint iRefreshCounter;
|
|
314 |
|
|
315 |
// Calendar session for receving notification
|
|
316 |
CCalSession* iCalendarSession;
|
|
317 |
|
|
318 |
};
|
|
319 |
|
|
320 |
#endif // CAIAGENDAPLUGINENGINEIMPL_H
|
|
321 |
|
|
322 |
|
|
323 |
// End of File
|