|
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 #include <calalarm.h> |
|
20 #include <calentry.h> |
|
21 #include <StringLoader.h> |
|
22 #include <centralrepository.h> |
|
23 #include <apgtask.h> |
|
24 #include <aknViewAppUi.h> |
|
25 #include <aknbutton.h> |
|
26 #include <akntoolbar.h> |
|
27 #include <missedalarm.h> |
|
28 #include <missedalarmstore.h> |
|
29 #include <missedalarmstorecrkeys.h> |
|
30 #include <calenagendautils.h> |
|
31 #include <calencommonui.rsg> |
|
32 #include <CalendarInternalCRKeys.h> |
|
33 #include <calendateutils.h> |
|
34 #include <calencommands.hrh> // Calendar commands |
|
35 #include <calencontext.h> |
|
36 #include <calenservices.h> |
|
37 #include <calentoolbar.h> |
|
38 #include <GlobalWindowPriorities.h> |
|
39 |
|
40 #include "calendarui_debug.h" |
|
41 #include "calenalarmmanager.h" |
|
42 #include "CalenUid.h" |
|
43 #include "calencontroller.h" |
|
44 #include "calendar.hrh" |
|
45 #include "calenviewmanager.h" |
|
46 #include "calensetting.h" |
|
47 #include "calencontextfwlistener.h" |
|
48 #include "CleanupResetAndDestroy.h" |
|
49 #include "calenattachmentmodel.h" |
|
50 |
|
51 static const TUint32 KMaxMissedAlarms = 10; |
|
52 // Order of calendar window(at front) after Stop/Snooze of alarm from event viewer. |
|
53 static const TInt KCalendarWindowOnFront(0); |
|
54 |
|
55 // ---------------------------------------------------------------------------- |
|
56 // CCalenAlarmManager::NewL |
|
57 // 1st phase of construction |
|
58 // ---------------------------------------------------------------------------- |
|
59 // |
|
60 CCalenAlarmManager* CCalenAlarmManager::NewL(CCalenController& aController) |
|
61 { |
|
62 TRACE_ENTRY_POINT; |
|
63 |
|
64 CCalenAlarmManager* self = new( ELeave ) CCalenAlarmManager( aController ); |
|
65 CleanupStack::PushL( self ); |
|
66 self->ConstructL(); |
|
67 CleanupStack::Pop( self ); |
|
68 |
|
69 TRACE_EXIT_POINT; |
|
70 return self; |
|
71 } |
|
72 |
|
73 // ---------------------------------------------------------------------------- |
|
74 // CCalenAlarmManager::CCalenAlarmManager |
|
75 // C++ default Constructor. |
|
76 // ---------------------------------------------------------------------------- |
|
77 // |
|
78 CCalenAlarmManager::CCalenAlarmManager( CCalenController& aController ) |
|
79 : iController( aController ),iViewManager(aController.ViewManager()), |
|
80 iContextFWListener(NULL) |
|
81 { |
|
82 TRACE_ENTRY_POINT; |
|
83 TRACE_EXIT_POINT; |
|
84 } |
|
85 |
|
86 // ---------------------------------------------------------------------------- |
|
87 // CCalenAlarmManager::~CCalenAlarmManager |
|
88 // Destructor. |
|
89 // ---------------------------------------------------------------------------- |
|
90 // |
|
91 CCalenAlarmManager::~CCalenAlarmManager() |
|
92 { |
|
93 TRACE_ENTRY_POINT; |
|
94 |
|
95 if(iContextFWListener) |
|
96 { |
|
97 delete iContextFWListener; |
|
98 iContextFWListener = NULL; |
|
99 } |
|
100 |
|
101 if(iCenRepChangeNotifier) |
|
102 { |
|
103 iCenRepChangeNotifier->StopListening(); |
|
104 delete iCenRepChangeNotifier; |
|
105 } |
|
106 delete iMissedAlarmStore; |
|
107 |
|
108 |
|
109 iMissedAlarmList.Close(); |
|
110 |
|
111 |
|
112 TRACE_EXIT_POINT; |
|
113 } |
|
114 |
|
115 // ---------------------------------------------------------------------------- |
|
116 // CCalenAlarmManager::ConstructL |
|
117 // 2nd phase of construction. |
|
118 // (other items were commented in a header). |
|
119 // ---------------------------------------------------------------------------- |
|
120 // |
|
121 void CCalenAlarmManager::ConstructL() |
|
122 { |
|
123 TRACE_ENTRY_POINT; |
|
124 |
|
125 iMissedAlarmStoreRepository = CRepository::NewL( KCRUidMissedAlarmStore ); |
|
126 |
|
127 // Create missed alarm store |
|
128 iMissedAlarmStore = CMissedAlarmStore::NewL(*iMissedAlarmStoreRepository); |
|
129 |
|
130 iCenRepChangeNotifier = CCenRepNotifyHandler::NewL( *this, *iMissedAlarmStoreRepository ); |
|
131 iCenRepChangeNotifier->StartListeningL(); |
|
132 |
|
133 iMissedAlarmStore->CountL(iMissedAlarmsCount); |
|
134 if(iMissedAlarmsCount) |
|
135 { |
|
136 CreateMissedAlarmsListL(); |
|
137 } |
|
138 |
|
139 TRACE_EXIT_POINT; |
|
140 } |
|
141 |
|
142 // ---------------------------------------------------------------------------- |
|
143 // CCalenAlarmManager::HandleCommandL |
|
144 // Handles alarm manager commands. |
|
145 // ---------------------------------------------------------------------------- |
|
146 // |
|
147 TBool CCalenAlarmManager::HandleCommandL( const TCalenCommand& aCommand ) |
|
148 { |
|
149 TRACE_ENTRY_POINT; |
|
150 |
|
151 TBool continueCommand(EFalse); |
|
152 switch( aCommand.Command() ) |
|
153 { |
|
154 case ECalenMissedAlarmsView: |
|
155 { |
|
156 OnCmdMissedAlarmViewL(); |
|
157 } |
|
158 break; |
|
159 case ECalenMissedEventView: |
|
160 { |
|
161 OnCmdMissedEventViewL(); |
|
162 } |
|
163 break; |
|
164 case ECalenCmdClear: |
|
165 { |
|
166 OnCmdClearMissedAlarmL(); |
|
167 } |
|
168 break; |
|
169 case ECalenCmdClearAll: |
|
170 { |
|
171 OnCmdClearAllMissedAlarmsL(); |
|
172 } |
|
173 break; |
|
174 case ECalenCmdGotoCalendar: |
|
175 { |
|
176 // Handling of this command may be moved to viewmanager in future, |
|
177 // as it is a general command not specific to missed alarms |
|
178 OnCmdGoToCalendarL(); |
|
179 } |
|
180 break; |
|
181 case ECalenMissedAlarmsViewFromIdle: |
|
182 { |
|
183 RemoveAllViewedEventsL(); |
|
184 iViewManager.StartActiveStepL(); |
|
185 } |
|
186 break; |
|
187 case ECalenMissedEventViewFromIdle: |
|
188 { |
|
189 iLaunchedFromIdle = ETrue; |
|
190 OnCmdLaunchFromIdleL(); |
|
191 } |
|
192 break; |
|
193 case ECalenEventViewFromAlarm: |
|
194 { |
|
195 TBool attachmentOpened = iController.Services().GetAttachmentData()->IsAttachmentOpen(); |
|
196 if(!attachmentOpened) |
|
197 { |
|
198 LaunchEventViewerL(); |
|
199 iViewManager.SetRepopulation(EFalse); |
|
200 iController.ViewManager().RequestActivationL( KUidCalenEventView, KUidCalenShowAlarmCba ); |
|
201 } |
|
202 } |
|
203 break; |
|
204 case ECalenEventViewFromAlarmStopOnly: |
|
205 { |
|
206 LaunchEventViewerL(); |
|
207 iViewManager.SetRepopulation(EFalse); |
|
208 iController.ViewManager().RequestActivationL( KUidCalenEventView, KUidCalenShowAlarmStopOnlyCba ); |
|
209 } |
|
210 break; |
|
211 default: |
|
212 break; |
|
213 } |
|
214 |
|
215 TRACE_EXIT_POINT; |
|
216 return continueCommand; |
|
217 } |
|
218 |
|
219 // ---------------------------------------------------------------------------- |
|
220 // CCalenAlarmManager::CalenCommandHandlerExtensionL |
|
221 // Dummy implementation. |
|
222 // (other items were commented in a header). |
|
223 // ---------------------------------------------------------------------------- |
|
224 // |
|
225 TAny* CCalenAlarmManager::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ ) |
|
226 { |
|
227 TRACE_ENTRY_POINT; |
|
228 TRACE_EXIT_POINT; |
|
229 return NULL; |
|
230 } |
|
231 |
|
232 // ---------------------------------------------------------------------------- |
|
233 // CCalenAlarmManager::HandleNotification |
|
234 // Calls back when notifications that it has been registered for are broadcast |
|
235 // ---------------------------------------------------------------------------- |
|
236 // |
|
237 void CCalenAlarmManager::HandleNotification(const TCalenNotification aNotification ) |
|
238 { |
|
239 TRACE_ENTRY_POINT; |
|
240 |
|
241 PIM_TRAPD_HANDLE( HandleNotificationL( aNotification ) ); |
|
242 |
|
243 TRACE_EXIT_POINT; |
|
244 } |
|
245 |
|
246 // ---------------------------------------------------------------------------- |
|
247 // CCalenAlarmManager::HandleNotificationL |
|
248 // Called from HandleNotification() when notifications that it has been |
|
249 // registered for are broadcast |
|
250 // ---------------------------------------------------------------------------- |
|
251 // |
|
252 void CCalenAlarmManager::HandleNotificationL( TCalenNotification aNotification ) |
|
253 { |
|
254 TRACE_ENTRY_POINT; |
|
255 |
|
256 switch(aNotification) |
|
257 { |
|
258 case ECalenNotifyLostAlarms: |
|
259 { |
|
260 HandleNotifyLostAlarmsL(); |
|
261 } |
|
262 break; |
|
263 case ECalenNotifyEntryDeleted: |
|
264 case ECalenNotifyInstanceDeleted: |
|
265 { |
|
266 HandleBackEventL(); |
|
267 HandleEntryDeleteNotificationL(); |
|
268 } |
|
269 break; |
|
270 case ECalenNotifyEntrySaved: |
|
271 { |
|
272 HandleEntryDeleteNotificationL(); |
|
273 } |
|
274 break; |
|
275 case ECalenNotifyMultipleEntriesDeleted: |
|
276 { |
|
277 // clear all the missed alarms from central repository |
|
278 iMissedAlarmStore->RemoveAllL(); |
|
279 |
|
280 // clear the missed alarms list |
|
281 if(iMissedAlarmList.Count()) |
|
282 { |
|
283 iMissedAlarmList.Close(); |
|
284 } |
|
285 } |
|
286 break; |
|
287 case ECalenNotifyMissedAlarmViewClosed: |
|
288 { |
|
289 HandleMissedAlarmViewClosedL(); |
|
290 } |
|
291 break; |
|
292 case ECalenNotifyClearMissedAlarms: |
|
293 { |
|
294 TVwsViewId activeView; |
|
295 iController.AppUi().GetActiveViewId(activeView); |
|
296 if(activeView.iViewUid == KUidCalenMissedAlarmsView) |
|
297 { |
|
298 OnCmdClearAllMissedAlarmsL(); |
|
299 } |
|
300 } |
|
301 break; |
|
302 case ECalenNotifyMissedEventViewClosed: |
|
303 { |
|
304 HandleMissedEventViewClosedL(); |
|
305 } |
|
306 break; |
|
307 case ECalenNotifySystemTimeChanged: |
|
308 { |
|
309 if(iMissedAlarmList.Count()) |
|
310 { |
|
311 HandleSystemTimeChangedL(); |
|
312 } |
|
313 } |
|
314 break; |
|
315 case ECalenNotifyAlarmStopped: |
|
316 { |
|
317 // notify alarmui through the context framework |
|
318 iContextFWListener->AlarmStopL(); |
|
319 } |
|
320 break; |
|
321 case ECalenNotifyAlarmSnoozed: |
|
322 { |
|
323 // notify alarmui through the context framework |
|
324 iContextFWListener->AlarmSnoozeL(); |
|
325 } |
|
326 break; |
|
327 case ECalenNotifyEntryClosed: |
|
328 { |
|
329 HandleBackEventL(); |
|
330 } |
|
331 break; |
|
332 |
|
333 case ECalenNotifyAppForegrounded: |
|
334 { |
|
335 if( iController.IsFasterAppFlagEnabled() ) |
|
336 { |
|
337 iController.SetFasterAppFlag( EFalse ); |
|
338 } |
|
339 } |
|
340 break; |
|
341 default: |
|
342 break; |
|
343 } |
|
344 |
|
345 TRACE_EXIT_POINT; |
|
346 } |
|
347 |
|
348 // ---------------------------------------------------------------------------- |
|
349 // CCalenAlarmManager::HandleNotifyGeneric |
|
350 // From MCenRepNotifyHandlerCallback |
|
351 // Generic notification that one of our central repository keys has changed |
|
352 // If any keys change we broadcast a settings changed notification |
|
353 // (other items were commented in a header). |
|
354 // ---------------------------------------------------------------------------- |
|
355 // |
|
356 void CCalenAlarmManager::HandleNotifyGeneric( TUint32 aCenrepKeyId ) |
|
357 { |
|
358 TRACE_ENTRY_POINT; |
|
359 |
|
360 if( aCenrepKeyId <= KMissedAlarmsMaxValue) |
|
361 { |
|
362 iController.BroadcastNotification(ECalenNotifyLostAlarms); |
|
363 } |
|
364 |
|
365 TRACE_EXIT_POINT; |
|
366 } |
|
367 |
|
368 // ---------------------------------------------------------------------------- |
|
369 // CCalenAlarmManager::CreateMissedAlarmsListL |
|
370 // Creates missed alarms list |
|
371 // ---------------------------------------------------------------------------- |
|
372 void CCalenAlarmManager::CreateMissedAlarmsListL() |
|
373 { |
|
374 TRACE_ENTRY_POINT; |
|
375 |
|
376 if(iMissedAlarmList.Count()) |
|
377 { |
|
378 iMissedAlarmList.Reset(); |
|
379 } |
|
380 |
|
381 RPointerArray<CMissedAlarm> missedAlarmStorelist; |
|
382 CleanupResetAndDestroyPushL( missedAlarmStorelist ); |
|
383 |
|
384 iMissedAlarmStore->GetL(missedAlarmStorelist); |
|
385 |
|
386 TCalenInstanceId instanceId; |
|
387 TInt entryLocalUid; |
|
388 TTime instanceTime; |
|
389 |
|
390 for(TInt index=0;index < missedAlarmStorelist.Count();index++) |
|
391 { |
|
392 CMissedAlarm* missedAlarm = missedAlarmStorelist[index]; |
|
393 entryLocalUid = missedAlarm->iLuid; |
|
394 instanceTime = missedAlarm->iInstanceTime; |
|
395 |
|
396 CCalSession *session = NULL; |
|
397 TRAPD(err,session = &iController.Services().SessionL( missedAlarm->iCalFileName )); |
|
398 //missed alarm belongs to existing calendar |
|
399 if(err != KErrNotFound) |
|
400 { |
|
401 // pack instance ids of the missed alarm instances |
|
402 TRAP_IGNORE(instanceId = TCalenInstanceId::CreateL( entryLocalUid, instanceTime, 0 )); |
|
403 instanceId.iColId = session->CollectionIdL(); |
|
404 iMissedAlarmList.Append(instanceId); |
|
405 } |
|
406 else |
|
407 { |
|
408 //missed alarm does not belong to any calendar so delete it, since user has deleted the calendar |
|
409 iMissedAlarmStore->RemoveL(*missedAlarm); |
|
410 } |
|
411 } |
|
412 |
|
413 CleanupStack::PopAndDestroy(); // missedAlarmStorelist |
|
414 |
|
415 TRACE_EXIT_POINT; |
|
416 } |
|
417 |
|
418 // ---------------------------------------------------------------------------- |
|
419 // CCalenAlarmManager::GetMissedAlarmsList |
|
420 // Get Missed alarms list with viewed inf |
|
421 // ---------------------------------------------------------------------------- |
|
422 void CCalenAlarmManager::GetMissedAlarmsList(RArray<TCalenInstanceId>& aMissedAlarmsList) |
|
423 { |
|
424 TRACE_ENTRY_POINT; |
|
425 |
|
426 if(!iMissedAlarmList.Count()) |
|
427 { |
|
428 TRAP_IGNORE(CreateMissedAlarmsListL()); |
|
429 } |
|
430 |
|
431 for(TInt index=0;index<iMissedAlarmList.Count();index++) |
|
432 { |
|
433 aMissedAlarmsList.Append(iMissedAlarmList[index]); |
|
434 } |
|
435 |
|
436 TRACE_EXIT_POINT; |
|
437 } |
|
438 |
|
439 // ---------------------------------------------------------------------------- |
|
440 // CCalenAlarmManager::StartAlarmContextListener |
|
441 // Creates CCalenContextFWListener object for Alarm |
|
442 // ---------------------------------------------------------------------------- |
|
443 void CCalenAlarmManager::StartAlarmContextListenerL() |
|
444 { |
|
445 TRACE_ENTRY_POINT; |
|
446 |
|
447 //if in alarm viewer mode: |
|
448 iContextFWListener = CCalenContextFWListener::NewL(*this); |
|
449 // raise calendar priority as the topmost window (alarmui is left at the background) |
|
450 RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin(); |
|
451 iOrigWGPos = windowGroup.OrdinalPosition(); |
|
452 iOrigWGPrio = windowGroup.OrdinalPriority(); |
|
453 // move the window on top of the alarm notification window! |
|
454 PIM_ASSERT( windowGroup.SetOrdinalPositionErr( 0, ECoeWinPriorityAlwaysAtFront +KGlobalWindowPriority_Alarm +1 ) ); |
|
455 |
|
456 TRACE_EXIT_POINT; |
|
457 } |
|
458 |
|
459 // ---------------------------------------------------------------------------- |
|
460 // CCalenAlarmManager::StopAlarmContextListener |
|
461 // Destroys CCalenContextFWListener object for Alarm |
|
462 // ---------------------------------------------------------------------------- |
|
463 void CCalenAlarmManager::StopAlarmContextListener(TBool aCloseEventView) |
|
464 { |
|
465 TRACE_ENTRY_POINT; |
|
466 |
|
467 // restore window group priority |
|
468 RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin(); |
|
469 PIM_ASSERT( windowGroup.SetOrdinalPositionErr( KCalendarWindowOnFront, iOrigWGPrio ) ); |
|
470 |
|
471 //Close Event View |
|
472 if(aCloseEventView) |
|
473 { |
|
474 MCalenToolbar* toolbarImpl = iController.ViewManager().ToolbarOrNull(); |
|
475 if(toolbarImpl) // If toolbar exists |
|
476 { |
|
477 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
478 |
|
479 // Remove the viewer toolbar buttons |
|
480 toolbar.RemoveItem(ECalenDeleteCurrentEntry); // Delete button |
|
481 toolbar.RemoveItem(ECalenEditCurrentEntry); // Edit button |
|
482 toolbar.RemoveItem(ECalenSend); // Send button |
|
483 } |
|
484 iController.BroadcastNotification( ECalenNotifyEntryClosed ); |
|
485 } |
|
486 |
|
487 TRACE_EXIT_POINT; |
|
488 } |
|
489 |
|
490 //--------------------------------------------------------- |
|
491 // CCalenAlarmManager::StopContextListenerForAutoSnooze |
|
492 // Destroys CCalenContextFWListener object for autosnooze case |
|
493 //--------------------------------------------------------- |
|
494 // |
|
495 void CCalenAlarmManager::StopContextListenerForAutoSnooze() |
|
496 { |
|
497 TRACE_ENTRY_POINT; |
|
498 |
|
499 // restore window group priority |
|
500 RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin(); |
|
501 PIM_ASSERT( windowGroup.SetOrdinalPositionErr( KCalendarWindowOnFront, iOrigWGPrio ) ); |
|
502 |
|
503 // After auto snooze, stop the alarm and open the event viewer in normal mode. |
|
504 iController.BroadcastNotification( ECalenNotifyStopAlarm ); |
|
505 |
|
506 TRACE_EXIT_POINT; |
|
507 } |
|
508 |
|
509 // ---------------------------------------------------------------------------- |
|
510 // CCalenAlarmManager::MissedAlarmStore |
|
511 // Returns a reference to the Missed Alarm Store |
|
512 // ---------------------------------------------------------------------------- |
|
513 CMissedAlarmStore* CCalenAlarmManager::MissedAlarmStore() |
|
514 { |
|
515 TRACE_ENTRY_POINT; |
|
516 TRACE_EXIT_POINT; |
|
517 |
|
518 return iMissedAlarmStore; |
|
519 } |
|
520 |
|
521 //--------------------------------------------------------- |
|
522 // CCalenAlarmManager::OnCmdMissedAlarmViewL |
|
523 // Handles the command ECalenMissedAlarmsView |
|
524 //--------------------------------------------------------- |
|
525 // |
|
526 void CCalenAlarmManager::OnCmdMissedAlarmViewL() |
|
527 { |
|
528 TRACE_ENTRY_POINT; |
|
529 |
|
530 iViewManager.SetRepopulation(EFalse); |
|
531 |
|
532 if(iMissedAlarmsCount == 1) |
|
533 { |
|
534 //Set the Context for missed event view |
|
535 SetContextForMissedEventViewL(); |
|
536 |
|
537 iMissedAlarmStore->RemoveAllL(); |
|
538 |
|
539 iMissedAlarmList.Close(); |
|
540 |
|
541 iPreviousToMissedEventView.iViewUid = iViewManager.CurrentView(); |
|
542 |
|
543 // activate missed event view |
|
544 iViewManager.RequestActivationL( KUidCalenMissedEventView ); |
|
545 } |
|
546 else if(iMissedAlarmsCount > 1) |
|
547 { |
|
548 iPreviousToMissedAlarmView.iViewUid = iViewManager.CurrentView(); |
|
549 |
|
550 // activate missed alarms view |
|
551 iViewManager.RequestActivationL( KUidCalenMissedAlarmsView, |
|
552 KUidCalenShowBackCba ); |
|
553 } |
|
554 |
|
555 TRACE_EXIT_POINT |
|
556 } |
|
557 |
|
558 //--------------------------------------------------------- |
|
559 // CCalenAlarmManager::OnCmdMissedEventViewL |
|
560 // Handles the command ECalenMissedEventView |
|
561 //--------------------------------------------------------- |
|
562 // |
|
563 void CCalenAlarmManager::OnCmdMissedEventViewL() |
|
564 { |
|
565 TRACE_ENTRY_POINT; |
|
566 |
|
567 //get the context |
|
568 MCalenContext &context = iController.Services().Context(); |
|
569 TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid; |
|
570 TCalCollectionId colid = context.InstanceId().iColId; |
|
571 |
|
572 ClearOneMissedAlarmL(missedAlarmEntryUid, colid); |
|
573 SetMissedAlarmEventAsViewed(); |
|
574 |
|
575 iPreviousToMissedEventView.iViewUid = iViewManager.CurrentView(); |
|
576 |
|
577 iViewManager.SetRepopulation(EFalse); |
|
578 |
|
579 // activate missed event view |
|
580 iViewManager.RequestActivationL( KUidCalenMissedEventView, KUidCalenShowBackCba ); |
|
581 |
|
582 TRACE_EXIT_POINT; |
|
583 } |
|
584 |
|
585 //--------------------------------------------------------- |
|
586 // CCalenAlarmManager::OnCmdClearMissedAlarmL |
|
587 // Clears a missed alarm |
|
588 //--------------------------------------------------------- |
|
589 // |
|
590 void CCalenAlarmManager::OnCmdClearMissedAlarmL() |
|
591 { |
|
592 TRACE_ENTRY_POINT; |
|
593 |
|
594 // get the context |
|
595 MCalenContext &context = iController.Services().Context(); |
|
596 TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid; |
|
597 TCalCollectionId colid = context.InstanceId().iColId; |
|
598 // clear missed alarm from cenrep |
|
599 |
|
600 ClearOneMissedAlarmL( missedAlarmEntryUid, colid ); |
|
601 for(TInt index = 0;index < iMissedAlarmList.Count();index++) |
|
602 { |
|
603 if( ( missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid ) && |
|
604 ( colid == iMissedAlarmList[index].iColId ) ) |
|
605 { |
|
606 // remove from missed alarms list |
|
607 iMissedAlarmList.Remove(index); |
|
608 break; |
|
609 } |
|
610 } |
|
611 |
|
612 // Refresh the missed alarm view |
|
613 iViewManager.StartActiveStepL(); |
|
614 |
|
615 TRACE_EXIT_POINT; |
|
616 } |
|
617 |
|
618 //--------------------------------------------------------- |
|
619 // CCalenAlarmManager::OnCmdClearAllMissedAlarmsL |
|
620 // Clears all missed alarms |
|
621 //--------------------------------------------------------- |
|
622 // |
|
623 void CCalenAlarmManager::OnCmdClearAllMissedAlarmsL() |
|
624 { |
|
625 TRACE_ENTRY_POINT; |
|
626 |
|
627 // Clear all the missed alarm events from cenrep |
|
628 |
|
629 RPointerArray<CMissedAlarm> missedAlarmArray; |
|
630 CleanupResetAndDestroyPushL( missedAlarmArray ); |
|
631 iMissedAlarmStore->GetL(missedAlarmArray); |
|
632 for(TInt index = 0;index < missedAlarmArray.Count();index++) |
|
633 { |
|
634 // remove from cenrep |
|
635 iMissedAlarmStore->RemoveL(*missedAlarmArray[index]); |
|
636 } |
|
637 |
|
638 CleanupStack::PopAndDestroy(); // aMissedAlarmArray |
|
639 |
|
640 if(iMissedAlarmList.Count()) |
|
641 { |
|
642 iMissedAlarmList.Close(); |
|
643 } |
|
644 |
|
645 // Refresh the missed alarm view |
|
646 iViewManager.StartActiveStepL(); |
|
647 |
|
648 TRACE_EXIT_POINT; |
|
649 } |
|
650 |
|
651 //--------------------------------------------------------- |
|
652 // CCalenAlarmManager::OnCmdGoToCalendar |
|
653 // Handles goto calendar command in Missed alarm View |
|
654 //--------------------------------------------------------- |
|
655 // |
|
656 void CCalenAlarmManager::OnCmdGoToCalendarL() |
|
657 { |
|
658 TRACE_ENTRY_POINT; |
|
659 |
|
660 iViewManager.SetRepopulation(EFalse); |
|
661 |
|
662 // remove all the viewed events |
|
663 RemoveAllViewedEventsL(); |
|
664 |
|
665 // if previous view set,activate the previous view |
|
666 if(iPreviousToMissedAlarmView.iViewUid != KNullUid) |
|
667 { |
|
668 iViewManager.RequestActivationL(iPreviousToMissedAlarmView.iViewUid); |
|
669 } |
|
670 else |
|
671 { |
|
672 // if previous view is not set,activate the default view of the calendar |
|
673 TUid defViewUid = iController.Settings().DefaultView(); |
|
674 iViewManager.RequestActivationL(defViewUid); |
|
675 } |
|
676 |
|
677 TRACE_EXIT_POINT; |
|
678 } |
|
679 |
|
680 // ---------------------------------------------------------------------------- |
|
681 // CCalenAlarmManager::OnCmdLaunchFromIdleL |
|
682 // Handles the command ECalenMissedEventViewFromIdle |
|
683 // for intialising the data before launching the |
|
684 // missed event view from Idle(soft notification/indicator |
|
685 // ---------------------------------------------------------------------------- |
|
686 // |
|
687 void CCalenAlarmManager::OnCmdLaunchFromIdleL() |
|
688 { |
|
689 TRACE_ENTRY_POINT; |
|
690 |
|
691 //get the missed alarms list from store |
|
692 RPointerArray<CMissedAlarm> aMissedAlarmArray; |
|
693 CleanupResetAndDestroyPushL( aMissedAlarmArray ); |
|
694 iMissedAlarmStore->GetL(aMissedAlarmArray); |
|
695 if (aMissedAlarmArray.Count()) |
|
696 { |
|
697 CCalSession &session = iController.Services().SessionL(aMissedAlarmArray[0]->iCalFileName); |
|
698 CCalEntry* entry = iController.Services().EntryViewL(session.CollectionIdL())->FetchL( |
|
699 aMissedAlarmArray[0]->iLuid); |
|
700 User::LeaveIfNull( entry ); |
|
701 CleanupStack::PushL( entry ); |
|
702 |
|
703 TTime instanceTime; |
|
704 TCalTime inscaltime; |
|
705 instanceTime = CalenAgendaUtils::EntryTimeL( *entry ); |
|
706 inscaltime.SetTimeLocalL( instanceTime ); |
|
707 |
|
708 // set the context |
|
709 MCalenContext &context = iController.Services().Context(); |
|
710 TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime ); |
|
711 id.iColId = session.CollectionIdL(); |
|
712 context.SetInstanceIdL( id, context.ViewId() ); |
|
713 CleanupStack::PopAndDestroy( entry ); |
|
714 iMissedAlarmList.Remove(0); //Clear the alarm list |
|
715 iMissedAlarmStore->RemoveL(*aMissedAlarmArray[0]); |
|
716 } |
|
717 CleanupStack::PopAndDestroy(); // aMissedAlarmArray |
|
718 |
|
719 iViewManager.StartActiveStepL(); |
|
720 |
|
721 TRACE_EXIT_POINT |
|
722 } |
|
723 |
|
724 // ---------------------------------------------------------------------------- |
|
725 // CCalenAlarmManager::HandleNotifyLostAlarmsL |
|
726 // For handling notification ECalenNotifyLostAlarms |
|
727 // which updates missed alarms list and missed alarms count |
|
728 // ---------------------------------------------------------------------------- |
|
729 // |
|
730 void CCalenAlarmManager::HandleNotifyLostAlarmsL() |
|
731 { |
|
732 TRACE_ENTRY_POINT; |
|
733 |
|
734 TUint32 newCount; |
|
735 // update the missed alarms count |
|
736 iMissedAlarmStore->CountL(newCount); |
|
737 |
|
738 if(newCount>=iMissedAlarmsCount) |
|
739 { |
|
740 UpdateMissedAlarmsListL(); |
|
741 } |
|
742 |
|
743 iMissedAlarmsCount = newCount; |
|
744 // refresh the missed alarm view if it is current view |
|
745 TUid currentViewId(iViewManager.CurrentView()); |
|
746 if(currentViewId == KUidCalenMissedAlarmsView) |
|
747 { |
|
748 iViewManager.StartActiveStepL(); |
|
749 } |
|
750 |
|
751 TRACE_EXIT_POINT; |
|
752 } |
|
753 |
|
754 // ---------------------------------------------------------------------------- |
|
755 // CCalenAlarmManager::HandleMissedAlarmViewClosedL |
|
756 // For handling notification ECalenNotifyMissedAlarmsViewClosed |
|
757 // which activates the previous view or exits the application |
|
758 // if launched from Idle |
|
759 // ---------------------------------------------------------------------------- |
|
760 // |
|
761 void CCalenAlarmManager::HandleMissedAlarmViewClosedL() |
|
762 { |
|
763 TRACE_ENTRY_POINT; |
|
764 |
|
765 // remove all the missed alarms |
|
766 OnCmdClearAllMissedAlarmsL(); |
|
767 |
|
768 if(iPreviousToMissedAlarmView.iViewUid!=KNullUid) |
|
769 { |
|
770 iViewManager.RequestActivationL( iPreviousToMissedAlarmView.iViewUid ); |
|
771 iPreviousToMissedAlarmView.iViewUid = KNullUid; |
|
772 iPreviousToMissedEventView.iViewUid = KNullUid; |
|
773 |
|
774 // set the default context of the view |
|
775 MCalenContext &context = iController.Services().Context(); |
|
776 context.SetFocusDateAndTimeL( context.DefaultCalTimeForViewsL(), |
|
777 iPreviousToMissedAlarmView ); |
|
778 } |
|
779 else |
|
780 { |
|
781 iController.AppUi().ProcessCommandL(EAknSoftkeyExit); |
|
782 } |
|
783 |
|
784 TRACE_EXIT_POINT; |
|
785 } |
|
786 |
|
787 // ---------------------------------------------------------------------------- |
|
788 // CCalenAlarmManager::HandleMissedEventViewClosedL |
|
789 // For handling notification ECalenNotifyMissedEventViewClosed |
|
790 // which activates the previous view or exits the application |
|
791 // if launched from Idle |
|
792 // ---------------------------------------------------------------------------- |
|
793 // |
|
794 void CCalenAlarmManager::HandleMissedEventViewClosedL() |
|
795 { |
|
796 TRACE_ENTRY_POINT; |
|
797 |
|
798 if(iLaunchedFromIdle) |
|
799 { |
|
800 iLaunchedFromIdle = EFalse; |
|
801 } |
|
802 |
|
803 if(iPreviousToMissedEventView.iViewUid!=KNullUid) |
|
804 { |
|
805 // if MAV is launched from soft notification/status pane indicator |
|
806 // activate the missed alarms view with close as RSK |
|
807 if(iPreviousToMissedEventView.iViewUid== KUidCalenMissedAlarmsView |
|
808 && iPreviousToMissedAlarmView.iViewUid == KNullUid ) |
|
809 { |
|
810 iViewManager.RequestActivationL( iPreviousToMissedEventView.iViewUid , |
|
811 KUidCalenShowCloseCba ); |
|
812 } |
|
813 else |
|
814 { |
|
815 iViewManager.RequestActivationL(iPreviousToMissedEventView.iViewUid); |
|
816 } |
|
817 iPreviousToMissedEventView.iViewUid = KNullUid; |
|
818 } |
|
819 else |
|
820 { |
|
821 iController.AppUi().ProcessCommandL(EAknSoftkeyExit); |
|
822 } |
|
823 |
|
824 TRACE_EXIT_POINT; |
|
825 } |
|
826 |
|
827 |
|
828 //--------------------------------------------------------- |
|
829 // CCalenViewManager::HandleEntryDeleteNotificationL |
|
830 // Handle entry delete notification |
|
831 //--------------------------------------------------------- |
|
832 // |
|
833 void CCalenAlarmManager::HandleEntryDeleteNotificationL() |
|
834 { |
|
835 TRACE_ENTRY_POINT; |
|
836 |
|
837 UpdateMissedAlarmsListOnDeleteL(); |
|
838 |
|
839 // if launched from soft notification/indicator |
|
840 if(iLaunchedFromIdle) |
|
841 { |
|
842 iController.AppUi().ProcessCommandL(EAknSoftkeyExit); |
|
843 iLaunchedFromIdle = EFalse; |
|
844 } |
|
845 else if(iPreviousToMissedEventView.iViewUid != KNullUid) |
|
846 { |
|
847 // from mav -> missed event view -> delete..... |
|
848 // from native view -> missed event view -> delete |
|
849 // activate iPreviousToMissedEventView |
|
850 iViewManager.RequestActivationL(iPreviousToMissedEventView.iViewUid); |
|
851 iPreviousToMissedEventView.iViewUid = KNullUid; |
|
852 } |
|
853 |
|
854 TRACE_EXIT_POINT; |
|
855 } |
|
856 |
|
857 //--------------------------------------------------------- |
|
858 // CCalenViewManager::SetContextForMissedEventViewL |
|
859 // Sets the context before launching missed event view |
|
860 //--------------------------------------------------------- |
|
861 // |
|
862 void CCalenAlarmManager::SetContextForMissedEventViewL() |
|
863 { |
|
864 TRACE_ENTRY_POINT; |
|
865 |
|
866 CCalEntry* entry = iController.Services().EntryViewL(iMissedAlarmList[0].iColId)->FetchL( |
|
867 iMissedAlarmList[0].iEntryLocalUid); |
|
868 User::LeaveIfNull( entry ); |
|
869 CleanupStack::PushL( entry ); |
|
870 |
|
871 TTime instanceTime; |
|
872 TCalTime inscaltime; |
|
873 |
|
874 instanceTime = CalenAgendaUtils::EntryTimeL( *entry ); |
|
875 inscaltime.SetTimeLocalL( instanceTime ); |
|
876 |
|
877 // set the context |
|
878 MCalenContext &context = iController.Services().Context(); |
|
879 TCalenInstanceId id = TCalenInstanceId::CreateL( *entry, inscaltime ); |
|
880 id.iColId = iMissedAlarmList[0].iColId; |
|
881 context.SetInstanceIdL( id, context.ViewId() ); |
|
882 |
|
883 CleanupStack::PopAndDestroy( entry ); |
|
884 |
|
885 TRACE_EXIT_POINT; |
|
886 } |
|
887 |
|
888 //--------------------------------------------------------- |
|
889 // CCalenViewManager::SetMissedAlarmEventAsViewed |
|
890 // Mark the missed alarm event as Viewed |
|
891 //--------------------------------------------------------- |
|
892 // |
|
893 void CCalenAlarmManager::SetMissedAlarmEventAsViewed() |
|
894 { |
|
895 TRACE_ENTRY_POINT; |
|
896 |
|
897 // get the context |
|
898 MCalenContext &context = iController.Services().Context(); |
|
899 TInt missedAlarmEntryUid = context.InstanceId().iEntryLocalUid; |
|
900 TCalCollectionId colid = context.InstanceId().iColId; |
|
901 |
|
902 for(TInt index = 0;index < iMissedAlarmList.Count();index++) |
|
903 { |
|
904 if((missedAlarmEntryUid == iMissedAlarmList[index].iEntryLocalUid ) && |
|
905 (colid == iMissedAlarmList[index].iColId)) |
|
906 { |
|
907 // mark the missed alarm event as viewed |
|
908 iMissedAlarmList[index].iInstanceViewed = 1; |
|
909 break; |
|
910 } |
|
911 } |
|
912 |
|
913 TRACE_EXIT_POINT; |
|
914 } |
|
915 |
|
916 //--------------------------------------------------------- |
|
917 // CCalenViewManager::RemoveAllViewedEventsL |
|
918 // Remove all viewed events |
|
919 //--------------------------------------------------------- |
|
920 // |
|
921 void CCalenAlarmManager::RemoveAllViewedEventsL() |
|
922 { |
|
923 TRACE_ENTRY_POINT; |
|
924 |
|
925 for(TInt index=0;index<iMissedAlarmList.Count();) |
|
926 { |
|
927 if(iMissedAlarmList[index].iInstanceViewed) |
|
928 { |
|
929 ClearOneMissedAlarmL( iMissedAlarmList[index].iEntryLocalUid, iMissedAlarmList[index].iColId ); |
|
930 iMissedAlarmList.Remove(index); |
|
931 } |
|
932 else |
|
933 { |
|
934 index++; |
|
935 } |
|
936 } |
|
937 |
|
938 TRACE_EXIT_POINT; |
|
939 } |
|
940 |
|
941 //--------------------------------------------------------- |
|
942 // CCalenViewManager::ClearOneMissedAlarmL |
|
943 // Clear one missed alarm |
|
944 //--------------------------------------------------------- |
|
945 // |
|
946 TBool CCalenAlarmManager::ClearOneMissedAlarmL( TInt aEntryLocalUid, TCalCollectionId aColid ) |
|
947 { |
|
948 TRACE_ENTRY_POINT; |
|
949 |
|
950 RPointerArray<CMissedAlarm> missedAlarmArray; |
|
951 CleanupResetAndDestroyPushL( missedAlarmArray ); |
|
952 iMissedAlarmStore->GetL(missedAlarmArray); |
|
953 TBool retValue = EFalse; |
|
954 for(TInt index = 0;index < missedAlarmArray.Count();index++) |
|
955 { |
|
956 if( aEntryLocalUid == missedAlarmArray[index]->iLuid ) |
|
957 { |
|
958 CCalSession &session = iController.Services().SessionL( missedAlarmArray[index]->iCalFileName ); |
|
959 TCalCollectionId colid = session.CollectionIdL(); |
|
960 if( colid == aColid) |
|
961 { |
|
962 // remove from cenrep |
|
963 iMissedAlarmStore->RemoveL(*missedAlarmArray[index]); |
|
964 retValue = ETrue; |
|
965 break; |
|
966 } |
|
967 } |
|
968 } |
|
969 |
|
970 CleanupStack::PopAndDestroy(); // aMissedAlarmArray |
|
971 TRACE_EXIT_POINT; |
|
972 return retValue; |
|
973 } |
|
974 |
|
975 //--------------------------------------------------------- |
|
976 // CCalenViewManager::UpdateMissedAlarmsListL |
|
977 // Update missed alarms list |
|
978 //--------------------------------------------------------- |
|
979 // |
|
980 void CCalenAlarmManager::UpdateMissedAlarmsListL() |
|
981 { |
|
982 TRACE_ENTRY_POINT; |
|
983 |
|
984 TUint32 newCount; |
|
985 // update the missed alarms count |
|
986 iMissedAlarmStore->CountL(newCount); |
|
987 |
|
988 // Need atleast one missed alarm to perform this |
|
989 if(newCount>0) |
|
990 { |
|
991 RPointerArray<CMissedAlarm> missedAlarmStorelist; |
|
992 CleanupResetAndDestroyPushL( missedAlarmStorelist ); |
|
993 TCalenInstanceId instanceId; |
|
994 TInt entryLocalUid; |
|
995 TTime instanceTime; |
|
996 |
|
997 iMissedAlarmStore->GetL(missedAlarmStorelist); |
|
998 |
|
999 //Retreiving the latest missed alarm array entry |
|
1000 CMissedAlarm* missedAlarm = missedAlarmStorelist[newCount-1]; |
|
1001 entryLocalUid = missedAlarm->iLuid; |
|
1002 instanceTime = missedAlarm->iInstanceTime; |
|
1003 |
|
1004 CCalSession &session = iController.Services().SessionL( missedAlarm->iCalFileName ); |
|
1005 // pack instance ids of the missed alarm instances |
|
1006 TRAP_IGNORE(instanceId = TCalenInstanceId::CreateL( entryLocalUid, |
|
1007 instanceTime, 0 )); |
|
1008 instanceId.iColId = session.CollectionIdL(); |
|
1009 iMissedAlarmList.Append(instanceId); |
|
1010 CleanupStack::PopAndDestroy(); // missedAlarmStorelist |
|
1011 |
|
1012 // if iMissedAlarmList count is greater than maximum missed alarms(10) |
|
1013 // remove the old missed alarm(index = 0) from the list |
|
1014 if(iMissedAlarmList.Count()>KMaxMissedAlarms) |
|
1015 { |
|
1016 iMissedAlarmList.Remove(0); |
|
1017 } |
|
1018 } |
|
1019 TRACE_EXIT_POINT; |
|
1020 } |
|
1021 |
|
1022 // ---------------------------------------------------------------------------- |
|
1023 // CCalenAlarmManager::UpdateMissedAlarmsListOnDeleteL |
|
1024 // For updating the missed alarms list when an entry is deleted |
|
1025 // ---------------------------------------------------------------------------- |
|
1026 void CCalenAlarmManager::UpdateMissedAlarmsListOnDeleteL() |
|
1027 { |
|
1028 TRACE_ENTRY_POINT; |
|
1029 // get the context |
|
1030 MCalenContext &context = iController.Services().Context(); |
|
1031 TInt deletedEntryUid = context.InstanceId().iEntryLocalUid; |
|
1032 TCalCollectionId colidFromContext = context.InstanceId().iColId; |
|
1033 |
|
1034 if( EFalse == ClearOneMissedAlarmL( deletedEntryUid, colidFromContext ) ) |
|
1035 { |
|
1036 TRACE_EXIT_POINT; |
|
1037 return; |
|
1038 } |
|
1039 for(TInt index = 0;index < iMissedAlarmList.Count();index++) |
|
1040 { |
|
1041 if( ( deletedEntryUid == iMissedAlarmList[index].iEntryLocalUid ) && ( colidFromContext == iMissedAlarmList[index].iColId ) ) |
|
1042 { |
|
1043 iMissedAlarmList.Remove(index); |
|
1044 if(!iMissedAlarmList.Count()) |
|
1045 { |
|
1046 iMissedAlarmList.Close(); |
|
1047 } |
|
1048 break; |
|
1049 } |
|
1050 } |
|
1051 TRACE_EXIT_POINT; |
|
1052 } |
|
1053 |
|
1054 // ---------------------------------------------------------------------------- |
|
1055 // CCalenAlarmManager::HandleSystemTimeChangedL |
|
1056 // For updating the missed alarms list/cenrep when time is changed |
|
1057 // ---------------------------------------------------------------------------- |
|
1058 void CCalenAlarmManager::HandleSystemTimeChangedL() |
|
1059 { |
|
1060 TRACE_ENTRY_POINT; |
|
1061 |
|
1062 TTime currentTime = CalenDateUtils::Now(); |
|
1063 TTime entryAlarmTime; |
|
1064 RArray<TCalLocalUid> foundlocalUids; |
|
1065 RArray<TCalCollectionId> foundColIds; |
|
1066 TCalLocalUid entryLocalUid; |
|
1067 |
|
1068 for(TInt i = 0;i<iMissedAlarmList.Count();i++) |
|
1069 { |
|
1070 entryLocalUid = iMissedAlarmList[i].iEntryLocalUid; |
|
1071 TCalCollectionId colid = iMissedAlarmList[i].iColId; |
|
1072 CCalEntry* entry = iController.Services().EntryViewL( colid )->FetchL(entryLocalUid); |
|
1073 User::LeaveIfNull( entry ); |
|
1074 CleanupStack::PushL( entry ); |
|
1075 |
|
1076 GetAlarmDateTimeL( *entry, entryAlarmTime ); |
|
1077 |
|
1078 // clear future alarm |
|
1079 if(entryAlarmTime>currentTime) |
|
1080 { |
|
1081 // clear missed alarm from cenrep |
|
1082 if( ClearOneMissedAlarmL(entryLocalUid, colid ) ) |
|
1083 { |
|
1084 foundlocalUids.Append(entryLocalUid); |
|
1085 foundColIds.Append(colid); |
|
1086 } |
|
1087 } |
|
1088 CleanupStack::PopAndDestroy( entry ); |
|
1089 } |
|
1090 |
|
1091 for(TInt index = 0;index<foundlocalUids.Count();index++) |
|
1092 { |
|
1093 for(TInt j=0;j<iMissedAlarmList.Count();j++) |
|
1094 { |
|
1095 if( foundlocalUids[index]==iMissedAlarmList[j].iEntryLocalUid && foundColIds[index] == iMissedAlarmList[j].iColId ) |
|
1096 { |
|
1097 // remove from local missed alarms list |
|
1098 iMissedAlarmList.Remove(j); |
|
1099 } |
|
1100 break; |
|
1101 } |
|
1102 } |
|
1103 foundlocalUids.Close(); |
|
1104 |
|
1105 // refresh the missed alarm view if it is current view |
|
1106 TUid currentViewId(iViewManager.CurrentView()); |
|
1107 if(currentViewId == KUidCalenMissedAlarmsView) |
|
1108 { |
|
1109 iViewManager.StartActiveStepL(); |
|
1110 } |
|
1111 |
|
1112 TRACE_EXIT_POINT; |
|
1113 } |
|
1114 |
|
1115 // ---------------------------------------------------------------------------- |
|
1116 // CCalenAlarmManager::GetAlarmDateTimeL |
|
1117 // Get the alarm time for the entry |
|
1118 // ---------------------------------------------------------------------------- |
|
1119 void CCalenAlarmManager::GetAlarmDateTimeL( const CCalEntry& aEntry, |
|
1120 TTime& aAlarmDateTime) |
|
1121 { |
|
1122 TRACE_ENTRY_POINT; |
|
1123 |
|
1124 // FIXME: leaving! |
|
1125 CCalAlarm* alarm = aEntry.AlarmL(); |
|
1126 CleanupStack::PushL( alarm ); |
|
1127 |
|
1128 switch( aEntry.EntryTypeL() ) |
|
1129 { |
|
1130 case CCalEntry::ETodo: |
|
1131 aAlarmDateTime = aEntry.EndTimeL().TimeLocalL(); |
|
1132 break; |
|
1133 |
|
1134 case CCalEntry::EAppt: |
|
1135 case CCalEntry::EEvent: |
|
1136 case CCalEntry::EAnniv: |
|
1137 default: |
|
1138 aAlarmDateTime = aEntry.StartTimeL().TimeLocalL(); |
|
1139 break; |
|
1140 } |
|
1141 aAlarmDateTime -= alarm->TimeOffset(); |
|
1142 |
|
1143 CleanupStack::PopAndDestroy( alarm ); |
|
1144 |
|
1145 TRACE_EXIT_POINT; |
|
1146 } |
|
1147 |
|
1148 // ---------------------------------------------------------------------------- |
|
1149 // CCalenAlarmManager::LaunchEventViewerL |
|
1150 // Rest of the detail are commented in header. |
|
1151 // ---------------------------------------------------------------------------- |
|
1152 void CCalenAlarmManager::LaunchEventViewerL() |
|
1153 { |
|
1154 TRACE_ENTRY_POINT; |
|
1155 |
|
1156 // launching Event View from alarm |
|
1157 StartAlarmContextListenerL(); |
|
1158 |
|
1159 if(iController.IsFasterAppFlagEnabled()) |
|
1160 { |
|
1161 iViewerLaunchedFromIdle = ETrue; |
|
1162 iController.SetFasterAppFlag( EFalse ); |
|
1163 } |
|
1164 else |
|
1165 { |
|
1166 iPreviousToEventViewUid = iViewManager.CurrentView(); |
|
1167 if(iPreviousToEventViewUid == KUidCalenEventView || |
|
1168 iPreviousToEventViewUid == KUidCalenMissedEventView ) |
|
1169 { |
|
1170 iPreviousToEventViewUid = iViewManager.GetPreviousViewUid(); |
|
1171 } |
|
1172 iController.SetExitOnDialogFlag( EFalse ); |
|
1173 } |
|
1174 |
|
1175 TRACE_EXIT_POINT; |
|
1176 } |
|
1177 |
|
1178 // ---------------------------------------------------------------------------- |
|
1179 // CCalenAlarmManager::HandleBackEventL |
|
1180 // Rest of the detail are commented in header. |
|
1181 // ---------------------------------------------------------------------------- |
|
1182 void CCalenAlarmManager::HandleBackEventL() |
|
1183 { |
|
1184 TRACE_ENTRY_POINT; |
|
1185 |
|
1186 MCalenToolbar* toolbarImpl = iController.ViewManager().ToolbarOrNull(); |
|
1187 if(toolbarImpl) // If toolbar exists |
|
1188 { |
|
1189 CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
1190 |
|
1191 // Remove the viewer toolbar buttons |
|
1192 toolbar.RemoveItem(ECalenDeleteCurrentEntry); // Delete button |
|
1193 toolbar.RemoveItem(ECalenEditCurrentEntry); // Edit button |
|
1194 toolbar.RemoveItem(ECalenSend); // Send button |
|
1195 } |
|
1196 if( iViewerLaunchedFromIdle ) |
|
1197 { |
|
1198 iController.AppUi().ProcessCommandL(EAknSoftkeyExit); |
|
1199 iViewerLaunchedFromIdle = EFalse; |
|
1200 } |
|
1201 else if( iPreviousToEventViewUid!=KNullUid && |
|
1202 ( iPreviousToEventViewUid!= KUidCalenEventView || iPreviousToEventViewUid != KUidCalenMissedEventView ) ) |
|
1203 { |
|
1204 iViewManager.SetRepopulation(EFalse); |
|
1205 TVwsViewId previousViewId(KUidCalendar, iPreviousToEventViewUid) ; |
|
1206 iController.ViewManager().RequestActivationL(previousViewId); |
|
1207 iPreviousToEventViewUid = KNullUid; |
|
1208 iViewManager.SetRepopulation(ETrue); |
|
1209 } |
|
1210 else |
|
1211 { |
|
1212 |
|
1213 } |
|
1214 |
|
1215 TRACE_EXIT_POINT; |
|
1216 } |
|
1217 |
|
1218 // End of file |