|
1 /* |
|
2 * Copyright (c) 2008 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: Calendar alarm manager |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef CALENALARMMANAGER_H |
|
21 #define CALENALARMMANAGER_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <vwsdef.h> |
|
25 #include <coeview.h> // MCoeViewActivationObserver |
|
26 #include <missedalarmstore.h> |
|
27 #include <cenrepnotifyhandler.h> // MCenRepNotifyHandlerCallback |
|
28 #include <calencommandhandler.h> |
|
29 #include <calennotificationhandler.h> // MCalenNotificationHandler |
|
30 #include <calentoolbar.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 class CCalenController; |
|
34 class CMissedAlarmStore; |
|
35 class CCalenContextFWListener; |
|
36 class CCalenViewManager; |
|
37 |
|
38 // CLASS DEFINITIONS |
|
39 |
|
40 class CCalenAlarmManager : public CBase, |
|
41 public MCalenNotificationHandler, |
|
42 public MCalenCommandHandler, |
|
43 public MCenRepNotifyHandlerCallback |
|
44 { |
|
45 public: |
|
46 /** |
|
47 * Symbian 1st phase constructor |
|
48 * @param aViewManager Reference to the CCalenViewManager |
|
49 * @return Pointer to CCalenViewManager |
|
50 */ |
|
51 static CCalenAlarmManager* NewL( CCalenController& aController ); |
|
52 |
|
53 /** |
|
54 * Destructor |
|
55 */ |
|
56 virtual ~CCalenAlarmManager(); |
|
57 |
|
58 private: |
|
59 /** |
|
60 * C++ constructor |
|
61 * @param aViewManager Reference to CCalenViewManager |
|
62 */ |
|
63 CCalenAlarmManager( CCalenController& aController ); |
|
64 |
|
65 /** |
|
66 * Symbian 2nd phase constructor |
|
67 */ |
|
68 void ConstructL(); |
|
69 |
|
70 public: |
|
71 |
|
72 /** |
|
73 * From MCalenCommandHandler. |
|
74 * Handles key presses. |
|
75 * |
|
76 * @param aCommand The command Id of the key. |
|
77 */ |
|
78 TBool HandleCommandL( const TCalenCommand& aCommand ); |
|
79 |
|
80 /** |
|
81 * From MCalenCommandHandler. |
|
82 * Allows extending this API without breaking BC. |
|
83 * |
|
84 * @param aExtensionUid specifies |
|
85 * @return extension of the requested type |
|
86 */ |
|
87 TAny* CalenCommandHandlerExtensionL( TUid aExtensionUid ); |
|
88 |
|
89 /** |
|
90 * Handles notifications (Leaving) |
|
91 */ |
|
92 void HandleNotificationL( TCalenNotification aNotification ); |
|
93 |
|
94 /** |
|
95 * From MCenRepNotifyHandlerCallback. |
|
96 * Notification of any change to the Missed Alarm Store central |
|
97 * repository |
|
98 * @param aId Id of the cenrep key that changed |
|
99 */ |
|
100 void HandleNotifyGeneric( TUint32 aId ); |
|
101 |
|
102 public: |
|
103 |
|
104 /** |
|
105 * Get Missed alarm store |
|
106 * @return reference to Missed alarm store |
|
107 */ |
|
108 CMissedAlarmStore* MissedAlarmStore(); |
|
109 |
|
110 /** |
|
111 * Get Missed alarms list with viewed info |
|
112 * @return array of missed alarms |
|
113 */ |
|
114 void GetMissedAlarmsList(RArray<TCalenInstanceId>& aMissedAlarmList); |
|
115 |
|
116 /** |
|
117 * Destroys CCalenContextFWListener object for Alarm |
|
118 * @param aCloseEventView |
|
119 */ |
|
120 void StopAlarmContextListener(TBool aCloseEventView=EFalse); |
|
121 |
|
122 /** |
|
123 * Destroys CCalenContextFWListener object for Auto snooze case. |
|
124 */ |
|
125 void StopContextListenerForAutoSnooze(); |
|
126 |
|
127 /** |
|
128 * Creates CCalenContextFWListener object for Alarm |
|
129 */ |
|
130 void StartAlarmContextListenerL(); |
|
131 |
|
132 private: |
|
133 |
|
134 /** |
|
135 * from MCalenNotificationHandler |
|
136 */ |
|
137 void HandleNotification( const TCalenNotification aNotification ); |
|
138 |
|
139 /** |
|
140 * Creates missed alarms list |
|
141 */ |
|
142 void CreateMissedAlarmsListL(); |
|
143 |
|
144 /** |
|
145 * Handles the command ECalenMissedAlarmsView |
|
146 * for launching missed alarms view |
|
147 */ |
|
148 void OnCmdMissedAlarmViewL(); |
|
149 |
|
150 /** |
|
151 * Handles the command ECalenMissedEventView |
|
152 * for launching missed event view |
|
153 */ |
|
154 void OnCmdMissedEventViewL(); |
|
155 |
|
156 /** |
|
157 * Handles the command ECalenCmdClear |
|
158 * for clearing a missed alarm |
|
159 */ |
|
160 void OnCmdClearMissedAlarmL(); |
|
161 |
|
162 /** |
|
163 * Handles the command ECalenCmdClearAll |
|
164 * for clearing all missed alarms |
|
165 */ |
|
166 void OnCmdClearAllMissedAlarmsL(); |
|
167 |
|
168 /** |
|
169 * Handles the command ECalenCmdGotoCalendar |
|
170 * for going back to native view from missed alarms view |
|
171 */ |
|
172 void OnCmdGoToCalendarL(); |
|
173 |
|
174 /** |
|
175 * Handles the command ECalenMissedEventViewFromIdle |
|
176 * for intialising the data before launching the |
|
177 * missed event view from Idle(soft notification/indicator) |
|
178 */ |
|
179 void OnCmdLaunchFromIdleL(); |
|
180 |
|
181 /** |
|
182 * For taking action whenever an entry is deleted |
|
183 */ |
|
184 void HandleEntryDeleteNotificationL(); |
|
185 |
|
186 /** |
|
187 * For updating the missed alarms list when an entry is deleted |
|
188 */ |
|
189 void UpdateMissedAlarmsListOnDeleteL(); |
|
190 |
|
191 /** |
|
192 * For handling notification ECalenNotifyLostAlarms |
|
193 * which updates missed alarms list and missed alarms count |
|
194 */ |
|
195 void HandleNotifyLostAlarmsL(); |
|
196 |
|
197 /** |
|
198 * For handling notification ECalenNotifyMissedAlarmsViewClosed |
|
199 * which activates the previous view or exits the application |
|
200 * if launched from Idle |
|
201 */ |
|
202 void HandleMissedAlarmViewClosedL(); |
|
203 |
|
204 /** |
|
205 * For handling notification ECalenNotifyMissedEventViewClosed |
|
206 * which activates the previous view or exits the application |
|
207 * if launched from Idle |
|
208 */ |
|
209 void HandleMissedEventViewClosedL(); |
|
210 |
|
211 /** |
|
212 * For handling notification ECalenNotifySystemTimeChanged |
|
213 * Listen for the system time change notification. |
|
214 * Clear all the future alarms which are missed due to |
|
215 * time change |
|
216 */ |
|
217 void HandleSystemTimeChangedL(); |
|
218 |
|
219 /** |
|
220 * Sets the context based on the missed alarm |
|
221 */ |
|
222 void SetContextForMissedEventViewL(); |
|
223 |
|
224 /** |
|
225 * Mark missed alarm event as viewed |
|
226 */ |
|
227 void SetMissedAlarmEventAsViewed(); |
|
228 |
|
229 /** |
|
230 * Remove all viewed events |
|
231 */ |
|
232 void RemoveAllViewedEventsL(); |
|
233 |
|
234 /** |
|
235 * Clear one missed alarm |
|
236 */ |
|
237 TBool ClearOneMissedAlarmL(TInt aEntryLocalUid, TCalCollectionId aColId ); |
|
238 |
|
239 /** |
|
240 * Update missed alarms list |
|
241 */ |
|
242 void UpdateMissedAlarmsListL(); |
|
243 |
|
244 /** |
|
245 * Get the alarm time for the entry |
|
246 */ |
|
247 void GetAlarmDateTimeL(const CCalEntry& aEntry, TTime& aAlarmDateTime); |
|
248 |
|
249 /** |
|
250 * Launch the event viewer after pressing MSK. |
|
251 */ |
|
252 void LaunchEventViewerL(); |
|
253 |
|
254 /** |
|
255 * Handles Back and Delete event in event viewer in MSK case. |
|
256 */ |
|
257 void HandleBackEventL(); |
|
258 |
|
259 private: // Data |
|
260 |
|
261 CCalenController& iController; |
|
262 CCalenViewManager& iViewManager; |
|
263 CMissedAlarmStore* iMissedAlarmStore; |
|
264 |
|
265 CRepository* iMissedAlarmStoreRepository; |
|
266 CCenRepNotifyHandler* iCenRepChangeNotifier; |
|
267 |
|
268 RArray<TCalenInstanceId> iMissedAlarmList; |
|
269 |
|
270 TVwsViewId iPreviousToMissedAlarmView; |
|
271 TVwsViewId iPreviousToMissedEventView; |
|
272 |
|
273 TUint32 iMissedAlarmsCount; |
|
274 TBool iLaunchedFromIdle; |
|
275 TBool iViewerLaunchedFromIdle; // For opening alarm through MSK. |
|
276 |
|
277 TInt iOrigWGPos; // original window group position |
|
278 TInt iOrigWGPrio; // original window group priority |
|
279 CCalenContextFWListener* iContextFWListener; //Context Framework handler |
|
280 TUid iPreviousToEventViewUid; // getting the view id previous to event view. |
|
281 }; |
|
282 |
|
283 #endif // CALENALARMMANAGER_H |
|
284 |
|
285 // End of file |