23 #include <activeidle2domainpskeys.h> |
23 #include <activeidle2domainpskeys.h> |
24 #include <AknDlgShut.h> // Avkon dialog shutter. |
24 #include <AknDlgShut.h> // Avkon dialog shutter. |
25 #include <aknview.h> |
25 #include <aknview.h> |
26 |
26 |
27 // User includes |
27 // User includes |
|
28 #include <hspublisherinfo.h> |
|
29 #include <aifwdefs.h> |
28 #include <activeidle2domaincrkeys.h> |
30 #include <activeidle2domaincrkeys.h> |
29 #include <aifweventhandler.h> |
31 #include <aifweventhandler.h> |
|
32 #include <aifwstatehandler.h> |
30 #include <ai3xmlui.rsg> |
33 #include <ai3xmlui.rsg> |
31 |
34 |
32 #include "appui.h" |
35 #include "appui.h" |
33 #include "application.h" |
36 #include "application.h" |
34 #include "xmluicontroller.h" |
37 #include "xmluicontroller.h" |
35 #include "aixuikoneventhandler.h" |
38 #include "aixuikoneventhandler.h" |
36 #include "aiuiframeworkobserver.h" |
|
37 #include "aixmluiconstants.h" |
39 #include "aixmluiconstants.h" |
38 #include "contentrenderer.h" |
40 #include "contentrenderer.h" |
39 #include "psobserver.h" |
41 #include "psobserver.h" |
40 |
42 |
41 #include "aipropertyextension.h" |
|
42 #include "aicontentmodel.h" |
43 #include "aicontentmodel.h" |
43 #include "aiuiidleintegration.h" |
44 #include "aiuiidleintegration.h" |
44 #include "xmluicontrollerpanic.h" |
45 #include "xmluicontrollerpanic.h" |
45 |
46 |
46 #include "debug.h" |
47 #include "debug.h" |
47 #include "ai3perf.h" |
48 #include "ai3perf.h" |
48 #include "xndomnode.h" |
49 #include "xndomnode.h" |
49 #include "xnproperty.h" |
50 #include "xnproperty.h" |
50 #include "xnuiengineappif.h" |
51 #include "xnuiengineappif.h" |
51 #include "onlineofflinehelper.h" |
52 #include "onlineofflinehelper.h" |
|
53 #include "ainativeuiplugins.h" |
|
54 |
|
55 // Constants |
|
56 // EAiDeviceStatusContentNetworkIdentity content id |
|
57 _LIT( KNetworkIdentity, "NetworkIdentity" ); |
52 |
58 |
53 using namespace AiXmlUiController; |
59 using namespace AiXmlUiController; |
54 |
60 |
55 // ======== MEMBER FUNCTIONS ======== |
61 // ======== MEMBER FUNCTIONS ======== |
56 |
62 |
70 void CAppUi::ConstructL() |
76 void CAppUi::ConstructL() |
71 { |
77 { |
72 AI3_PERF_START(perfdata, "xmluicontroller: CAppUi::ConstructL") |
78 AI3_PERF_START(perfdata, "xmluicontroller: CAppUi::ConstructL") |
73 |
79 |
74 // Always reset the phoneforward P&S key on startup just in case |
80 // Always reset the phoneforward P&S key on startup just in case |
75 RProperty::Set(KPSUidAiInformation, |
81 RProperty::Set( KPSUidAiInformation, |
76 KActiveIdleForwardNumericKeysToPhone, |
82 KActiveIdleForwardNumericKeysToPhone, EPSAiForwardNumericKeysToPhone ); |
77 EPSAiForwardNumericKeysToPhone); |
83 |
78 |
|
79 // Initialize with empty title pane so it's not shown on startup. |
84 // Initialize with empty title pane so it's not shown on startup. |
80 __HEAP("XML UI: Init - Construct App UI") |
85 __HEAP("XML UI: Init - Construct App UI") |
81 __TIME("XML UI: XnAppUiAdapted::ConstructL", |
86 __TIME("XML UI: XnAppUiAdapted::ConstructL", |
82 CXnAppUiAdapter::ConstructL(); |
87 CXnAppUiAdapter::ConstructL(); |
83 ) |
88 ) |
84 |
89 |
85 // Register for XML UI view activation & deactivation |
90 // Register for XML UI view activation & deactivation |
86 AddViewActivationObserverL( this ); |
91 AddViewActivationObserverL( this ); |
87 |
92 |
88 // Disable CCoeEnv exit checks. |
93 // Disable CCoeEnv exit checks. |
89 // Active Idle Framework will perform the checks. |
94 // Active Idle Framework will perform the checks. |
90 iCoeEnv->DisableExitChecks(ETrue); |
95 iCoeEnv->DisableExitChecks( ETrue ); |
91 |
96 |
92 __TIME("XML UI: Construct Content Renderer", |
97 __TIME("XML UI: Construct Content Renderer", |
93 iContentRenderer = CContentRenderer::NewL( *this ); |
98 iContentRenderer = CContentRenderer::NewL( *this ); |
94 ) |
99 ) |
95 __HEAP("XML UI: Construct Content Renderer"); |
100 __HEAP("XML UI: Construct Content Renderer"); |
96 |
101 |
97 TXnUiEngineAppIf* uiEngine = UiEngineL(); |
102 TXnUiEngineAppIf* uiEngine( UiEngineL() ); |
98 __ASSERT_ALWAYS( uiEngine, Panic(ECriticalPointerNull) ); |
103 __ASSERT_ALWAYS( uiEngine, Panic(ECriticalPointerNull) ); |
99 |
104 |
100 iUiCtl.SetObserver( *iContentRenderer ); |
105 iUiCtl.SetObserver( *iContentRenderer ); |
101 |
106 |
102 iContentRenderer->SetEventHandler( *iUiCtl.FwEventHandler() ); |
107 iContentRenderer->SetEventHandler( *iUiCtl.FwEventHandler() ); |
103 |
108 |
104 iUiCtl.SetAppUi( *this ); |
109 iUiCtl.SetAppUi( *this ); |
105 |
110 |
106 iEventHandler = iUiCtl.CreateXuikonEventHandlerL( *iContentRenderer ); |
111 iEventHandler = iUiCtl.CreateXuikonEventHandlerL( *iContentRenderer ); |
107 |
112 |
108 iUiFwObserver = iUiCtl.UiFrameworkObserver(); |
|
109 |
|
110 TAiIdleKeySoundConfig keySoundConfig; |
113 TAiIdleKeySoundConfig keySoundConfig; |
111 keySoundConfig.iKeySounds = KeySounds(); |
114 keySoundConfig.iKeySounds = KeySounds(); |
112 keySoundConfig.iContextResId = R_XUI_DEFAULT_SKEY_LIST; |
115 keySoundConfig.iContextResId = R_XUI_DEFAULT_SKEY_LIST; |
113 |
116 |
114 iIdleIntegration = CAiUiIdleIntegration::NewL |
117 iIdleIntegration = CAiUiIdleIntegration::NewL |
115 ( *iEikonEnv, keySoundConfig, iUiCtl.FwEventHandler() ); |
118 ( *iEikonEnv, keySoundConfig, iUiCtl.FwEventHandler() ); |
116 |
119 |
117 iHelper = COnlineOfflineHelper::NewL( iUiCtl ); |
|
118 |
|
119 iUiCtl.NotifyAppEnvReadyL(); |
120 iUiCtl.NotifyAppEnvReadyL(); |
120 |
121 |
121 LoadNativeDataPluginsL(); |
|
122 |
|
123 CAknAppUiBase::SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | |
122 CAknAppUiBase::SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | |
124 CAknAppUiBase::EDisableSendKeyLong ); |
123 CAknAppUiBase::EDisableSendKeyLong ); |
125 |
124 |
126 iIsEditModeActive = EFalse; |
125 iHelper = COnlineOfflineHelper::NewL( iUiCtl ); |
127 |
126 |
128 |
127 // Load device status plugin here because it is always needed |
|
128 iDeviceStatusInfo = THsPublisherInfo( KDeviceStatusPluginUid, |
|
129 KDeviceStatusPluginName, KNullDesC8 ); |
|
130 |
|
131 iUiCtl.FwStateHandler()->LoadPlugin( |
|
132 iDeviceStatusInfo, EAiFwSystemStartup ); |
|
133 |
129 __HEAP("XML UI: Done - Construct App UI"); |
134 __HEAP("XML UI: Done - Construct App UI"); |
|
135 |
130 AI3_PERF_STOP(perfdata, "xmluicontroller: CAppUi::ConstructL") |
136 AI3_PERF_STOP(perfdata, "xmluicontroller: CAppUi::ConstructL") |
131 } |
137 } |
132 |
138 |
133 // ---------------------------------------------------------------------------- |
139 // ---------------------------------------------------------------------------- |
134 // CAppUi::NewL() |
140 // CAppUi::NewL() |
159 // CAppUi::PrepareToExit() |
165 // CAppUi::PrepareToExit() |
160 // ---------------------------------------------------------------------------- |
166 // ---------------------------------------------------------------------------- |
161 // |
167 // |
162 void CAppUi::PrepareToExit() |
168 void CAppUi::PrepareToExit() |
163 { |
169 { |
|
170 iUiShutdown = ETrue; |
|
171 |
|
172 RemoveViewActivationObserver( this ); |
|
173 |
164 iUiCtl.FwEventHandler()->HandleUiShutdown( iUiCtl ); |
174 iUiCtl.FwEventHandler()->HandleUiShutdown( iUiCtl ); |
165 |
175 |
166 CXnAppUiAdapter::PrepareToExit(); |
176 CXnAppUiAdapter::PrepareToExit(); |
167 } |
|
168 |
|
169 // ---------------------------------------------------------------------------- |
|
170 // CAppUi::HandleForegroundEventL() |
|
171 // ---------------------------------------------------------------------------- |
|
172 // |
|
173 void CAppUi::HandleForegroundEventL( TBool aForeground ) |
|
174 { |
|
175 CXnAppUiAdapter::HandleForegroundEventL( aForeground ); |
|
176 |
|
177 if( iUiFwObserver ) |
|
178 { |
|
179 iUiFwObserver->HandleForegroundEvent( aForeground ); |
|
180 } |
|
181 } |
177 } |
182 |
178 |
183 // ---------------------------------------------------------------------------- |
179 // ---------------------------------------------------------------------------- |
184 // CAppUi::HandleCommandL() |
180 // CAppUi::HandleCommandL() |
185 // ---------------------------------------------------------------------------- |
181 // ---------------------------------------------------------------------------- |
277 |
259 |
278 if( iEventHandler ) |
260 if( iEventHandler ) |
279 { |
261 { |
280 __TIME("UC: Event Management", |
262 __TIME("UC: Event Management", |
281 iEventHandler->HandleXuikonEventL( aOrigin, |
263 iEventHandler->HandleXuikonEventL( aOrigin, |
282 aTrigger, |
264 aTrigger, aTriggerDefinition, aEvent ) ); |
283 aTriggerDefinition, |
|
284 aEvent ); |
|
285 ); |
|
286 } |
265 } |
287 __PRINTS("*** UI: Done - Event Management"); |
266 __PRINTS("*** UI: Done - Event Management"); |
288 } |
267 } |
289 |
268 |
|
269 // ---------------------------------------------------------------------------- |
|
270 // CAppUi::HandleEventL() |
|
271 // ---------------------------------------------------------------------------- |
|
272 // |
|
273 void CAppUi::HandleEventL( const TDesC& aEvent, CXnNodeAppIf& aDestination ) |
|
274 { |
|
275 THsPublisherInfo info; |
|
276 |
|
277 iUiCtl.PublisherInfoL( aDestination, info ); |
|
278 |
|
279 iUiCtl.FwEventHandler()->HandlePluginEventL( info, aEvent ); |
|
280 } |
|
281 |
290 // ---------------------------------------------------------------------------- |
282 // ---------------------------------------------------------------------------- |
291 // CAppUi::LoadDataPluginsL() |
283 // CAppUi::LoadDataPluginsL() |
292 // ---------------------------------------------------------------------------- |
284 // ---------------------------------------------------------------------------- |
293 // |
285 // |
294 void CAppUi::LoadDataPluginsL( RPointerArray< CXnNodeAppIf >& aList ) |
286 TInt CAppUi::LoadPublisher( CXnNodeAppIf& aPublisher, TInt aReason ) |
295 { |
287 { |
296 for( TInt i = 0; i < aList.Count(); i++ ) |
288 if ( iUiShutdown ) |
297 { |
289 { |
298 TAiPublisherInfo info; |
290 // Framework has already destroyed all publishers |
299 |
291 return KErrNone; |
300 iUiCtl.PublisherInfoL( *aList[i], info ); |
292 } |
301 |
293 |
302 iUiCtl.FwEventHandler()->HandleLoadPluginL( info ); |
294 THsPublisherInfo info; |
303 } |
295 |
304 } |
296 TRAP_IGNORE( iUiCtl.PublisherInfoL( aPublisher, info ) ); |
305 |
297 |
306 // ---------------------------------------------------------------------------- |
298 if ( info.Uid() == KDeviceStatusPluginUid ) |
307 // CAppUi::LoadNativeDataPluginsL() |
299 { |
308 // ---------------------------------------------------------------------------- |
300 // Update device status info |
309 // |
301 iDeviceStatusInfo = info; |
310 void CAppUi::LoadNativeDataPluginsL() |
302 } |
311 { |
303 |
312 if ( !iNativePluginsLoaded ) |
304 return iUiCtl.FwStateHandler()->LoadPlugin( |
313 { |
305 info, (TAiFwLoadReason) aReason ); |
314 RAiPublisherInfoArray plugins; |
306 } |
315 CleanupClosePushL( plugins ); |
307 |
316 |
308 // ---------------------------------------------------------------------------- |
317 iUiCtl.PublisherInfoL( plugins ); |
309 // CAppUi::DestroyPublisher() |
318 |
310 // ---------------------------------------------------------------------------- |
319 for ( TInt i = 0; i < plugins.Count(); i++ ) |
311 // |
320 { |
312 TInt CAppUi::DestroyPublisher( CXnNodeAppIf& aPublisher, TInt aReason ) |
321 iUiCtl.FwEventHandler()->HandleLoadPluginL( plugins[i] ); |
313 { |
322 } |
314 if ( iUiShutdown ) |
323 |
315 { |
324 CleanupStack::PopAndDestroy( &plugins ); |
316 // Framework has already destroyed all publishers |
325 |
317 return KErrNone; |
326 iNativePluginsLoaded = ETrue; |
318 } |
327 } |
319 |
328 } |
320 THsPublisherInfo info; |
329 |
321 |
330 // ---------------------------------------------------------------------------- |
322 TRAP_IGNORE( iUiCtl.PublisherInfoL( aPublisher, info ) ); |
331 // CAppUi::DestroyDataPluginsL() |
323 |
332 // ---------------------------------------------------------------------------- |
324 iUiCtl.FwStateHandler()->DestroyPlugin( |
333 // |
325 info, (TAiFwDestroyReason) aReason ); |
334 void CAppUi::DestroyDataPluginsL( RPointerArray< CXnNodeAppIf >& aList ) |
326 |
335 { |
327 return KErrNone; |
336 for( TInt i = 0; i < aList.Count(); i++ ) |
|
337 { |
|
338 TAiPublisherInfo info; |
|
339 |
|
340 iUiCtl.PublisherInfoL( *aList[i], info ); |
|
341 |
|
342 iUiCtl.FwEventHandler()->HandleDestroyPluginL( info ); |
|
343 } |
|
344 } |
|
345 |
|
346 // ---------------------------------------------------------------------------- |
|
347 // CAppUi::DestroyNativeDataPluginsL() |
|
348 // ---------------------------------------------------------------------------- |
|
349 // |
|
350 void CAppUi::DestroyNativeDataPluginsL() |
|
351 { |
|
352 if ( iNativePluginsLoaded ) |
|
353 { |
|
354 RAiPublisherInfoArray plugins; |
|
355 CleanupClosePushL( plugins ); |
|
356 |
|
357 iUiCtl.PublisherInfoL( plugins ); |
|
358 |
|
359 for ( TInt i = 0; i < plugins.Count(); i++ ) |
|
360 { |
|
361 iUiCtl.FwEventHandler()->HandleDestroyPluginL( plugins[i] ); |
|
362 } |
|
363 |
|
364 CleanupStack::PopAndDestroy( &plugins ); |
|
365 |
|
366 iNativePluginsLoaded = EFalse; |
|
367 } |
|
368 } |
328 } |
369 |
329 |
370 // ---------------------------------------------------------------------------- |
330 // ---------------------------------------------------------------------------- |
371 // CAppUi::DynInitMenuItemL() |
331 // CAppUi::DynInitMenuItemL() |
372 // ---------------------------------------------------------------------------- |
332 // ---------------------------------------------------------------------------- |
373 // |
333 // |
374 TBool CAppUi::DynInitMenuItemL( const TDesC& aItemType, |
334 TBool CAppUi::DynInitMenuItemL( const TDesC& aItemType, |
375 RPointerArray< CXnNodeAppIf >* aList ) |
335 RPointerArray< CXnNodeAppIf >* aList ) |
376 { |
336 { |
|
337 if ( iUiShutdown ) |
|
338 { |
|
339 // Framework has already destroyed all publishers |
|
340 return EFalse; |
|
341 } |
|
342 |
377 _LIT( KOnline, "hs_online" ); |
343 _LIT( KOnline, "hs_online" ); |
378 _LIT( KOffline, "hs_offline" ); |
344 _LIT( KOffline, "hs_offline" ); |
379 |
345 |
380 TBool retval( EFalse ); |
346 TBool retval( EFalse ); |
381 |
347 |
404 return retval; |
370 return retval; |
405 } |
371 } |
406 |
372 |
407 // ---------------------------------------------------------------------------- |
373 // ---------------------------------------------------------------------------- |
408 // CAppUi::SetOnlineStateL() |
374 // CAppUi::SetOnlineStateL() |
409 // Called always by view manager when view is activated. |
|
410 // ---------------------------------------------------------------------------- |
|
411 // |
|
412 void CAppUi::SetOnlineStateL( RPointerArray< CXnNodeAppIf >& aList ) |
|
413 { |
|
414 iHelper->ProcessOnlineStateL( aList ); |
|
415 } |
|
416 |
|
417 // ---------------------------------------------------------------------------- |
|
418 // CAppUi::SetOnlineL() |
|
419 // Called always when user changed HS online/offline status from option menu. |
375 // Called always when user changed HS online/offline status from option menu. |
420 // ---------------------------------------------------------------------------- |
376 // ---------------------------------------------------------------------------- |
421 // |
377 // |
422 void CAppUi::SetOnlineStateL( TBool aOnline ) |
378 void CAppUi::SetOnlineStateL( TBool aOnline ) |
423 { |
379 { |
424 iHelper->ProcessOnlineStateL( aOnline ); |
380 if ( !iUiShutdown ) |
|
381 { |
|
382 iHelper->ProcessOnlineStateL( aOnline ); |
|
383 } |
|
384 } |
|
385 |
|
386 // ---------------------------------------------------------------------------- |
|
387 // CAppUi::UiController() |
|
388 // ---------------------------------------------------------------------------- |
|
389 // |
|
390 CXmlUiController& CAppUi::UiController() const |
|
391 { |
|
392 return iUiCtl; |
|
393 } |
|
394 |
|
395 // ---------------------------------------------------------------------------- |
|
396 // CAppUi::Helper() |
|
397 // ---------------------------------------------------------------------------- |
|
398 // |
|
399 COnlineOfflineHelper* CAppUi::Helper() const |
|
400 { |
|
401 return iHelper; |
|
402 } |
|
403 |
|
404 // ---------------------------------------------------------------------------- |
|
405 // CAppUi::HandleEnterEditModeL() |
|
406 // ---------------------------------------------------------------------------- |
|
407 // |
|
408 void CAppUi::HandleEnterEditModeL( TBool aEnter ) |
|
409 { |
|
410 if ( iInEditMode != aEnter ) |
|
411 { |
|
412 if ( aEnter ) |
|
413 { |
|
414 iUiCtl.FwEventHandler()->SuspendContent( |
|
415 iDeviceStatusInfo, KNetworkIdentity ); |
|
416 } |
|
417 else |
|
418 { |
|
419 iUiCtl.FwEventHandler()->RefreshContent( |
|
420 iDeviceStatusInfo, KNetworkIdentity ); |
|
421 } |
|
422 |
|
423 iInEditMode = aEnter; |
|
424 } |
425 } |
425 } |
426 |
426 |
427 // ---------------------------------------------------------------------------- |
427 // ---------------------------------------------------------------------------- |
428 // CAppUi::HandleViewActivation() |
428 // CAppUi::HandleViewActivation() |
429 // ---------------------------------------------------------------------------- |
429 // ---------------------------------------------------------------------------- |
430 // |
430 // |
431 void CAppUi::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
431 void CAppUi::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
432 const TVwsViewId& aViewIdToBeDeactivated ) |
432 const TVwsViewId& aViewIdToBeDeactivated ) |
433 { |
433 { |
434 if ( iIsEditModeActive ) |
434 TVwsViewId activeViewId; |
|
435 |
|
436 TInt err( GetActiveViewId( activeViewId ) ); |
|
437 |
|
438 if ( iInEditMode || err == KErrNotFound ) |
435 { |
439 { |
436 return; |
440 return; |
437 } |
441 } |
438 |
442 |
439 // Get Xml Ui view id |
443 // Get Xml Ui view id |
440 TVwsViewId viewId( View().ViewId() ); |
444 TVwsViewId xmlViewId( View().ViewId() ); |
441 |
445 |
442 if ( viewId == aNewlyActivatedViewId ) |
446 if ( xmlViewId == aNewlyActivatedViewId && activeViewId != xmlViewId ) |
443 { |
447 { |
444 // Xml Ui view became active |
448 // Xml Ui view became active |
445 TRAP_IGNORE( LoadNativeDataPluginsL() ); |
449 iUiCtl.FwEventHandler()->RefreshContent( |
446 } |
450 iDeviceStatusInfo, KNetworkIdentity ); |
447 else if ( viewId == aViewIdToBeDeactivated ) |
451 } |
448 { |
452 else if ( xmlViewId == aViewIdToBeDeactivated && activeViewId == xmlViewId ) |
449 // Xml Ui view became inactive |
453 { |
450 TRAP_IGNORE( DestroyNativeDataPluginsL() ); |
454 // Xml Ui view became inactive |
451 } |
455 iUiCtl.FwEventHandler()->SuspendContent( |
452 } |
456 iDeviceStatusInfo, KNetworkIdentity ); |
453 |
457 } |
454 // ---------------------------------------------------------------------------- |
458 } |
455 // CAppUi::UiController() |
|
456 // ---------------------------------------------------------------------------- |
|
457 // |
|
458 CXmlUiController& CAppUi::UiController() const |
|
459 { |
|
460 return iUiCtl; |
|
461 } |
|
462 |
|
463 // ---------------------------------------------------------------------------- |
|
464 // CAppUi::HandlePageSwitch() |
|
465 // ---------------------------------------------------------------------------- |
|
466 // |
|
467 void CAppUi::HandlePageSwitch() |
|
468 { |
|
469 iUiCtl.FwEventHandler()->ProcessStateChange( EAifwPageSwitch ); |
|
470 } |
|
471 |
|
472 // ---------------------------------------------------------------------------- |
|
473 // CAppUi::HandleEnterEditModeL() |
|
474 // ---------------------------------------------------------------------------- |
|
475 // |
|
476 void CAppUi::HandleEnterEditModeL( TBool aEnter ) |
|
477 { |
|
478 if ( aEnter ) |
|
479 { |
|
480 DestroyNativeDataPluginsL(); |
|
481 iIsEditModeActive = ETrue; |
|
482 } |
|
483 else |
|
484 { |
|
485 LoadNativeDataPluginsL(); |
|
486 iIsEditModeActive = EFalse; |
|
487 } |
|
488 } |
|
489 |
459 |
490 // End of File. |
460 // End of File. |