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