20 #include "calenidlestate.h" |
20 #include "calenidlestate.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 |
25 #include "OstTraceDefinitions.h" |
26 // ---------------------------------------------------------------------------- |
26 #ifdef OST_TRACE_COMPILER_IN_USE |
27 // CCalenIdleState::NewLC |
27 #include "calenidlestateTraces.h" |
|
28 #endif |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // CalenIdleState::NewLC |
28 // First stage construction |
32 // First stage construction |
29 // ---------------------------------------------------------------------------- |
33 // ---------------------------------------------------------------------------- |
30 CCalenIdleState* CCalenIdleState::NewLC( CCalenController& aController, |
34 CCalenIdleState* CCalenIdleState::NewLC( CCalenController& aController, |
31 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
35 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
32 { |
36 { |
33 TRACE_ENTRY_POINT; |
37 OstTraceFunctionEntry0( CCALENIDLESTATE_NEWLC_ENTRY ); |
34 |
38 |
35 CCalenIdleState* self = new ( ELeave ) CCalenIdleState( aController, |
39 CCalenIdleState* self = new ( ELeave ) CCalenIdleState( aController, |
36 aOutstandingNotifications ); |
40 aOutstandingNotifications ); |
37 CleanupStack::PushL( self ); |
41 CleanupStack::PushL( self ); |
38 self->ConstructL(); |
42 self->ConstructL(); |
39 |
43 |
40 TRACE_EXIT_POINT; |
44 OstTraceFunctionExit0( CCALENIDLESTATE_NEWLC_EXIT ); |
41 return self; |
45 return self; |
42 } |
46 } |
43 |
47 |
44 // ---------------------------------------------------------------------------- |
48 // ---------------------------------------------------------------------------- |
45 // CCalenIdleState::ConstructL |
49 // CCalenIdleState::ConstructL |
46 // Second stage construction |
50 // Second stage construction |
47 // ---------------------------------------------------------------------------- |
51 // ---------------------------------------------------------------------------- |
48 void CCalenIdleState::ConstructL() |
52 void CCalenIdleState::ConstructL() |
49 { |
53 { |
50 TRACE_ENTRY_POINT; |
54 OstTraceFunctionEntry0( CCALENIDLESTATE_CONSTRUCTL_ENTRY ); |
|
55 |
51 BaseConstructL(); |
56 BaseConstructL(); |
52 |
57 |
53 TRACE_EXIT_POINT; |
58 OstTraceFunctionExit0( CCALENIDLESTATE_CONSTRUCTL_EXIT ); |
54 } |
59 } |
55 |
60 |
56 // ---------------------------------------------------------------------------- |
61 // ---------------------------------------------------------------------------- |
57 // CCalenIdleState::CCalenIdleState |
62 // CCalenIdleState::CCalenIdleState |
58 // C++ Constructor |
63 // C++ Constructor |
59 // ---------------------------------------------------------------------------- |
64 // ---------------------------------------------------------------------------- |
60 CCalenIdleState::CCalenIdleState( CCalenController& aController, |
65 CCalenIdleState::CCalenIdleState( CCalenController& aController, |
61 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
66 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
62 : CCalenState( aController, aOutstandingNotifications ) |
67 : CCalenState( aController, aOutstandingNotifications ) |
63 { |
68 { |
64 TRACE_ENTRY_POINT; |
69 OstTraceFunctionEntry0( CCALENIDLESTATE_CCALENIDLESTATE_ENTRY ); |
65 |
70 |
66 TRACE_EXIT_POINT; |
71 OstTraceFunctionExit0( CCALENIDLESTATE_CCALENIDLESTATE_EXIT ); |
67 } |
72 } |
68 |
73 |
69 // ---------------------------------------------------------------------------- |
74 // ---------------------------------------------------------------------------- |
70 // CCalenIdleState::CCalenIdleState |
75 // CCalenIdleState::CCalenIdleState |
71 // Destructor |
76 // Destructor |
72 // ---------------------------------------------------------------------------- |
77 // ---------------------------------------------------------------------------- |
73 CCalenIdleState::~CCalenIdleState() |
78 CCalenIdleState::~CCalenIdleState() |
74 { |
79 { |
75 TRACE_ENTRY_POINT; |
80 OstTraceFunctionEntry0( DUP1_CCALENIDLESTATE_CCALENIDLESTATE_ENTRY ); |
76 |
81 |
77 TRACE_EXIT_POINT; |
82 OstTraceFunctionExit0( DUP1_CCALENIDLESTATE_CCALENIDLESTATE_EXIT ); |
78 } |
83 } |
79 |
84 |
80 // ---------------------------------------------------------------------------- |
85 // ---------------------------------------------------------------------------- |
81 // CCalenIdleState::HandleCommandL |
86 // CCalenIdleState::HandleCommandL |
82 // From CCalenState |
87 // From CCalenState |
83 // ---------------------------------------------------------------------------- |
88 // ---------------------------------------------------------------------------- |
84 TBool CCalenIdleState::HandleCommandL( const TCalenCommand& aCommand, |
89 TBool CCalenIdleState::HandleCommandL( const TCalenCommand& aCommand, |
85 CCalenStateMachine& aStateMachine ) |
90 CCalenStateMachine& aStateMachine ) |
86 { |
91 { |
87 TRACE_ENTRY_POINT; |
92 OstTraceFunctionEntry0( CCALENIDLESTATE_HANDLECOMMANDL_ENTRY ); |
88 |
93 |
89 TInt cmd = aCommand.Command(); |
94 TInt cmd = aCommand.Command(); |
90 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
95 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
91 |
96 |
92 ASSERT( handler ); // FIXME: error ui |
97 ASSERT( handler ); // FIXME: error ui |
94 TBool cmdUsed = EFalse; |
99 TBool cmdUsed = EFalse; |
95 |
100 |
96 switch( cmd ) |
101 switch( cmd ) |
97 { |
102 { |
98 case ECalenMonthView: |
103 case ECalenMonthView: |
99 case ECalenWeekView: |
|
100 case ECalenDayView: |
104 case ECalenDayView: |
101 case ECalenTodoView: |
105 case ECalenAgendaView: |
|
106 case ECalenStartActiveStep: |
|
107 { |
|
108 // set previous state to idle |
|
109 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
|
110 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenPopulationState ); |
|
111 SetCurrentPreviousState( aStateMachine, cachedState ); |
|
112 ActivateCurrentStateL(aStateMachine); |
|
113 cmdUsed = ETrue; |
|
114 } |
|
115 break; |
|
116 case ECalenTodoEditor: |
|
117 case ECalenTodoEditorDone: |
102 case ECalenForwardsToDayView: |
118 case ECalenForwardsToDayView: |
103 case ECalenForwardsToWeekView: |
|
104 case ECalenNextView: |
119 case ECalenNextView: |
105 case ECalenPrevView: |
120 case ECalenPrevView: |
106 case ECalenSwitchView: |
121 case ECalenSwitchView: |
107 case ECalenHidePreview: |
122 case ECalenHidePreview: |
108 case ECalenShowPreview: |
123 case ECalenShowPreview: |
205 } |
211 } |
206 break; |
212 break; |
207 case ECalenGetLocation: |
213 case ECalenGetLocation: |
208 case ECalenShowLocation: |
214 case ECalenShowLocation: |
209 case ECalenGetLocationAndSave: |
215 case ECalenGetLocationAndSave: |
210 { |
216 { |
211 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
217 } |
212 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenMapState ); |
|
213 SetCurrentPreviousState( aStateMachine, cachedState ); |
|
214 ActivateCurrentStateL(aStateMachine); |
|
215 cmdUsed = ETrue; |
|
216 } |
|
217 break; |
|
218 case ECalenEventViewFromAlarm: |
|
219 case ECalenEventViewFromAlarmStopOnly: |
|
220 { |
|
221 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
|
222 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenAlarmState); |
|
223 SetCurrentPreviousState( aStateMachine, cachedState ); |
|
224 ActivateCurrentStateL(aStateMachine); |
|
225 cmdUsed = ETrue; |
|
226 } |
|
227 break; |
|
228 case ECalenAddAttachment: |
|
229 case ECalenRemoveAttachment: |
|
230 case ECalenViewAttachmentList: |
|
231 { |
|
232 CCalenStateMachine::TCalenStateIndex cachedState = GetCurrentState(aStateMachine); |
|
233 SetCurrentState( aStateMachine, CCalenStateMachine::ECalenAttachmentState ); |
|
234 SetCurrentPreviousState( aStateMachine, cachedState ); |
|
235 ActivateCurrentStateL(aStateMachine); |
|
236 cmdUsed = ETrue; |
|
237 } |
|
238 break; |
|
239 default: |
218 default: |
240 // This a valid custom command as there is a command handler |
219 // This a valid custom command as there is a command handler |
241 // do not modify the new start and remain in idle. |
220 // do not modify the new start and remain in idle. |
242 // remain in idle |
221 // remain in idle |
243 // don't modify aNewState. |
222 // don't modify aNewState. |
244 break; |
223 break; |
245 } |
224 } |
246 |
225 |
247 RequestCallbackL( handler, aCommand ); |
226 RequestCallbackL( handler, aCommand ); |
248 |
227 |
249 TRACE_EXIT_POINT; |
228 OstTraceFunctionExit0( CCALENIDLESTATE_HANDLECOMMANDL_EXIT ); |
250 return cmdUsed; |
229 return cmdUsed; |
251 } |
230 } |
252 |
231 |
253 // ---------------------------------------------------------------------------- |
232 // ---------------------------------------------------------------------------- |
254 // CCalenIdleState::HandleNotificationL |
233 // CCalenIdleState::HandleNotificationL |
255 // From CCalenState |
234 // From CCalenState |
256 // ---------------------------------------------------------------------------- |
235 // ---------------------------------------------------------------------------- |
257 void CCalenIdleState::HandleNotificationL(const TCalenNotification& aNotification, |
236 void CCalenIdleState::HandleNotificationL(const TCalenNotification& aNotification, |
258 CCalenStateMachine& aStateMachine) |
237 CCalenStateMachine& aStateMachine) |
259 { |
238 { |
260 TRACE_ENTRY_POINT; |
239 OstTraceFunctionEntry0( CCALENIDLESTATE_HANDLENOTIFICATIONL_ENTRY ); |
261 |
240 |
262 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
241 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
263 |
242 |
264 TRACE_EXIT_POINT; |
243 OstTraceFunctionExit0( CCALENIDLESTATE_HANDLENOTIFICATIONL_EXIT ); |
265 } |
244 } |
266 |
245 |
267 // end of file |
246 // end of file |
268 |
247 |