20 #include "calenviewingstate.h" |
20 #include "calenviewingstate.h" |
21 #include "calendarui_debug.h" // Debug macros |
21 #include "calendarui_debug.h" // Debug macros |
22 #include "calencontroller.h" |
22 #include "calencontroller.h" |
23 #include "calenstatemachine.h" |
23 #include "calenstatemachine.h" |
24 #include "calennotifier.h" |
24 #include "calennotifier.h" |
25 #include "OstTraceDefinitions.h" |
|
26 #ifdef OST_TRACE_COMPILER_IN_USE |
|
27 #include "calenviewingstateTraces.h" |
|
28 #endif |
|
29 |
25 |
30 // ---------------------------------------------------------------------------- |
26 // ---------------------------------------------------------------------------- |
31 // CCalenViewingState::NewLC |
27 // CCalenViewingState::NewLC |
32 // First stage construction |
28 // First stage construction |
33 // ---------------------------------------------------------------------------- |
29 // ---------------------------------------------------------------------------- |
34 CCalenViewingState* CCalenViewingState::NewLC( CCalenController& aController, |
30 CCalenViewingState* CCalenViewingState::NewLC( CCalenController& aController, |
35 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
31 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
36 { |
32 { |
37 OstTraceFunctionEntry0( CCALENVIEWINGSTATE_NEWLC_ENTRY ); |
33 TRACE_ENTRY_POINT; |
38 |
34 |
39 CCalenViewingState* self = new ( ELeave ) CCalenViewingState( aController,aOutstandingNotifications ); |
35 CCalenViewingState* self = new ( ELeave ) CCalenViewingState( aController,aOutstandingNotifications ); |
40 CleanupStack::PushL( self ); |
36 CleanupStack::PushL( self ); |
41 self->ConstructL(); |
37 self->ConstructL(); |
42 |
38 |
43 OstTraceFunctionExit0( CCALENVIEWINGSTATE_NEWLC_EXIT ); |
39 TRACE_EXIT_POINT; |
44 return self; |
40 return self; |
45 } |
41 } |
46 |
42 |
47 // ---------------------------------------------------------------------------- |
43 // ---------------------------------------------------------------------------- |
48 // CCalenViewingState::ConstructL |
44 // CCalenViewingState::ConstructL |
49 // Second stage construction |
45 // Second stage construction |
50 // ---------------------------------------------------------------------------- |
46 // ---------------------------------------------------------------------------- |
51 void CCalenViewingState::ConstructL() |
47 void CCalenViewingState::ConstructL() |
52 { |
48 { |
53 OstTraceFunctionEntry0( CCALENVIEWINGSTATE_CONSTRUCTL_ENTRY ); |
49 TRACE_ENTRY_POINT; |
54 |
|
55 BaseConstructL(); |
50 BaseConstructL(); |
56 |
51 |
57 OstTraceFunctionExit0( CCALENVIEWINGSTATE_CONSTRUCTL_EXIT ); |
52 TRACE_EXIT_POINT; |
58 } |
53 } |
59 |
54 |
60 // ---------------------------------------------------------------------------- |
55 // ---------------------------------------------------------------------------- |
61 // CCalenIdleState::CCalenIdleState |
56 // CCalenIdleState::CCalenIdleState |
62 // C++ Constructor |
57 // C++ Constructor |
63 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
64 CCalenViewingState::CCalenViewingState( CCalenController& aController, |
59 CCalenViewingState::CCalenViewingState( CCalenController& aController, |
65 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
60 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
66 : CCalenState( aController, aOutstandingNotifications ) |
61 : CCalenState( aController, aOutstandingNotifications ) |
67 { |
62 { |
68 OstTraceFunctionEntry0( CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_ENTRY ); |
63 TRACE_ENTRY_POINT; |
69 |
64 |
70 OstTraceFunctionExit0( CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_EXIT ); |
65 TRACE_EXIT_POINT; |
71 } |
66 } |
72 |
67 |
73 // ---------------------------------------------------------------------------- |
68 // ---------------------------------------------------------------------------- |
74 // CCalenViewingState::CCalenViewingState |
69 // CCalenViewingState::CCalenViewingState |
75 // Destructor |
70 // Destructor |
76 // ---------------------------------------------------------------------------- |
71 // ---------------------------------------------------------------------------- |
77 CCalenViewingState::~CCalenViewingState() |
72 CCalenViewingState::~CCalenViewingState() |
78 { |
73 { |
79 OstTraceFunctionEntry0( DUP1_CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_ENTRY ); |
74 TRACE_ENTRY_POINT; |
80 |
75 |
81 OstTraceFunctionExit0( DUP1_CCALENVIEWINGSTATE_CCALENVIEWINGSTATE_EXIT ); |
76 TRACE_EXIT_POINT; |
82 } |
77 } |
83 |
78 |
84 // ---------------------------------------------------------------------------- |
79 // ---------------------------------------------------------------------------- |
85 // CCalenViewingState::HandleCommandL |
80 // CCalenViewingState::HandleCommandL |
86 // From CCalenState |
81 // From CCalenState |
87 // ---------------------------------------------------------------------------- |
82 // ---------------------------------------------------------------------------- |
88 TBool CCalenViewingState::HandleCommandL( const TCalenCommand& aCommand, |
83 TBool CCalenViewingState::HandleCommandL( const TCalenCommand& aCommand, |
89 CCalenStateMachine& aStateMachine ) |
84 CCalenStateMachine& aStateMachine ) |
90 { |
85 { |
91 OstTraceFunctionEntry0( CCALENVIEWINGSTATE_HANDLECOMMANDL_ENTRY ); |
86 TRACE_ENTRY_POINT; |
92 |
87 |
93 TInt cmd = aCommand.Command(); |
88 TInt cmd = aCommand.Command(); |
94 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
89 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
95 |
90 |
96 ASSERT( handler ); // FIXME: error ui |
91 ASSERT( handler ); // FIXME: error ui |
102 case ECalenEditCurrentEntry: |
97 case ECalenEditCurrentEntry: |
103 case ECalenEditOccurrence: |
98 case ECalenEditOccurrence: |
104 case ECalenEditSeries: |
99 case ECalenEditSeries: |
105 case ECalenRestoreTodo: |
100 case ECalenRestoreTodo: |
106 case ECalenCompleteTodo: |
101 case ECalenCompleteTodo: |
107 case ECalenEditEntryFromViewer: |
|
108 { |
102 { |
109 // set the previous state as viewing state |
103 // set the previous state as viewing state |
110 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
104 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
111 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenEditingState); |
105 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenEditingState); |
112 SetCurrentPreviousState( aStateMachine, cachedState ); |
106 SetCurrentPreviousState( aStateMachine, cachedState ); |
145 } |
138 } |
146 break; |
139 break; |
147 case ECalenGetLocation: |
140 case ECalenGetLocation: |
148 case ECalenShowLocation: |
141 case ECalenShowLocation: |
149 case ECalenGetLocationAndSave: |
142 case ECalenGetLocationAndSave: |
150 { |
143 { |
|
144 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
|
145 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenMapState ); |
|
146 SetCurrentPreviousState( aStateMachine, cachedState ); |
|
147 ActivateCurrentStateL(aStateMachine); |
|
148 |
|
149 cmdUsed = ETrue; |
|
150 break; |
151 } |
151 } |
|
152 case ECalenViewAttachmentList: |
|
153 case ECalenAddAttachmentFromViewer: |
|
154 { |
|
155 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
|
156 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenAttachmentState ); |
|
157 SetCurrentPreviousState( aStateMachine, cachedState ); |
|
158 ActivateCurrentStateL(aStateMachine); |
|
159 cmdUsed = ETrue; |
|
160 } |
|
161 break; |
152 } |
162 } |
153 RequestCallbackL( handler, aCommand ); |
163 RequestCallbackL( handler, aCommand ); |
154 |
164 |
155 OstTraceFunctionExit0( CCALENVIEWINGSTATE_HANDLECOMMANDL_EXIT ); |
165 TRACE_EXIT_POINT; |
156 return cmdUsed; |
166 return cmdUsed; |
157 } |
167 } |
158 |
168 |
159 // ---------------------------------------------------------------------------- |
169 // ---------------------------------------------------------------------------- |
160 // CCalenViewingState::HandleNotificationL |
170 // CCalenViewingState::HandleNotificationL |
161 // From CCalenState |
171 // From CCalenState |
162 // ---------------------------------------------------------------------------- |
172 // ---------------------------------------------------------------------------- |
163 void CCalenViewingState::HandleNotificationL(const TCalenNotification& aNotification, |
173 void CCalenViewingState::HandleNotificationL(const TCalenNotification& aNotification, |
164 CCalenStateMachine& aStateMachine ) |
174 CCalenStateMachine& aStateMachine ) |
165 { |
175 { |
166 OstTraceFunctionEntry0( CCALENVIEWINGSTATE_HANDLENOTIFICATIONL_ENTRY ); |
176 TRACE_ENTRY_POINT; |
167 |
177 |
168 switch( aNotification ) |
178 switch( aNotification ) |
169 { |
179 { |
170 case ECalenNotifyEntryClosed: |
180 case ECalenNotifyEntryClosed: |
171 { |
181 { |
172 SetCurrentState( aStateMachine, iPreviousState ); |
182 SetCurrentState( aStateMachine, iPreviousState ); |
185 default: |
195 default: |
186 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
196 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
187 break; |
197 break; |
188 } |
198 } |
189 |
199 |
190 OstTraceFunctionExit0( CCALENVIEWINGSTATE_HANDLENOTIFICATIONL_EXIT ); |
200 TRACE_EXIT_POINT; |
191 } |
201 } |
192 |
202 |
193 // ---------------------------------------------------------------------------- |
203 // ---------------------------------------------------------------------------- |
194 // CCalenViewingState::HandleStateActivationL |
204 // CCalenViewingState::HandleStateActivationL |
195 // Behavior when state is activated. |
205 // Behavior when state is activated. |
196 // ---------------------------------------------------------------------------- |
206 // ---------------------------------------------------------------------------- |
197 void CCalenViewingState::HandleStateActivationL(CCalenStateMachine& aStateMachine) |
207 void CCalenViewingState::HandleStateActivationL(CCalenStateMachine& aStateMachine) |
198 { |
208 { |
199 OstTraceFunctionEntry0( CCALENVIEWINGSTATE_HANDLESTATEACTIVATIONL_ENTRY ); |
209 TRACE_ENTRY_POINT; |
200 |
210 |
201 if( iOutstandingNotifications.Find(ECalenNotifyEntryDeleted) ) |
211 if( iOutstandingNotifications.Find(ECalenNotifyEntryDeleted) ) |
202 { |
212 { |
203 SetCurrentState( aStateMachine, iPreviousState ); |
213 SetCurrentState( aStateMachine, iPreviousState ); |
204 ActivateCurrentStateL(aStateMachine); |
214 ActivateCurrentStateL(aStateMachine); |
205 } |
215 } |
206 else |
216 else |
207 { |
217 { |
208 CCalenState::HandleStateActivationL(aStateMachine); |
218 CCalenState::HandleStateActivationL(aStateMachine); |
209 } |
219 } |
210 |
220 TRACE_EXIT_POINT; |
211 OstTraceFunctionExit0( CCALENVIEWINGSTATE_HANDLESTATEACTIVATIONL_EXIT ); |
|
212 } |
221 } |
213 |
222 |
214 // end of file |
223 // end of file |