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