|
1 /* |
|
2 * Copyright (c) 2007 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 state machine |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // includes |
|
21 #include "calenpopulationstate.h" |
|
22 #include "calendarui_debug.h" // Debug macros |
|
23 #include "calencontroller.h" |
|
24 #include "calenstatemachine.h" |
|
25 #include "calennotifier.h" |
|
26 |
|
27 // ---------------------------------------------------------------------------- |
|
28 // CCalenPopulationState::NewLC |
|
29 // First stage construction |
|
30 // ---------------------------------------------------------------------------- |
|
31 CCalenPopulationState* CCalenPopulationState::NewLC( CCalenController& aController, |
|
32 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
|
33 { |
|
34 TRACE_ENTRY_POINT; |
|
35 |
|
36 CCalenPopulationState* self = new( ELeave ) CCalenPopulationState( aController, aOutstandingNotifications ); |
|
37 CleanupStack::PushL( self ); |
|
38 self->ConstructL(); |
|
39 |
|
40 TRACE_EXIT_POINT; |
|
41 return self; |
|
42 } |
|
43 |
|
44 // ---------------------------------------------------------------------------- |
|
45 // CCalenPopulationState::ConstructL |
|
46 // Second stage construction |
|
47 // ---------------------------------------------------------------------------- |
|
48 void CCalenPopulationState::ConstructL() |
|
49 { |
|
50 TRACE_ENTRY_POINT; |
|
51 BaseConstructL(); |
|
52 |
|
53 TRACE_EXIT_POINT; |
|
54 } |
|
55 |
|
56 // ---------------------------------------------------------------------------- |
|
57 // CCalenPopulationState::CCalenPopulationState |
|
58 // C++ Constructor |
|
59 // ---------------------------------------------------------------------------- |
|
60 CCalenPopulationState::CCalenPopulationState( CCalenController& aController, |
|
61 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
|
62 : CCalenState( aController, aOutstandingNotifications ) |
|
63 { |
|
64 TRACE_ENTRY_POINT; |
|
65 |
|
66 TRACE_EXIT_POINT; |
|
67 } |
|
68 |
|
69 // ---------------------------------------------------------------------------- |
|
70 // CCalenPopulationState::CCalenPopulationState |
|
71 // Destructor |
|
72 // ---------------------------------------------------------------------------- |
|
73 CCalenPopulationState::~CCalenPopulationState() |
|
74 { |
|
75 TRACE_ENTRY_POINT; |
|
76 |
|
77 TRACE_EXIT_POINT; |
|
78 } |
|
79 |
|
80 // ---------------------------------------------------------------------------- |
|
81 // CCalenPopulationState::HandleCommandL |
|
82 // From CCalenState |
|
83 // ---------------------------------------------------------------------------- |
|
84 TBool CCalenPopulationState::HandleCommandL( const TCalenCommand& aCommand, |
|
85 CCalenStateMachine& aStateMachine ) |
|
86 { |
|
87 TRACE_ENTRY_POINT; |
|
88 TInt cmd = aCommand.Command(); |
|
89 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
|
90 |
|
91 ASSERT( handler ); // FIXME: error ui |
|
92 |
|
93 TBool cmdUsed = EFalse; |
|
94 |
|
95 if( ECalenFasterAppExit == cmd ) |
|
96 { |
|
97 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenIdleState ); |
|
98 ActivateCurrentStateL(aStateMachine); |
|
99 RequestCallbackL( handler, aCommand ); |
|
100 cmdUsed = ETrue; |
|
101 } |
|
102 |
|
103 TRACE_EXIT_POINT; |
|
104 return cmdUsed; |
|
105 } |
|
106 |
|
107 // ---------------------------------------------------------------------------- |
|
108 // CCalenPopulationState::HandleNotificationL |
|
109 // From CCalenState |
|
110 // ---------------------------------------------------------------------------- |
|
111 void CCalenPopulationState::HandleNotificationL(const TCalenNotification& aNotification, |
|
112 CCalenStateMachine& aStateMachine ) |
|
113 { |
|
114 TRACE_ENTRY_POINT; |
|
115 |
|
116 switch ( aNotification ) |
|
117 { |
|
118 case ECalenNotifyViewPopulationComplete: |
|
119 { |
|
120 SetCurrentState( aStateMachine, iPreviousState ); |
|
121 // don't set us as the previous state for the state we're moving back to. |
|
122 iOutstandingNotifications.InsertL(aNotification); |
|
123 ActivateCurrentStateL(aStateMachine); |
|
124 } |
|
125 break; |
|
126 default: |
|
127 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
|
128 break; |
|
129 } |
|
130 |
|
131 TRACE_EXIT_POINT; |
|
132 } |
|
133 |
|
134 |
|
135 // end of file |