66 // ---------------------------------------------------------------------------- |
58 // ---------------------------------------------------------------------------- |
67 // |
59 // |
68 CCalenActionUi::CCalenActionUi( CCalenController& aController ) |
60 CCalenActionUi::CCalenActionUi( CCalenController& aController ) |
69 : iController( aController ) |
61 : iController( aController ) |
70 { |
62 { |
71 TRACE_ENTRY_POINT; |
63 OstTraceFunctionEntry0( CCALENACTIONUI_CCALENACTIONUI_ENTRY ); |
72 TRACE_EXIT_POINT; |
64 |
|
65 OstTraceFunctionExit0( CCALENACTIONUI_CCALENACTIONUI_EXIT ); |
73 } |
66 } |
74 |
67 |
75 // ---------------------------------------------------------------------------- |
68 // ---------------------------------------------------------------------------- |
76 // CCalenActionUi::ConstructL |
69 // CCalenActionUi::ConstructL |
77 // 2nd phase of construction. |
70 // 2nd phase of construction. |
78 // (other items were commented in a header). |
71 // (other items were commented in a header). |
79 // ---------------------------------------------------------------------------- |
72 // ---------------------------------------------------------------------------- |
80 // |
73 // |
81 void CCalenActionUi::ConstructL() |
74 void CCalenActionUi::ConstructL() |
82 { |
75 { |
83 TRACE_ENTRY_POINT; |
76 OstTraceFunctionEntry0( CCALENACTIONUI_CONSTRUCTL_ENTRY ); |
84 TRACE_EXIT_POINT; |
77 |
|
78 OstTraceFunctionExit0( CCALENACTIONUI_CONSTRUCTL_EXIT ); |
85 } |
79 } |
86 |
80 |
87 // ---------------------------------------------------------------------------- |
81 // ---------------------------------------------------------------------------- |
88 // CCalenActionUi::~CCalenActionUi |
82 // CCalenActionUi::~CCalenActionUi |
89 // Destructor. |
83 // Destructor. |
90 // (other items were commented in a header). |
84 // (other items were commented in a header). |
91 // ---------------------------------------------------------------------------- |
85 // ---------------------------------------------------------------------------- |
92 // |
86 // |
93 CCalenActionUi::~CCalenActionUi() |
87 CCalenActionUi::~CCalenActionUi() |
94 { |
88 { |
95 TRACE_ENTRY_POINT; |
89 OstTraceFunctionEntry0( DUP1_CCALENACTIONUI_CCALENACTIONUI_ENTRY ); |
|
90 |
|
91 delete iDeleteUi; |
|
92 delete iEditUi; |
96 |
93 |
97 delete iDeleteUi; |
94 OstTraceFunctionExit0( DUP1_CCALENACTIONUI_CCALENACTIONUI_EXIT ); |
98 delete iEditUi; |
|
99 delete iLocationUi; |
|
100 delete iAttachmentUi; |
|
101 |
|
102 TRACE_EXIT_POINT; |
|
103 } |
95 } |
104 |
96 |
105 // ---------------------------------------------------------------------------- |
97 // ---------------------------------------------------------------------------- |
106 // CCalenActionUi::GetCommandHandlerL |
98 // CCalenActionUi::GetCommandHandlerL |
107 // Gets a command handler |
99 // Gets a command handler |
108 // ---------------------------------------------------------------------------- |
100 // ---------------------------------------------------------------------------- |
109 // |
101 // |
110 MCalenCommandHandler* CCalenActionUi::GetCommandHandlerL( TInt aCommand ) |
102 MCalenCommandHandler* CCalenActionUi::GetCommandHandlerL( TInt aCommand ) |
111 { |
103 { |
|
104 OstTraceFunctionEntry0( CCALENACTIONUI_GETCOMMANDHANDLERL_ENTRY ); |
|
105 |
112 MCalenCommandHandler* handler = NULL; |
106 MCalenCommandHandler* handler = NULL; |
113 |
107 |
114 if( aCommand >= ECalenEditCommandBase && |
108 if ( aCommand >= ECalenEditCommandBase |
115 aCommand < ECalenDeleteCommandBase ) |
109 && aCommand < ECalenDeleteCommandBase ) |
116 { |
|
117 if(!iEditUi) |
|
118 { |
|
119 iEditUi = CCalenEditUi::NewL(iController); |
|
120 } |
|
121 handler = iEditUi; |
|
122 } |
|
123 else if( aCommand >= ECalenDeleteCommandBase && |
|
124 aCommand < ECalenSettingsCommandBase ) |
|
125 { |
|
126 if(!iDeleteUi) |
|
127 { |
|
128 iDeleteUi = CCalenDeleteUi::NewL( iController ); |
|
129 } |
|
130 handler = iDeleteUi; |
|
131 } |
|
132 else if( aCommand >= ECalenSettingsCommandBase && |
|
133 aCommand < ECalenMapCommandBase ) |
|
134 { |
|
135 handler = this; |
|
136 } |
|
137 else if( aCommand >= ECalenMapCommandBase && |
|
138 aCommand < ECalenAttachmentCommandBase ) |
|
139 { |
|
140 if(!iLocationUi) |
|
141 { |
|
142 iLocationUi = CCalenLocationUi::NewL( iController ); |
|
143 } |
|
144 handler = iLocationUi; |
|
145 } |
|
146 else if( aCommand >= ECalenAttachmentCommandBase && |
|
147 aCommand < ECalenLastCommand ) |
|
148 { |
|
149 if(!iAttachmentUi) |
|
150 { |
|
151 iAttachmentUi = CCalenAttachmentUi::NewL(iController); |
|
152 } |
|
153 handler = iAttachmentUi; |
|
154 } |
|
155 |
|
156 TRACE_EXIT_POINT; |
|
157 return handler; |
|
158 } |
|
159 |
|
160 // ---------------------------------------------------------------------------- |
|
161 // CCalenActionUi::HandleCommmandL |
|
162 // Handles Calendar commands. Delegates to appropriate action ui. |
|
163 // (other items were commented in a header). |
|
164 // ---------------------------------------------------------------------------- |
|
165 // |
|
166 /*TBool CCalenActionUi::HandleActionUiCommandL( TInt aCommand ) |
|
167 { |
|
168 TRACE_ENTRY_POINT; |
|
169 |
|
170 // Lazy initialisation for action uis. |
|
171 TBool handled( EFalse ); |
|
172 |
|
173 if( aCommand >= ECalenEditCommandBase && aCommand < ECalenLastCommand ) |
|
174 { |
110 { |
175 if( !iEditUi ) |
111 if( !iEditUi ) |
176 { |
112 { |
177 iEditUi = CCalenEditUi::NewL( iController ); |
113 iEditUi = CCalenEditUi::NewL( iController ); |
178 } |
114 } |
179 handled = iEditUi->HandleActionUiCommandL( aCommand ); |
115 handler = iEditUi; |
180 |
116 } |
181 if( !handled ) |
117 else if ( aCommand >= ECalenDeleteCommandBase |
|
118 && aCommand < ECalenSettingsCommandBase ) |
|
119 { |
|
120 if( !iDeleteUi ) |
182 { |
121 { |
183 if( !iDeleteUi ) |
122 iDeleteUi = CalenDeleteUi::NewL( iController ); |
184 { |
|
185 iDeleteUi = CCalenDeleteUi::NewL( iController ); |
|
186 } |
|
187 handled = iDeleteUi->HandleActionUiCommandL( aCommand ); |
|
188 } |
123 } |
189 |
124 handler = iDeleteUi; |
190 if( !handled && aCommand == ECalenShowSettings ) |
|
191 { |
|
192 handled = ETrue; |
|
193 |
|
194 ShowSettingsL(); |
|
195 } |
|
196 } |
125 } |
197 |
126 else if ( aCommand >= ECalenSettingsCommandBase |
198 TRACE_EXIT_POINT; |
127 && aCommand < ECalenMapCommandBase ) |
199 return handled; |
128 { |
200 }*/ |
129 handler = this; |
201 |
130 } |
|
131 else if ( aCommand >= ECalenMapCommandBase |
|
132 && aCommand < ECalenLastCommand ) |
|
133 { |
|
134 } |
|
135 |
|
136 OstTraceFunctionExit0( CCALENACTIONUI_GETCOMMANDHANDLERL_EXIT ); |
|
137 return handler; |
|
138 } |
202 |
139 |
203 // ---------------------------------------------------------------------------- |
140 // ---------------------------------------------------------------------------- |
204 // CCalenActionUi::HandleCommandL |
141 // CCalenActionUi::HandleCommandL |
205 // Handles key presses. |
142 // Handles key presses. |
206 // (other items were commented in a header). |
143 // (other items were commented in a header). |
207 // ---------------------------------------------------------------------------- |
144 // ---------------------------------------------------------------------------- |
208 // |
145 // |
209 TBool CCalenActionUi::HandleCommandL( const TCalenCommand& aCommand ) |
146 TBool CCalenActionUi::HandleCommandL( const TCalenCommand& aCommand ) |
210 { |
147 { |
211 TRACE_ENTRY_POINT; |
148 OstTraceFunctionEntry0( CCALENACTIONUI_HANDLECOMMANDL_ENTRY ); |
|
149 |
212 TBool continueCommand(EFalse); |
150 TBool continueCommand(EFalse); |
213 |
151 |
214 switch(aCommand.Command()) |
152 if(aCommand.Command()==ECalenShowSettings) |
215 { |
153 { |
216 case ECalenShowSettings: |
154 iController.ViewManager().launchSettingsView(); |
217 { |
|
218 ShowSettingsL(); |
|
219 } |
|
220 break; |
|
221 case ECalenShowCalendars: |
|
222 { |
|
223 ShowCalendarsL(); |
|
224 } |
|
225 break; |
|
226 default: |
|
227 break; |
|
228 } |
155 } |
229 |
156 |
230 TRACE_EXIT_POINT; |
157 OstTraceFunctionExit0( CCALENACTIONUI_HANDLECOMMANDL_EXIT ); |
231 return continueCommand; |
158 return continueCommand; |
232 } |
159 } |
233 |
160 |
234 // ---------------------------------------------------------------------------- |
161 // ---------------------------------------------------------------------------- |
235 // CCalenActionUi::CalenCommandHandlerExtensionL |
162 // CCalenActionUi::saveEntry |
236 // Dummy implementation. |
163 // save the entry from editor |
237 // (other items were commented in a header). |
|
238 // ---------------------------------------------------------------------------- |
164 // ---------------------------------------------------------------------------- |
239 // |
165 // |
240 TAny* CCalenActionUi::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ ) |
166 void CCalenActionUi::saveAndCloseEditor() |
241 { |
167 { |
242 TRACE_ENTRY_POINT; |
168 iEditUi->saveAndCloseEditor(); |
243 TRACE_EXIT_POINT; |
|
244 return NULL; |
|
245 } |
169 } |
246 |
|
247 // ---------------------------------------------------------------------------- |
|
248 // CCalenActionUi::ShowCalendarsL |
|
249 // Shows the multiple db calendar's dialog |
|
250 // (other items were commented in a header). |
|
251 // ---------------------------------------------------------------------------- |
|
252 // |
|
253 void CCalenActionUi::ShowCalendarsL() |
|
254 { |
|
255 TRACE_ENTRY_POINT; |
|
256 // Create settings own titlepane and navipane, and swap with existing ones |
|
257 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
258 |
|
259 // Titlepane |
|
260 CAknTitlePane* newtp = new( ELeave ) CAknTitlePane(); |
|
261 CleanupStack::PushL( newtp ); |
|
262 CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp ); |
|
263 CleanupStack::Pop( newtp ); // ownership is passed to statuspane |
|
264 TRect oldRect( 0, 0, 0, 0 ); |
|
265 if( oldtp ) |
|
266 { |
|
267 CleanupStack::PushL( oldtp ); |
|
268 oldRect = oldtp->Rect(); |
|
269 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle )); |
|
270 newtp->SetContainerWindowL( *ctrl ); |
|
271 newtp->ConstructL(); |
|
272 newtp->SetRect(oldRect); |
|
273 newtp->ActivateL(); |
|
274 } |
|
275 // NaviPane |
|
276 CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer(); |
|
277 CleanupStack::PushL( newnp ); |
|
278 CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp ); |
|
279 CleanupStack::Pop( newnp ); // ownership is passed to statuspane |
|
280 if( oldnp ) |
|
281 { |
|
282 CleanupStack::PushL( oldnp ); |
|
283 oldRect = oldnp->Rect(); |
|
284 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
285 newnp->SetContainerWindowL( *ctrl ); |
|
286 newnp->ConstructL(); |
|
287 newnp->SetRect( oldRect ); |
|
288 newnp->PushDefaultL(); |
|
289 newnp->ActivateL(); |
|
290 } |
|
291 |
|
292 // Hide the toolbar before we display settings menu |
|
293 MCalenToolbar* toolbar = iController.Services().ToolbarOrNull(); |
|
294 if(toolbar) |
|
295 { |
|
296 toolbar->SetToolbarVisibilityL(EFalse); |
|
297 } |
|
298 |
|
299 // defer settings notifications before launching the settings |
|
300 CCalenNotifier& notifier = iController.Notifier(); |
|
301 notifier.DeferSettingsNotifications(); |
|
302 |
|
303 CCalenMultipleDbUi* dlg = CCalenMultipleDbUi::NewL(iController); |
|
304 TInt retValue = KErrNone; |
|
305 // Trap showing settings so settings watcher is always resumed. |
|
306 PIM_TRAPD_HANDLE( retValue = dlg->ExecuteLD( R_CALEN_MULTIPLEDB_DIALOG ) ); |
|
307 notifier.ResumeSettingsNotifications(); |
|
308 |
|
309 // Unhide the toolbar when manage calendar view is closed |
|
310 TUid activeViewUid = iController.ViewManager().CurrentView(); |
|
311 if(toolbar && (activeViewUid != KUidCalenMissedAlarmsView ) &&(activeViewUid != KUidCalenMissedEventView ) ) |
|
312 { |
|
313 toolbar->SetToolbarVisibilityL(ETrue); |
|
314 } |
|
315 |
|
316 // When setting is closed, swap back old titlepane and navipane |
|
317 if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) ) |
|
318 { |
|
319 CleanupStack::Pop( oldnp ); |
|
320 delete newnp; |
|
321 oldnp->ActivateL(); |
|
322 } |
|
323 if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) ) |
|
324 { |
|
325 CleanupStack::Pop( oldtp ); |
|
326 delete newtp; |
|
327 oldtp->ActivateL(); |
|
328 } |
|
329 |
|
330 iController.BroadcastNotification( ECalenNotifyCalendarFieldChanged ); |
|
331 |
|
332 if( retValue == EAknCmdExit || |
|
333 retValue == EKeyEscape ) |
|
334 { |
|
335 // iController.IssueCommandL( EAknCmdExit ); |
|
336 // FIX ME :: |
|
337 // Issuing the command from here will not exit the application properly |
|
338 // because aknviewappui is not exited |
|
339 // Calling ProcessCommandL of aknviewappui will exits the application |
|
340 iController.AppUi().ProcessCommandL(EAknCmdExit); |
|
341 } |
|
342 else if(retValue == EAknSoftkeyExit) |
|
343 { |
|
344 // iController.IssueCommandL( EAknCmdExit ); |
|
345 // FIX ME :: |
|
346 // Issuing the command from here will not exit the application properly |
|
347 // because aknviewappui is not exited |
|
348 // Calling ProcessCommandL of aknviewappui will exits the application |
|
349 iController.AppUi().ProcessCommandL(EAknSoftkeyExit); |
|
350 } |
|
351 |
|
352 TRACE_EXIT_POINT; |
|
353 } |
|
354 |
|
355 // ---------------------------------------------------------------------------- |
|
356 // CCalenActionUi::ShowSettingsL |
|
357 // Shows the settings dialog |
|
358 // (other items were commented in a header). |
|
359 // ---------------------------------------------------------------------------- |
|
360 // |
|
361 void CCalenActionUi::ShowSettingsL() |
|
362 { |
|
363 TRACE_ENTRY_POINT; |
|
364 |
|
365 // Create settings own titlepane and navipane, and swap with existing ones |
|
366 CEikStatusPane* sp = CEikonEnv::Static()->AppUiFactory()->StatusPane(); |
|
367 |
|
368 // Titlepane |
|
369 CAknTitlePane* newtp = new( ELeave ) CAknTitlePane(); |
|
370 CleanupStack::PushL( newtp ); |
|
371 CCoeControl* oldtp = sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), newtp ); |
|
372 CleanupStack::Pop( newtp ); // ownership is passed to statuspane |
|
373 TRect oldRect( 0, 0, 0, 0 ); |
|
374 if( oldtp ) |
|
375 { |
|
376 CleanupStack::PushL( oldtp ); |
|
377 oldRect = oldtp->Rect(); |
|
378 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidTitle )); |
|
379 newtp->SetContainerWindowL( *ctrl ); |
|
380 newtp->ConstructL(); |
|
381 newtp->SetRect(oldRect); |
|
382 newtp->ActivateL(); |
|
383 } |
|
384 |
|
385 // NaviPane |
|
386 CAknNavigationControlContainer* newnp = new( ELeave )CAknNavigationControlContainer(); |
|
387 CleanupStack::PushL( newnp ); |
|
388 CCoeControl* oldnp = sp->SwapControlL( TUid::Uid( EEikStatusPaneUidNavi ), newnp ); |
|
389 CleanupStack::Pop( newnp ); // ownership is passed to statuspane |
|
390 if( oldnp ) |
|
391 { |
|
392 CleanupStack::PushL( oldnp ); |
|
393 oldRect = oldnp->Rect(); |
|
394 CCoeControl* ctrl = sp->ContainerControlL( TUid::Uid( EEikStatusPaneUidNavi ) ); |
|
395 newnp->SetContainerWindowL( *ctrl ); |
|
396 newnp->ConstructL(); |
|
397 newnp->SetRect( oldRect ); |
|
398 newnp->PushDefaultL(); |
|
399 newnp->ActivateL(); |
|
400 } |
|
401 |
|
402 // Hide the toolbar before we display settings menu |
|
403 MCalenToolbar* toolbar = iController.Services().ToolbarOrNull(); |
|
404 if(toolbar) |
|
405 { |
|
406 toolbar->SetToolbarVisibilityL(EFalse); |
|
407 } |
|
408 |
|
409 // defer settings notifications before launching the settings |
|
410 CCalenNotifier& notifier = iController.Notifier(); |
|
411 notifier.DeferSettingsNotifications(); |
|
412 |
|
413 CCalenSettingsUi* dlg = CCalenSettingsUi::NewL(iController.CustomisationManager()); |
|
414 TInt retValue = KErrNone; |
|
415 // Trap showing settings so settings watcher is always resumed. |
|
416 PIM_TRAPD_HANDLE( retValue = dlg->ExecuteLD( R_CALEN_SETTING_DIALOG ) ); |
|
417 notifier.ResumeSettingsNotifications(); |
|
418 |
|
419 // Unhide the toolbar when settings is closed |
|
420 TUid activeViewUid = iController.ViewManager().CurrentView(); |
|
421 if(toolbar && (activeViewUid != KUidCalenMissedAlarmsView ) &&(activeViewUid != KUidCalenMissedEventView ) ) |
|
422 { |
|
423 toolbar->SetToolbarVisibilityL(ETrue); |
|
424 } |
|
425 |
|
426 // When setting is closed, swap back old titlepane and navipane |
|
427 if( oldnp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidNavi), oldnp ) ) |
|
428 { |
|
429 CleanupStack::Pop( oldnp ); |
|
430 delete newnp; |
|
431 oldnp->ActivateL(); |
|
432 } |
|
433 if( oldtp && sp->SwapControlL( TUid::Uid(EEikStatusPaneUidTitle), oldtp ) ) |
|
434 { |
|
435 CleanupStack::Pop( oldtp ); |
|
436 delete newtp; |
|
437 oldtp->ActivateL(); |
|
438 } |
|
439 |
|
440 iController.BroadcastNotification( ECalenNotifySettingsClosed ); |
|
441 |
|
442 if( retValue == EAknCmdExit || |
|
443 retValue == EKeyEscape ) |
|
444 { |
|
445 // iController.IssueCommandL( EAknCmdExit ); |
|
446 // FIX ME :: |
|
447 // Issuing the command from here will not exit the application properly |
|
448 // because aknviewappui is not exited |
|
449 // Calling ProcessCommandL of aknviewappui will exits the application |
|
450 iController.AppUi().ProcessCommandL(EAknCmdExit); |
|
451 } |
|
452 else if(retValue == EAknSoftkeyExit) |
|
453 { |
|
454 // iController.IssueCommandL( EAknCmdExit ); |
|
455 // FIX ME :: |
|
456 // Issuing the command from here will not exit the application properly |
|
457 // because aknviewappui is not exited |
|
458 // Calling ProcessCommandL of aknviewappui will exits the application |
|
459 iController.AppUi().ProcessCommandL(EAknSoftkeyExit); |
|
460 } |
|
461 |
|
462 TRACE_EXIT_POINT; |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // CCalenActionUi::IsEditorActive |
|
467 // Tells framework whether editor is active or not |
|
468 // ----------------------------------------------------------------------------- |
|
469 // |
|
470 TBool CCalenActionUi::IsEditorActive() |
|
471 { |
|
472 if(iEditUi) |
|
473 { |
|
474 return(iEditUi->IsEditorActive()); |
|
475 } |
|
476 else |
|
477 return EFalse; |
|
478 } |
|
479 |
|
480 // End of file |
170 // End of file |