15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 // includes |
19 // includes |
20 #include <calentoolbar.h> |
|
21 |
|
22 #include "calensettingsstate.h" |
20 #include "calensettingsstate.h" |
23 #include "calendarui_debug.h" // Debug macros |
21 #include "calendarui_debug.h" // Debug macros |
24 #include "calencontroller.h" |
22 #include "calencontroller.h" |
25 #include "calenstatemachine.h" |
23 #include "calenstatemachine.h" |
26 #include "calennotifier.h" |
24 #include "calennotifier.h" |
27 #include "calenviewmanager.h" |
25 #include "calenviewmanager.h" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #ifdef OST_TRACE_COMPILER_IN_USE |
|
28 #include "calensettingsstateTraces.h" |
|
29 #endif |
28 |
30 |
29 // ---------------------------------------------------------------------------- |
31 // ---------------------------------------------------------------------------- |
30 // CCalenSettingsState::NewLC |
32 // CCalenSettingsState::NewLC |
31 // First stage construction |
33 // First stage construction |
32 // ---------------------------------------------------------------------------- |
34 // ---------------------------------------------------------------------------- |
33 CCalenSettingsState* CCalenSettingsState::NewLC( CCalenController& aController, |
35 CCalenSettingsState* CCalenSettingsState::NewLC( CCalenController& aController, |
34 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
36 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
35 { |
37 { |
36 TRACE_ENTRY_POINT; |
38 OstTraceFunctionEntry0( CCALENSETTINGSSTATE_NEWLC_ENTRY ); |
37 |
39 |
38 CCalenSettingsState* self = new ( ELeave ) CCalenSettingsState( aController, |
40 CCalenSettingsState* self = new ( ELeave ) CCalenSettingsState( aController, |
39 aOutstandingNotifications ); |
41 aOutstandingNotifications ); |
40 CleanupStack::PushL( self ); |
42 CleanupStack::PushL( self ); |
41 self->ConstructL(); |
43 self->ConstructL(); |
42 |
44 |
43 TRACE_EXIT_POINT; |
45 OstTraceFunctionExit0( CCALENSETTINGSSTATE_NEWLC_EXIT ); |
44 return self; |
46 return self; |
45 } |
47 } |
46 |
48 |
47 // ---------------------------------------------------------------------------- |
49 // ---------------------------------------------------------------------------- |
48 // CCalenSettingsState::ConstructL |
50 // CCalenSettingsState::ConstructL |
49 // Second stage construction |
51 // Second stage construction |
50 // ---------------------------------------------------------------------------- |
52 // ---------------------------------------------------------------------------- |
51 void CCalenSettingsState::ConstructL() |
53 void CCalenSettingsState::ConstructL() |
52 { |
54 { |
53 TRACE_ENTRY_POINT; |
55 OstTraceFunctionEntry0( CCALENSETTINGSSTATE_CONSTRUCTL_ENTRY ); |
|
56 |
54 BaseConstructL(); |
57 BaseConstructL(); |
55 |
58 |
56 TRACE_EXIT_POINT; |
59 OstTraceFunctionExit0( CCALENSETTINGSSTATE_CONSTRUCTL_EXIT ); |
57 } |
60 } |
58 |
61 |
59 // ---------------------------------------------------------------------------- |
62 // ---------------------------------------------------------------------------- |
60 // CCalenSettingsState::CCalenSettingsState |
63 // CCalenSettingsState::CCalenSettingsState |
61 // C++ Constructor |
64 // C++ Constructor |
62 // ---------------------------------------------------------------------------- |
65 // ---------------------------------------------------------------------------- |
63 CCalenSettingsState::CCalenSettingsState( CCalenController& aController, |
66 CCalenSettingsState::CCalenSettingsState( CCalenController& aController, |
64 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
67 RHashSet<TCalenNotification>& aOutstandingNotifications ) |
65 : CCalenState( aController, aOutstandingNotifications ) |
68 : CCalenState( aController, aOutstandingNotifications ) |
66 { |
69 { |
67 TRACE_ENTRY_POINT; |
70 OstTraceFunctionEntry0( CCALENSETTINGSSTATE_CCALENSETTINGSSTATE_ENTRY ); |
68 |
71 |
69 TRACE_EXIT_POINT; |
72 OstTraceFunctionExit0( CCALENSETTINGSSTATE_CCALENSETTINGSSTATE_EXIT ); |
70 } |
73 } |
71 |
74 |
72 // ---------------------------------------------------------------------------- |
75 // ---------------------------------------------------------------------------- |
73 // CCalenSettingsState::CCalenSettingsState |
76 // CCalenSettingsState::CCalenSettingsState |
74 // Destructor |
77 // Destructor |
75 // ---------------------------------------------------------------------------- |
78 // ---------------------------------------------------------------------------- |
76 CCalenSettingsState::~CCalenSettingsState() |
79 CCalenSettingsState::~CCalenSettingsState() |
77 { |
80 { |
78 TRACE_ENTRY_POINT; |
81 OstTraceFunctionEntry0( DUP1_CCALENSETTINGSSTATE_CCALENSETTINGSSTATE_ENTRY ); |
79 |
82 |
80 TRACE_EXIT_POINT; |
83 OstTraceFunctionExit0( DUP1_CCALENSETTINGSSTATE_CCALENSETTINGSSTATE_EXIT ); |
81 } |
84 } |
82 |
85 |
83 // ---------------------------------------------------------------------------- |
86 // ---------------------------------------------------------------------------- |
84 // CCalenSettingsState::HandleCommandL |
87 // CCalenSettingsState::HandleCommandL |
85 // From CCalenState |
88 // From CCalenState |
86 // ---------------------------------------------------------------------------- |
89 // ---------------------------------------------------------------------------- |
87 TBool CCalenSettingsState::HandleCommandL( const TCalenCommand& aCommand, |
90 TBool CCalenSettingsState::HandleCommandL( const TCalenCommand& aCommand, |
88 CCalenStateMachine& aStateMachine ) |
91 CCalenStateMachine& aStateMachine ) |
89 { |
92 { |
90 TRACE_ENTRY_POINT; |
93 OstTraceFunctionEntry0( CCALENSETTINGSSTATE_HANDLECOMMANDL_ENTRY ); |
91 |
94 |
92 TInt cmd = aCommand.Command(); |
95 TInt cmd = aCommand.Command(); |
93 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
96 MCalenCommandHandler* handler = iController.GetCommandHandlerL( cmd ); |
94 |
97 |
95 ASSERT( handler ); |
98 ASSERT( handler ); |
96 TBool cmdUsed = EFalse; |
99 TBool cmdUsed = EFalse; |
122 if(cmdUsed) |
126 if(cmdUsed) |
123 { |
127 { |
124 RequestCallbackL( handler, aCommand ); |
128 RequestCallbackL( handler, aCommand ); |
125 } |
129 } |
126 |
130 |
127 TRACE_EXIT_POINT; |
131 OstTraceFunctionExit0( CCALENSETTINGSSTATE_HANDLECOMMANDL_EXIT ); |
128 return cmdUsed; |
132 return cmdUsed; |
129 } |
133 } |
130 |
134 |
131 // ---------------------------------------------------------------------------- |
135 // ---------------------------------------------------------------------------- |
132 // CCalenSettingsState::HandleNotificationL |
136 // CCalenSettingsState::HandleNotificationL |
133 // From CCalenState |
137 // From CCalenState |
134 // ---------------------------------------------------------------------------- |
138 // ---------------------------------------------------------------------------- |
135 void CCalenSettingsState::HandleNotificationL(const TCalenNotification& aNotification, |
139 void CCalenSettingsState::HandleNotificationL(const TCalenNotification& aNotification, |
136 CCalenStateMachine& aStateMachine ) |
140 CCalenStateMachine& aStateMachine ) |
137 { |
141 { |
138 TRACE_ENTRY_POINT; |
142 OstTraceFunctionEntry0( CCALENSETTINGSSTATE_HANDLENOTIFICATIONL_ENTRY ); |
139 |
143 |
140 switch( aNotification ) |
144 switch( aNotification ) |
141 { |
145 { |
142 case ECalenNotifyPluginEnabledDisabled: |
146 case ECalenNotifyPluginEnabledDisabled: |
143 case ECalenNotifyEComRegistryChanged: |
|
144 { |
147 { |
145 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
148 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
146 } |
149 } |
147 break; |
150 break; |
148 case ECalenNotifySettingsClosed: |
151 case ECalenNotifySettingsClosed: |
149 { |
152 { |
150 // Settings closed, go back to previous state. |
153 // Settings closed, go back to previous state. |
151 SetCurrentState( aStateMachine, iPreviousState ); |
154 SetCurrentState( aStateMachine, iPreviousState ); |
152 iOutstandingNotifications.InsertL(aNotification); |
155 iOutstandingNotifications.InsertL(aNotification); |
153 ActivateCurrentStateL(aStateMachine); |
156 ActivateCurrentStateL(aStateMachine); |
154 } |
157 } |
155 break; |
158 break; |
156 |
159 case ECalenNotifySystemLocaleChanged: |
|
160 { |
|
161 CCalenState::HandleNotificationL( aNotification, aStateMachine ); |
|
162 } |
|
163 break; |
157 default: |
164 default: |
158 // default is defer all other notifications when we are in setting state |
165 // default is defer all other notifications when we are in setting state |
159 iOutstandingNotifications.InsertL(aNotification); |
166 iOutstandingNotifications.InsertL(aNotification); |
160 break; |
167 break; |
161 } |
168 } |
162 |
169 |
163 TRACE_EXIT_POINT; |
170 OstTraceFunctionExit0( CCALENSETTINGSSTATE_HANDLENOTIFICATIONL_EXIT ); |
164 } |
171 } |
165 |
172 |
166 // ---------------------------------------------------------------------------- |
173 // ---------------------------------------------------------------------------- |
167 // CCalenSettingsState::HandleStateActivationL |
174 // CCalenSettingsState::HandleStateActivationL |
168 // Behavior when state is activated. |
175 // Behavior when state is activated. |
169 // ---------------------------------------------------------------------------- |
176 // ---------------------------------------------------------------------------- |
170 void CCalenSettingsState::HandleStateActivationL() |
177 void CCalenSettingsState::HandleStateActivationL() |
171 { |
178 { |
172 TRACE_ENTRY_POINT; |
179 OstTraceFunctionEntry0( CCALENSETTINGSSTATE_HANDLESTATEACTIVATIONL_ENTRY ); |
173 |
180 |
174 if( iOutstandingNotifications.FindL(ECalenNotifySettingsCRepKeyChanged) ) |
181 if( iOutstandingNotifications.FindL(ECalenNotifySettingsCRepKeyChanged) ) |
175 { |
182 { |
176 iController.Notifier().BroadcastApprovedNotification( ECalenNotifySettingsCRepKeyChanged ); |
183 iController.Notifier().BroadcastApprovedNotification( ECalenNotifySettingsCRepKeyChanged ); |
177 } |
184 } |
178 |
185 |
179 TRACE_EXIT_POINT; |
186 OstTraceFunctionExit0( CCALENSETTINGSSTATE_HANDLESTATEACTIVATIONL_EXIT ); |
180 } |
187 } |
181 |
188 |
182 // end of file |
189 // end of file |