42 |
46 |
43 #include "aicontentmodel.h" |
47 #include "aicontentmodel.h" |
44 #include "aiuiidleintegration.h" |
48 #include "aiuiidleintegration.h" |
45 #include "xmluicontrollerpanic.h" |
49 #include "xmluicontrollerpanic.h" |
46 |
50 |
47 #include "debug.h" |
|
48 #include "ai3perf.h" |
|
49 #include "xndomnode.h" |
51 #include "xndomnode.h" |
50 #include "xnproperty.h" |
52 #include "xnproperty.h" |
51 #include "xnuiengineappif.h" |
53 #include "xnuiengineappif.h" |
52 #include "onlineofflinehelper.h" |
54 #include "onlineofflinehelper.h" |
53 #include "ainativeuiplugins.h" |
55 #include "ainativeuiplugins.h" |
54 |
56 |
|
57 #include "debug.h" |
|
58 |
55 // Constants |
59 // Constants |
56 // EAiDeviceStatusContentNetworkIdentity content id |
60 // EAiDeviceStatusContentNetworkIdentity content id |
57 _LIT( KNetworkIdentity, "NetworkIdentity" ); |
61 _LIT( KNetworkIdentity, "NetworkIdentity" ); |
|
62 const TUid KVoiceUiUID = { 0x101F8543 }; |
58 |
63 |
59 using namespace AiXmlUiController; |
64 using namespace AiXmlUiController; |
60 |
65 |
61 // ======== MEMBER FUNCTIONS ======== |
66 // ======== MEMBER FUNCTIONS ======== |
62 |
67 |
73 // CAppUi::ConstructL() |
78 // CAppUi::ConstructL() |
74 // ---------------------------------------------------------------------------- |
79 // ---------------------------------------------------------------------------- |
75 // |
80 // |
76 void CAppUi::ConstructL() |
81 void CAppUi::ConstructL() |
77 { |
82 { |
78 AI3_PERF_START(perfdata, "xmluicontroller: CAppUi::ConstructL") |
83 __TICK( "CAppUi::ConstructL" ); |
79 |
84 |
80 // Always reset the phoneforward P&S key on startup just in case |
85 // Always reset the phoneforward P&S key on startup just in case |
81 RProperty::Set( KPSUidAiInformation, |
86 RProperty::Set( KPSUidAiInformation, |
82 KActiveIdleForwardNumericKeysToPhone, EPSAiForwardNumericKeysToPhone ); |
87 KActiveIdleForwardNumericKeysToPhone, EPSAiForwardNumericKeysToPhone ); |
83 |
88 |
|
89 iEditModeTitle = StringLoader::LoadL( R_QTN_HS_TITLE_EDITMODE ); |
|
90 |
84 // Initialize with empty title pane so it's not shown on startup. |
91 // Initialize with empty title pane so it's not shown on startup. |
85 __HEAP("XML UI: Init - Construct App UI") |
92 __HEAP("XML UI: Init - Construct App UI") |
86 __TIME("XML UI: XnAppUiAdapted::ConstructL", |
93 __TIME("XML UI: CXnAppUiAdapter::ConstructL", |
87 CXnAppUiAdapter::ConstructL(); |
94 CXnAppUiAdapter::ConstructL(); |
88 ) |
95 ) |
89 |
96 |
|
97 CAknAppUiBase::SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | |
|
98 CAknAppUiBase::EDisableSendKeyLong ); |
|
99 |
90 // Register for XML UI view activation & deactivation |
100 // Register for XML UI view activation & deactivation |
91 AddViewActivationObserverL( this ); |
101 AddViewActivationObserverL( this ); |
92 |
102 |
93 // Disable CCoeEnv exit checks. |
103 // Disable CCoeEnv exit checks. |
94 // Active Idle Framework will perform the checks. |
104 // Active Idle Framework will perform the checks. |
112 |
122 |
113 TAiIdleKeySoundConfig keySoundConfig; |
123 TAiIdleKeySoundConfig keySoundConfig; |
114 keySoundConfig.iKeySounds = KeySounds(); |
124 keySoundConfig.iKeySounds = KeySounds(); |
115 keySoundConfig.iContextResId = R_XUI_DEFAULT_SKEY_LIST; |
125 keySoundConfig.iContextResId = R_XUI_DEFAULT_SKEY_LIST; |
116 |
126 |
|
127 iUiCtl.NotifyAppEnvReadyL(); |
|
128 |
|
129 iHelper = COnlineOfflineHelper::NewL( iUiCtl ); |
|
130 |
117 iIdleIntegration = CAiUiIdleIntegration::NewL |
131 iIdleIntegration = CAiUiIdleIntegration::NewL |
118 ( *iEikonEnv, keySoundConfig, iUiCtl.FwEventHandler() ); |
132 ( *iEikonEnv, keySoundConfig, iUiCtl.FwEventHandler() ); |
119 |
133 |
120 iUiCtl.NotifyAppEnvReadyL(); |
134 __TICK( "CAppUi::ConstructL - done" ); |
121 |
|
122 CAknAppUiBase::SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | |
|
123 CAknAppUiBase::EDisableSendKeyLong ); |
|
124 |
|
125 iHelper = COnlineOfflineHelper::NewL( iUiCtl ); |
|
126 |
|
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 |
|
134 __HEAP("XML UI: Done - Construct App UI"); |
|
135 |
|
136 AI3_PERF_STOP(perfdata, "xmluicontroller: CAppUi::ConstructL") |
|
137 } |
135 } |
138 |
136 |
139 // ---------------------------------------------------------------------------- |
137 // ---------------------------------------------------------------------------- |
140 // CAppUi::NewL() |
138 // CAppUi::NewL() |
141 // ---------------------------------------------------------------------------- |
139 // ---------------------------------------------------------------------------- |
153 // CAppUi::~CAppUi() |
151 // CAppUi::~CAppUi() |
154 // ---------------------------------------------------------------------------- |
152 // ---------------------------------------------------------------------------- |
155 // |
153 // |
156 CAppUi::~CAppUi() |
154 CAppUi::~CAppUi() |
157 { |
155 { |
|
156 delete iEditModeTitle; |
|
157 delete iKeyTimer; |
158 delete iHelper; |
158 delete iHelper; |
159 delete iEventHandler; |
159 delete iEventHandler; |
160 delete iContentRenderer; |
160 delete iContentRenderer; |
161 delete iIdleIntegration; |
161 delete iIdleIntegration; |
162 } |
162 } |
163 |
163 |
164 // ---------------------------------------------------------------------------- |
164 // ---------------------------------------------------------------------------- |
|
165 // CAppUi::ActivateUi() |
|
166 // ---------------------------------------------------------------------------- |
|
167 // |
|
168 void CAppUi::ActivateUi() |
|
169 { |
|
170 __TICK( "CAppUi::ActivateUi" ); |
|
171 |
|
172 TVwsViewId activeViewId; |
|
173 |
|
174 TInt err( GetActiveViewId( activeViewId ) ); |
|
175 |
|
176 if ( err == KErrNotFound ) |
|
177 { |
|
178 // Get Xml Ui view id |
|
179 TVwsViewId xmlViewId( View().ViewId() ); |
|
180 |
|
181 TRAP_IGNORE( ActivateLocalViewL( xmlViewId.iViewUid ) ); |
|
182 } |
|
183 |
|
184 if ( iDeviceStatusInfo.Uid() == TUid::Null() ) |
|
185 { |
|
186 __PRINTS( "*** CAppUi::ActivateUI - Loading DeviceStatus plugin" ); |
|
187 |
|
188 _LIT8( KNs, "namespace" ); |
|
189 |
|
190 // Load device status plugin here because it is always needed |
|
191 iDeviceStatusInfo = THsPublisherInfo( KDeviceStatusPluginUid, |
|
192 KDeviceStatusPluginName, KNs ); |
|
193 |
|
194 iUiCtl.FwStateHandler()->LoadPlugin( |
|
195 iDeviceStatusInfo, EAiFwSystemStartup ); |
|
196 } |
|
197 |
|
198 iUiCtl.FwEventHandler()->HandleUiReadyEventL( iUiCtl ); |
|
199 |
|
200 __PRINTS( "*** CAppUi::ActivateUi - done" ); |
|
201 } |
|
202 |
|
203 // ---------------------------------------------------------------------------- |
165 // CAppUi::PrepareToExit() |
204 // CAppUi::PrepareToExit() |
166 // ---------------------------------------------------------------------------- |
205 // ---------------------------------------------------------------------------- |
167 // |
206 // |
168 void CAppUi::PrepareToExit() |
207 void CAppUi::PrepareToExit() |
169 { |
208 { |
170 iUiShutdown = ETrue; |
|
171 |
|
172 RemoveViewActivationObserver( this ); |
209 RemoveViewActivationObserver( this ); |
173 |
210 |
174 iUiCtl.FwEventHandler()->HandleUiShutdown( iUiCtl ); |
211 iUiCtl.FwEventHandler()->HandleUiShutdown( iUiCtl ); |
175 |
212 |
176 CXnAppUiAdapter::PrepareToExit(); |
213 CXnAppUiAdapter::PrepareToExit(); |
224 else |
261 else |
225 { |
262 { |
226 TKeyEvent key; |
263 TKeyEvent key; |
227 |
264 |
228 key.iScanCode = EStdKeyNo; |
265 key.iScanCode = EStdKeyNo; |
229 key.iCode = EStdKeyNull; |
266 key.iCode = EKeyNull; |
230 key.iModifiers = 0; |
267 key.iModifiers = 0; |
231 key.iRepeats = 0; |
268 key.iRepeats = 0; |
232 |
269 |
233 iCoeEnv->SimulateKeyEventL( key, EEventKey ); |
270 iCoeEnv->SimulateKeyEventL( key, EEventKey ); |
234 } |
271 } |
|
272 } |
|
273 |
|
274 if( aEvent.Type() == EEventKeyDown ) |
|
275 { |
|
276 if( aEvent.Key()->iScanCode == EStdKeyYes ) |
|
277 { |
|
278 // Send key was pushed and long press recognition is started |
|
279 StartKeyTimerL(); |
|
280 } |
|
281 } |
|
282 |
|
283 if( aEvent.Type() == EEventKeyUp ) |
|
284 { |
|
285 if( aEvent.Key()->iScanCode == EStdKeyYes ) |
|
286 { |
|
287 if( iKeyTimer && iKeyTimer->IsActive() ) |
|
288 { |
|
289 // up event is coming before long press of Send key is recognized |
|
290 // Start dialled calls |
|
291 StopKeyTimer(); |
|
292 LogsUiCmdStarter::CmdStartL( LogsUiCmdStarterConsts::KDialledView() ); |
|
293 } |
|
294 } |
235 } |
295 } |
236 |
296 |
237 if( iIdleIntegration ) |
297 if( iIdleIntegration ) |
238 { |
298 { |
239 // Forward window server events first to idle integration library |
299 // Forward window server events first to idle integration library |
407 // |
446 // |
408 void CAppUi::HandleEnterEditModeL( TBool aEnter ) |
447 void CAppUi::HandleEnterEditModeL( TBool aEnter ) |
409 { |
448 { |
410 if ( iInEditMode != aEnter ) |
449 if ( iInEditMode != aEnter ) |
411 { |
450 { |
|
451 TVwsViewId activeViewId; |
|
452 TInt err( GetActiveViewId( activeViewId ) ); |
|
453 |
412 if ( aEnter ) |
454 if ( aEnter ) |
413 { |
455 { |
414 iUiCtl.FwEventHandler()->SuspendContent( |
456 iUiCtl.FwEventHandler()->SuspendContent( |
415 iDeviceStatusInfo, KNetworkIdentity ); |
457 iDeviceStatusInfo, KNetworkIdentity ); |
|
458 |
|
459 if ( !err && View().ViewId() == activeViewId ) |
|
460 { |
|
461 SetTitlePaneTextL( *iEditModeTitle ); |
|
462 } |
416 } |
463 } |
417 else |
464 else |
418 { |
465 { |
|
466 if ( !err && View().ViewId() == activeViewId ) |
|
467 { |
|
468 SetTitlePaneTextL( KNullDesC ); |
|
469 } |
|
470 |
419 iUiCtl.FwEventHandler()->RefreshContent( |
471 iUiCtl.FwEventHandler()->RefreshContent( |
420 iDeviceStatusInfo, KNetworkIdentity ); |
472 iDeviceStatusInfo, KNetworkIdentity ); |
421 } |
473 } |
422 |
474 |
423 iInEditMode = aEnter; |
475 iInEditMode = aEnter; |
433 { |
485 { |
434 TVwsViewId activeViewId; |
486 TVwsViewId activeViewId; |
435 |
487 |
436 TInt err( GetActiveViewId( activeViewId ) ); |
488 TInt err( GetActiveViewId( activeViewId ) ); |
437 |
489 |
438 if ( iInEditMode || err == KErrNotFound ) |
490 if ( err == KErrNotFound ) |
439 { |
491 { |
440 return; |
492 return; |
441 } |
493 } |
442 |
494 |
443 // Get Xml Ui view id |
495 // Get Xml Ui view id |
444 TVwsViewId xmlViewId( View().ViewId() ); |
496 TVwsViewId xmlViewId( View().ViewId() ); |
445 |
497 |
446 if ( xmlViewId == aNewlyActivatedViewId && activeViewId != xmlViewId ) |
498 if ( xmlViewId == aNewlyActivatedViewId && activeViewId != xmlViewId ) |
447 { |
499 { |
448 // Xml Ui view became active |
500 if ( iInEditMode ) |
449 iUiCtl.FwEventHandler()->RefreshContent( |
501 { |
450 iDeviceStatusInfo, KNetworkIdentity ); |
502 TRAP_IGNORE( SetTitlePaneTextL( *iEditModeTitle ) ); |
451 } |
503 } |
|
504 else |
|
505 { |
|
506 // Xml Ui view became active |
|
507 iUiCtl.FwEventHandler()->RefreshContent( |
|
508 iDeviceStatusInfo, KNetworkIdentity ); |
|
509 } |
|
510 } |
452 else if ( xmlViewId == aViewIdToBeDeactivated && activeViewId == xmlViewId ) |
511 else if ( xmlViewId == aViewIdToBeDeactivated && activeViewId == xmlViewId ) |
453 { |
512 { |
454 // Xml Ui view became inactive |
513 if ( iInEditMode ) |
455 iUiCtl.FwEventHandler()->SuspendContent( |
514 { |
456 iDeviceStatusInfo, KNetworkIdentity ); |
515 TRAP_IGNORE( SetTitlePaneTextL( KNullDesC ) ); |
457 } |
516 } |
458 } |
517 else |
|
518 { |
|
519 // Xml Ui view became inactive |
|
520 iUiCtl.FwEventHandler()->SuspendContent( |
|
521 iDeviceStatusInfo, KNetworkIdentity ); |
|
522 } |
|
523 } |
|
524 } |
|
525 |
|
526 // ---------------------------------------------------------------------------- |
|
527 // CAppUi::StartKeyTimerL() |
|
528 // Starts long press recognizer of Send key. |
|
529 // ---------------------------------------------------------------------------- |
|
530 // |
|
531 void CAppUi::StartKeyTimerL() |
|
532 { |
|
533 if ( !iKeyTimer ) |
|
534 { |
|
535 iKeyTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
536 } |
|
537 else if ( iKeyTimer->IsActive() ) |
|
538 { |
|
539 iKeyTimer->Cancel(); |
|
540 } |
|
541 iKeyTimer->Start( KAknKeyboardRepeatInitialDelay, |
|
542 KAknKeyboardRepeatInitialDelay, |
|
543 TCallBack ( ReportLongPressL, this ) ); |
|
544 } |
|
545 |
|
546 // ---------------------------------------------------------------------------- |
|
547 // CAppUi::StopKeyTimer() |
|
548 // Stops Send key long press recognizer. |
|
549 // ---------------------------------------------------------------------------- |
|
550 // |
|
551 void CAppUi::StopKeyTimer() |
|
552 { |
|
553 if ( iKeyTimer && iKeyTimer->IsActive() ) |
|
554 { |
|
555 iKeyTimer->Cancel(); |
|
556 } |
|
557 } |
|
558 |
|
559 // ---------------------------------------------------------------------------- |
|
560 // CAppUi::HandleViewActivation() |
|
561 // Launches Voice command application after long Send key is pressed. |
|
562 // ---------------------------------------------------------------------------- |
|
563 // |
|
564 void CAppUi::LaunchVoiceCommandL() |
|
565 { |
|
566 TApaTaskList apaTaskList( iCoeEnv->WsSession() ); |
|
567 TApaTask apaTask = apaTaskList.FindApp( KVoiceUiUID ); |
|
568 |
|
569 if ( apaTask.Exists() ) |
|
570 { |
|
571 apaTask.BringToForeground(); |
|
572 } |
|
573 else |
|
574 { |
|
575 RApaLsSession apaLsSession; |
|
576 User::LeaveIfError( apaLsSession.Connect() ); |
|
577 CleanupClosePushL( apaLsSession ); |
|
578 |
|
579 TApaAppInfo appInfo; |
|
580 |
|
581 if( apaLsSession.GetAppInfo( appInfo, KVoiceUiUID ) == KErrNone ) |
|
582 { |
|
583 CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); |
|
584 cmdLine->SetExecutableNameL( appInfo.iFullName ); |
|
585 cmdLine->SetCommandL( EApaCommandRun ); |
|
586 User::LeaveIfError( apaLsSession.StartApp( *cmdLine ) ); |
|
587 CleanupStack::PopAndDestroy( cmdLine ); |
|
588 } |
|
589 CleanupStack::PopAndDestroy( &apaLsSession ); |
|
590 } |
|
591 } |
|
592 |
|
593 // ---------------------------------------------------------------------------- |
|
594 // CAppUi::ReportLongPressL() |
|
595 // Callback function for long press timer of the Send key. |
|
596 // ---------------------------------------------------------------------------- |
|
597 // |
|
598 TInt CAppUi::ReportLongPressL( TAny* aThis ) |
|
599 { |
|
600 CAppUi* self = reinterpret_cast <CAppUi* > ( aThis ); |
|
601 |
|
602 self->StopKeyTimer(); |
|
603 |
|
604 if ( iAvkonAppUi->IsForeground() ) |
|
605 { |
|
606 self->LaunchVoiceCommandL(); |
|
607 } |
|
608 |
|
609 return 1; // CPeriodic ignores return value |
|
610 } |
|
611 |
|
612 // ---------------------------------------------------------------------------- |
|
613 // CAppUi::SetTitlePaneTextL() |
|
614 // |
|
615 // ---------------------------------------------------------------------------- |
|
616 // |
|
617 void CAppUi::SetTitlePaneTextL( const TDesC& aText ) |
|
618 { |
|
619 CEikStatusPane* sp( StatusPane() ); |
|
620 |
|
621 TUid titlePaneUid( TUid::Uid( EEikStatusPaneUidTitle ) ); |
|
622 |
|
623 CEikStatusPaneBase::TPaneCapabilities subPaneTitle( |
|
624 sp->PaneCapabilities( titlePaneUid ) ); |
|
625 |
|
626 if ( subPaneTitle.IsPresent() && subPaneTitle.IsAppOwned() ) |
|
627 { |
|
628 CAknTitlePane* title = |
|
629 static_cast< CAknTitlePane* >( sp->ControlL( titlePaneUid ) ); |
|
630 |
|
631 if ( title ) |
|
632 { |
|
633 title->SetTextL( aText ); |
|
634 } |
|
635 } |
|
636 } |
459 |
637 |
460 // End of File. |
638 // End of File. |