idlehomescreen/nativeuicontroller/src/appui.cpp
changeset 0 f72a12da539e
child 9 f966699dea19
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "appui.h"
       
    20 #include "ainativeui.hrh"
       
    21 #include "ainativeuistrings.h" // string literals
       
    22 #include "ainativeuiview.h"
       
    23 #include "application.h"
       
    24 #include "nativeuicontroller.h"
       
    25 #include "aiuiframeworkobserver.h"
       
    26 #include "aifweventhandler.h"
       
    27 #include <AiNativeUi.rsg>
       
    28 
       
    29 #include "aipropertyextension.h"
       
    30 #include "aicontentmodel.h"
       
    31 #include "aiuiidleintegration.h"
       
    32 #include "activeidle2domaincrkeys.h"
       
    33 #include "activeidle2domainpskeys.h"
       
    34 #include "extrstandbycontainerif.h"
       
    35 #include "debug.h"
       
    36 
       
    37 #include <startupdomainpskeys.h>
       
    38 #include <aipspropertyobserver.h>
       
    39 #include <centralrepository.h>
       
    40 #include <e32base.h>
       
    41 #include <e32property.h>
       
    42 #include <avkon.rsg>                    // for status pane layout resource ids
       
    43 #include <eikon.hrh>
       
    44 #include <bautils.h>
       
    45 #include <ecom/implementationproxy.h>
       
    46 #include <data_caging_path_literals.hrh>
       
    47 #include <ConeResLoader.h>
       
    48 #include <featmgr.h>
       
    49 #include <avkondomainpskeys.h>
       
    50 #include <AknUtils.h>
       
    51 #include <layoutmetadata.cdl.h>
       
    52 #include <aknlayoutscalable_avkon.cdl.h>
       
    53 
       
    54 namespace
       
    55     {
       
    56     _LIT( KResourceDrive, "Z:" );
       
    57     _LIT( KResourceFile, "ainativeui.rsc" );
       
    58     #define KResourcePath KDC_APP_RESOURCE_DIR
       
    59 
       
    60     const TInt KDefaultStatusPaneLayout = R_AVKON_STATUS_PANE_LAYOUT_IDLE;
       
    61 
       
    62     //
       
    63     // Get status pane configuration from cenrep
       
    64     //
       
    65     TInt GetLayoutCenrep()
       
    66         {
       
    67         TInt value = EAiStatusPaneLayoutIdleNormal;
       
    68         TUid uid = { KCRUidActiveIdleLV };
       
    69         CRepository* cenRep = CRepository::NewLC( uid );
       
    70         cenRep->Get( KAiStatusPaneLayout, value );
       
    71         CleanupStack::PopAndDestroy( cenRep );
       
    72         return value;
       
    73         }
       
    74 
       
    75     //
       
    76     // Resolves status pane layout for CXnAppUiAdapter::ConstructL()
       
    77     //
       
    78     TInt StatusPaneLayoutResourceIdL( TInt aLayoutId )
       
    79         {
       
    80         TInt layout = aLayoutId;
       
    81         switch( aLayoutId )
       
    82             {
       
    83             case EAiStatusPaneLayoutIdleNormal:
       
    84                 {
       
    85                 layout = R_AVKON_STATUS_PANE_LAYOUT_IDLE;
       
    86                 break;
       
    87                 }
       
    88             case EAiStatusPaneLayoutIdleFlat:
       
    89                 {
       
    90                 layout = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
       
    91                 break;
       
    92                 }
       
    93             case EAiStatusPaneLayoutIdleHidden:
       
    94                 {
       
    95                 layout = KDefaultStatusPaneLayout;
       
    96                 break;
       
    97                 }
       
    98             default:
       
    99                 {
       
   100                 break;
       
   101                 }
       
   102             }
       
   103         return layout;
       
   104         }
       
   105     
       
   106     // -----------------------------------------------------------------------------
       
   107     // 
       
   108     // Calculate touch sensitive softkey area for Top button (landscape)
       
   109     // -----------------------------------------------------------------------------         
       
   110     TRect SoftkeyRectTopTouch()
       
   111         {
       
   112         TRect screen;
       
   113         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
       
   114 
       
   115         TAknLayoutRect layoutRect;
       
   116 
       
   117         TAknWindowComponentLayout rightAreaLayout(
       
   118                 AknLayoutScalable_Avkon::area_side_right_pane( 0 ) );
       
   119 
       
   120 
       
   121         layoutRect.LayoutRect( screen, TAknWindowComponentLayout::Compose( rightAreaLayout,
       
   122                 AknLayoutScalable_Avkon::sctrl_sk_top_pane() ).LayoutLine() );
       
   123         TRect topSKRect( layoutRect.Rect() );
       
   124         
       
   125         layoutRect.LayoutRect( topSKRect, 
       
   126                         AknLayoutScalable_Avkon::aid_touch_sctrl_top().LayoutLine() );
       
   127         return layoutRect.Rect();
       
   128         }
       
   129 
       
   130     // -----------------------------------------------------------------------------
       
   131     // 
       
   132     // Calculate touch sensitive softkey area for right button (portrait)
       
   133     // -----------------------------------------------------------------------------         
       
   134     TRect SoftkeyRectRightTouch()
       
   135         {
       
   136         TRect screen;
       
   137         AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EScreen, screen );
       
   138 
       
   139         TAknLayoutRect layoutRect;
       
   140 
       
   141         TAknWindowComponentLayout bottomAreaLayout(
       
   142                 AknLayoutScalable_Avkon::area_bottom_pane( 0 ) );
       
   143 
       
   144 
       
   145         layoutRect.LayoutRect( screen, TAknWindowComponentLayout::Compose( bottomAreaLayout,
       
   146                 AknLayoutScalable_Avkon::control_bg_pane() ).LayoutLine() );
       
   147         TRect rightSKRect( layoutRect.Rect() );
       
   148         layoutRect.LayoutRect(
       
   149                 rightSKRect,
       
   150                 AknLayoutScalable_Avkon::aid_touch_ctrl_right().LayoutLine() );
       
   151         return layoutRect.Rect();
       
   152         }
       
   153 
       
   154     
       
   155     }
       
   156 
       
   157 using namespace AiNativeUiController;
       
   158 
       
   159 // ========== MEMBER FUNCTIONS ================================================
       
   160 
       
   161 CAppUi::CAppUi(CNativeUiController* aUiCtl)
       
   162     : iUiCtl(aUiCtl)
       
   163     {
       
   164     }
       
   165 
       
   166 void CAppUi::ConstructL()
       
   167     {
       
   168     BaseConstructL(EAknEnableSkin|EAknEnableMSK/*|ENoAppResourceFile*/);
       
   169 
       
   170     // Disable CCoeEnv exit checks.
       
   171     // Active Idle Framework will perform the checks.
       
   172     iCoeEnv->DisableExitChecks(ETrue);
       
   173 
       
   174     if( !iResourceLoader )
       
   175         {
       
   176         iResourceLoader = new(ELeave) RConeResourceLoader( *iCoeEnv );
       
   177 
       
   178         // 1) Load resources file for resource publishing
       
   179         TFullName resourceFile( KResourceDrive );
       
   180         resourceFile.Append( KResourcePath );
       
   181         resourceFile.Append( KResourceFile );
       
   182         BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), resourceFile );
       
   183 
       
   184         iResourceLoader->OpenL( resourceFile );
       
   185         }
       
   186 
       
   187     iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
   188 
       
   189     if( !iUiCtl )
       
   190         {
       
   191         User::Leave(KErrNotFound);
       
   192         return; // for lint
       
   193         }
       
   194 
       
   195     iFwEventHandler = iUiCtl->FwEventHandler();
       
   196 
       
   197     iUiFwObserver = iUiCtl->UiFrameworkObserver();
       
   198 
       
   199     TAiIdleKeySoundConfig keySoundConfig;
       
   200     keySoundConfig.iKeySounds = KeySounds();
       
   201     keySoundConfig.iContextResId = R_NATIVEUI_DEFAULT_SKEY_LIST;
       
   202     iIdleIntegration = CAiUiIdleIntegration::NewL
       
   203         ( *iEikonEnv, keySoundConfig, iFwEventHandler );
       
   204 
       
   205     iUiCtl->SetAppUi( this );
       
   206 
       
   207     if( iFwEventHandler )
       
   208         {
       
   209         iFwEventHandler->AppEnvReadyL();
       
   210         }
       
   211     TBool isFullScreen = EFalse;
       
   212     //Get pointer to status pane
       
   213     CEikStatusPane* statusPane = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() )->StatusPane();
       
   214     if( statusPane )
       
   215         {
       
   216         // Update status pane layout ot the correct one.
       
   217         TInt statusPaneLayout = GetLayoutCenrep();
       
   218         iCurrentStatusPaneLayout = StatusPaneLayoutResourceIdL( statusPaneLayout );
       
   219 
       
   220         TInt id = statusPane->CurrentLayoutResId();
       
   221         if( id != iCurrentStatusPaneLayout &&
       
   222             id != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT )
       
   223             {
       
   224             statusPane->SwitchLayoutL( iCurrentStatusPaneLayout );
       
   225             }
       
   226         else
       
   227             {
       
   228             iCurrentStatusPaneLayout = id;
       
   229             }
       
   230 
       
   231         if( statusPaneLayout == EAiStatusPaneLayoutIdleHidden &&
       
   232             iCurrentStatusPaneLayout != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT  )
       
   233             {
       
   234             statusPane->MakeVisible( EFalse );
       
   235             isFullScreen = ETrue;
       
   236             }
       
   237         else
       
   238             {
       
   239             statusPane->MakeVisible( ETrue );
       
   240             }
       
   241         statusPane->ApplyCurrentSettingsL();
       
   242         statusPane->DrawNow();
       
   243         }
       
   244 
       
   245     iAppView = CAiNativeUiView::NewL( ClientRect(), this );
       
   246     iAppView->SetMopParent(this);
       
   247     RegisterViewL( *iAppView );
       
   248     AddToStackL( iAppView );
       
   249     
       
   250     // Reset softkey locked indications. Error may be ignored - not defined would be typical.
       
   251     RProperty::Define( KPSUidAiInformation, KActiveIdleExtHS_LSKLocked, RProperty::EText );
       
   252     RProperty::Set( KPSUidAiInformation, KActiveIdleExtHS_LSKLocked, KNullDesC );
       
   253     RProperty::Define( KPSUidAiInformation, KActiveIdleExtHS_RSKLocked, RProperty::EText );
       
   254     RProperty::Set( KPSUidAiInformation, KActiveIdleExtHS_RSKLocked, KNullDesC );
       
   255     RProperty::Define( KPSUidAiInformation, KActiveIdleExtHS_PluginConfChange, RProperty::EInt );
       
   256     RProperty::Set( KPSUidAiInformation, KActiveIdleExtHS_PluginConfChange, 0 );
       
   257     
       
   258     const TUid KCAIPluginContainerImplementationUid = { 0x101FD658 };
       
   259 
       
   260     iStanbyContainerIF = CExtrStandbyContainerIF::NewL( KCAIPluginContainerImplementationUid,
       
   261                                          iAppView );
       
   262     iStanbyContainerIF->SetRect( ClientRect() );
       
   263     iStanbyContainerIF->SetFullScreenMode( isFullScreen );
       
   264     iAppView->SetControl( iStanbyContainerIF );
       
   265 
       
   266     iAIRepository = CRepository::NewL( TUid::Uid( KCRUidActiveIdleLV ) );
       
   267     // CenRep notifier to listen statuspane key changes in cenrep.
       
   268     iNotifyHandler = CCenRepNotifyHandler::NewL( *this,
       
   269                                                  *iAIRepository,
       
   270                                                  CCenRepNotifyHandler::EIntKey,
       
   271                                                  KAiStatusPaneLayout );
       
   272     iNotifyHandler->StartListeningL();
       
   273 
       
   274     if( iFwEventHandler )
       
   275         {
       
   276         iFwEventHandler->HandleUiReadyEventL(*iUiCtl);
       
   277         }
       
   278 
       
   279     // Check powerkey availability
       
   280     FeatureManager::InitializeLibL();
       
   281     iFeatureNoPowerKey =
       
   282         FeatureManager::FeatureSupported( KFeatureIdNoPowerkey );
       
   283     FeatureManager::UnInitializeLib();
       
   284 
       
   285     if(iFeatureNoPowerKey)
       
   286         {
       
   287         iPowerkeyStatusObserver = AiUtility::CreatePSPropertyObserverL(
       
   288                                     TCallBack( HandlePowerkeyEvent, this ),
       
   289                                     KPSUidAvkonDomain,
       
   290                                     KAknEndKeyEvent );
       
   291         }
       
   292 
       
   293     CAknAppUiBase::SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort |
       
   294                                      CAknAppUiBase::EDisableSendKeyLong );
       
   295     }
       
   296 
       
   297 CAppUi* CAppUi::NewL(CNativeUiController* aUiCtl)
       
   298     {
       
   299     CAppUi* self = new (ELeave) CAppUi(aUiCtl );
       
   300 
       
   301     // ConstructL is called by the UI framework
       
   302 
       
   303     return self;
       
   304     }
       
   305 
       
   306 CAppUi::~CAppUi()
       
   307     {
       
   308     Release( iPowerkeyStatusObserver );
       
   309     delete iTimer;
       
   310     delete iNotifyHandler;
       
   311     delete iAIRepository;
       
   312     delete iStanbyContainerIF;
       
   313     delete iIdleIntegration;
       
   314     TRAP_IGNORE( DeactivateActiveViewL() );
       
   315     if( iAppView )
       
   316         {
       
   317         DeregisterView( *iAppView );
       
   318         RemoveFromStack( iAppView );
       
   319         delete iAppView;
       
   320         }
       
   321     if( iResourceLoader )
       
   322         {
       
   323         iResourceLoader->Close();
       
   324         delete iResourceLoader;
       
   325         }
       
   326     }
       
   327 
       
   328 void CAppUi::HandleForegroundEventL(TBool aForeground)
       
   329     {
       
   330     CAknAppUi::HandleForegroundEventL( aForeground );
       
   331 
       
   332     if ( iUiFwObserver )
       
   333         {
       
   334         iUiFwObserver->HandleForegroundEvent( aForeground );
       
   335         }
       
   336     }
       
   337 
       
   338 void CAppUi::HandleCommandL(TInt aCommand)
       
   339     {
       
   340     switch (aCommand)
       
   341         {
       
   342         case EEikCmdExit:
       
   343             {
       
   344             TInt value;
       
   345             TInt err = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, value );
       
   346             if( err == KErrNone )
       
   347                 {
       
   348                 if ( value == ESwStateShuttingDown )
       
   349                     {
       
   350                     // If all is ok we filter our exits
       
   351                     Exit();
       
   352                     }
       
   353                 }
       
   354             else
       
   355                 {
       
   356                 // If all is not ok we still exit
       
   357                 Exit();
       
   358                 }
       
   359             break;
       
   360             }
       
   361         case EAknSoftkeyExit:
       
   362         case EAknCmdExit: // fallthrough
       
   363             {
       
   364 
       
   365 #ifdef _DEBUG
       
   366 
       
   367             Exit();
       
   368             if( iFwEventHandler && iUiCtl )
       
   369                 {
       
   370                 iFwEventHandler->HandleUiShutdown( *iUiCtl );
       
   371                 }
       
   372             break;
       
   373 
       
   374 #endif // _DEBUG
       
   375 
       
   376             }
       
   377 
       
   378         case ENativeUiSoftkeyLeft:
       
   379             {
       
   380             if( iFwEventHandler ) // LSK
       
   381                 {
       
   382                 HBufC* appBuf;
       
   383                 appBuf = HBufC::NewLC( RProperty::KMaxPropertySize );
       
   384                 TPtr appPtr = appBuf->Des();
       
   385                 RProperty::Get( KPSUidAiInformation, KActiveIdleExtHS_LSKLocked, appPtr );
       
   386                 if( appPtr.Length() > 0 )
       
   387                     {
       
   388                     iFwEventHandler->HandlePluginEvent(KAiLskLaunchByIndexLocked);
       
   389                     }
       
   390                 else
       
   391                     {
       
   392                     iFwEventHandler->HandlePluginEvent(KAiLskLaunchByIndex);
       
   393                     }
       
   394                 CleanupStack::PopAndDestroy( appBuf );
       
   395                 }
       
   396             break;
       
   397             }
       
   398 
       
   399         case ENativeUiSoftkeyRight:
       
   400             {
       
   401             break;
       
   402             }
       
   403 
       
   404         case ENativeUiSelectionKey:
       
   405             {
       
   406             if( iAppView )
       
   407                 {
       
   408                 TKeyEvent keyEvent;
       
   409                 keyEvent.iCode = EKeyOK;
       
   410                 keyEvent.iRepeats = 0;
       
   411                 TEventCode type(EEventKey);
       
   412                 iAppView->OfferKeyEventL(keyEvent, type);
       
   413                 }
       
   414             break;
       
   415             }
       
   416 
       
   417         default:
       
   418             {
       
   419             break;
       
   420             }
       
   421 
       
   422         }
       
   423 
       
   424     }
       
   425 
       
   426 void CAppUi::HandleResourceChangeL(TInt aType)
       
   427     {
       
   428     CAknAppUi::HandleResourceChangeL(aType);
       
   429 
       
   430     if( aType == KEikDynamicLayoutVariantSwitch )
       
   431         {
       
   432         // Screen layout changed, update and draw status pane.
       
   433         //Get pointer to status pane
       
   434         CEikStatusPane* statusPane = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() )->StatusPane();
       
   435         if( statusPane )
       
   436             {
       
   437             // Update status pane layout ot the correct one.
       
   438             TInt statusPaneLayout = GetLayoutCenrep();
       
   439             TInt id = statusPane->CurrentLayoutResId();
       
   440             if( id != iCurrentStatusPaneLayout )
       
   441                 {
       
   442                 statusPane->SwitchLayoutL( id );
       
   443                 iCurrentStatusPaneLayout = id;
       
   444                 }
       
   445             if( statusPaneLayout == EAiStatusPaneLayoutIdleHidden &&
       
   446                 id != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT )
       
   447                 {
       
   448                 statusPane->MakeVisible( EFalse );
       
   449                 iStanbyContainerIF->SetFullScreenMode( ETrue );
       
   450                 }
       
   451             else
       
   452                 {
       
   453                 statusPane->MakeVisible( ETrue );
       
   454                 iStanbyContainerIF->SetFullScreenMode( EFalse );
       
   455                 }
       
   456             statusPane->ApplyCurrentSettingsL();
       
   457             statusPane->DrawNow();
       
   458             }
       
   459         if( iAppView )
       
   460             {
       
   461             iAppView->SetRect( ClientRect() );
       
   462             iAppView->DrawNow();
       
   463             }
       
   464 
       
   465         }
       
   466 
       
   467     if ( iUiFwObserver )
       
   468         {
       
   469         iUiFwObserver->HandleResourceChange(aType);
       
   470         }
       
   471     }
       
   472 
       
   473 void CAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination)
       
   474     {
       
   475     // Pointer event handling for RSK and SIND launching  
       
   476     // LSK handled via HandleCommand
       
   477     if ( AknLayoutUtils::PenEnabled() && aEvent.Type() == EEventPointer )
       
   478         {
       
   479         TPointerEvent *event = aEvent.Pointer();
       
   480         HandlePointerEvent( *event );
       
   481         }
       
   482 
       
   483     if( iIdleIntegration )
       
   484         {
       
   485         // Forward window server events first to idle integration library
       
   486         iIdleIntegration->HandleWsEventL(aEvent, aDestination);
       
   487         }
       
   488 
       
   489     // Call base class to let the UI framework handle the event
       
   490     CAknAppUi::HandleWsEventL( aEvent, aDestination);
       
   491     }
       
   492 
       
   493 void CAppUi::HandlePointerEvent( TPointerEvent &aEvent )
       
   494     {        
       
   495     if ( !Cba()->IsVisible() )
       
   496         {
       
   497         return;
       
   498         }
       
   499 
       
   500     TRect rskRect;
       
   501     if ( Layout_Meta_Data::IsLandscapeOrientation() )
       
   502         {
       
   503         rskRect = ::SoftkeyRectTopTouch();
       
   504         }
       
   505     else
       
   506         {
       
   507         rskRect = ::SoftkeyRectRightTouch();
       
   508         }
       
   509     // pointer event done in RSK => activate sind timer.
       
   510     if ( aEvent.iType == TPointerEvent::EButton1Down && 
       
   511             rskRect.Contains( aEvent.iParentPosition )) 
       
   512         {              
       
   513         iSINDKeyDown = ETrue;         
       
   514         const TTimeIntervalMicroSeconds32 KLongKeyPress(600000);
       
   515         iTimer->Cancel();
       
   516         iTimer->Start( KLongKeyPress, 0, TCallBack( TimerDone, this ) );
       
   517         }
       
   518     // It doesn't matter where the button up is done 
       
   519     // the voice dial is still skipped
       
   520     else if ( iSINDKeyDown && 
       
   521             aEvent.iType == TPointerEvent::EButton1Up )
       
   522         {
       
   523         SkipVoiceDial();
       
   524         }
       
   525     // Dragging outside RSK cancels opening of shortcut
       
   526     // and voice dial
       
   527     else if ( iSINDKeyDown && 
       
   528             aEvent.iType == TPointerEvent::EDrag &&
       
   529             !rskRect.Contains( aEvent.iParentPosition ))
       
   530         {
       
   531         iTimer->Cancel();
       
   532         iSINDKeyDown = EFalse;
       
   533         }
       
   534     }
       
   535 
       
   536 void CAppUi::HandleScreenDeviceChangedL()
       
   537     {
       
   538     CAknAppUi::HandleScreenDeviceChangedL();
       
   539 
       
   540     if ( iFwEventHandler && iUiCtl )
       
   541         {
       
   542         //iFwEventHandler->HandleUiLayoutChangeL(*iUiCtl);
       
   543         }
       
   544     }
       
   545 
       
   546 void CAppUi::PrepareToExit()
       
   547     {
       
   548     if ( iFwEventHandler && iUiCtl )
       
   549         {
       
   550         iUiCtl->PrepareToExit();
       
   551         iFwEventHandler->HandleUiShutdown(*iUiCtl);
       
   552         }
       
   553     }
       
   554 
       
   555 TKeyResponse CAppUi::HandleKeyEventL(
       
   556     const TKeyEvent& aKeyEvent,
       
   557     TEventCode aType )
       
   558     {
       
   559     if( aKeyEvent.iScanCode == EStdKeyDevice1 )
       
   560         {
       
   561         if( aType == EEventKeyDown )
       
   562             {
       
   563             iSINDKeyDown = ETrue;
       
   564             const TTimeIntervalMicroSeconds32 KLongKeyPress(600000);
       
   565             iTimer->Cancel();
       
   566             iTimer->Start( KLongKeyPress, 0, TCallBack( TimerDone, this ) );
       
   567             }
       
   568         else if( aType == EEventKeyUp )
       
   569             {
       
   570             if( iSINDKeyDown )
       
   571                 {
       
   572                 SkipVoiceDial();
       
   573                 }
       
   574             }
       
   575         return EKeyWasConsumed;
       
   576         }
       
   577     else
       
   578         {
       
   579         if( aType == EEventKeyDown && iSINDKeyDown )
       
   580             {
       
   581             iSINDKeyDown = EFalse;
       
   582             SkipVoiceDial();
       
   583             }
       
   584         if( iAppView )
       
   585             {
       
   586             return iAppView->OfferKeyEventL(aKeyEvent, aType);
       
   587             }
       
   588         }
       
   589 
       
   590     return EKeyWasNotConsumed;
       
   591     }
       
   592 
       
   593 void CAppUi::SkipVoiceDial()
       
   594     {
       
   595     iTimer->Cancel();
       
   596     // Handle skip scenario only if voice dial ui hasn't been launched
       
   597     if ( iFwEventHandler )
       
   598         {
       
   599         HBufC* app2Buf;
       
   600         app2Buf = HBufC::New( RProperty::KMaxPropertySize );
       
   601         if ( app2Buf )
       
   602             {
       
   603             TPtr app2Ptr = app2Buf->Des();
       
   604             RProperty::Get( KPSUidAiInformation, KActiveIdleExtHS_RSKLocked, app2Ptr );
       
   605             if( app2Ptr.Length() > 0 )
       
   606                 {
       
   607                 iFwEventHandler->HandlePluginEvent(KAiRskLaunchByIndexLocked);
       
   608                 }
       
   609             else
       
   610                 {
       
   611                 iFwEventHandler->HandlePluginEvent(KAiRskLaunchByIndex);
       
   612                 }
       
   613             delete app2Buf;
       
   614             }
       
   615     	}
       
   616     iSINDKeyDown = EFalse;
       
   617     }
       
   618 
       
   619 TInt CAppUi::TimerDone(TAny* aSelf)
       
   620     {
       
   621     CAppUi* self = static_cast<CAppUi*>( aSelf );
       
   622     if ( self )
       
   623         {
       
   624         self->iTimer->Cancel();
       
   625         self->iSINDKeyDown = EFalse;
       
   626         self->iFwEventHandler->HandlePluginEvent(KAiRskLaunchVoiceDial);
       
   627         }
       
   628     return KErrNone;
       
   629     }
       
   630 
       
   631 void CAppUi::StartL()
       
   632     {
       
   633     if( iStanbyContainerIF )
       
   634         {
       
   635         iStanbyContainerIF->StartL();
       
   636         }
       
   637     }
       
   638 
       
   639 void CAppUi::HandleNotifyInt( TUint32 aId, TInt aNewValue )
       
   640     {
       
   641     // Set status pane on the fly.
       
   642     if( aId == KAiStatusPaneLayout )
       
   643         {
       
   644         if( aNewValue == EAiStatusPaneLayoutIdleNormal ||
       
   645             aNewValue == EAiStatusPaneLayoutIdleFlat ||
       
   646             aNewValue == EAiStatusPaneLayoutIdleHidden )
       
   647             {
       
   648             //Get pointer to status pane
       
   649             CEikStatusPane* statusPane = static_cast<CAknAppUi*>( iEikonEnv->EikAppUi() )->StatusPane();
       
   650             if( statusPane )
       
   651                 {
       
   652                 // Update status pane layout ot the correct one.
       
   653                 if( aNewValue == EAiStatusPaneLayoutIdleHidden &&
       
   654                     iCurrentStatusPaneLayout != R_AVKON_STACON_PANE_LAYOUT_IDLE_SOFTKEYS_RIGHT  )
       
   655                     {
       
   656                     statusPane->MakeVisible( EFalse );
       
   657                     if ( iStanbyContainerIF )
       
   658                         {
       
   659                         iStanbyContainerIF->SetFullScreenMode( ETrue );
       
   660                         }
       
   661 
       
   662                     }
       
   663                 else
       
   664                     {
       
   665                     statusPane->MakeVisible( ETrue );
       
   666                     if ( iStanbyContainerIF )
       
   667                         {
       
   668                         iStanbyContainerIF->SetFullScreenMode( EFalse );
       
   669                         }
       
   670                     }
       
   671                 statusPane->DrawNow();
       
   672                 if( iStanbyContainerIF )
       
   673                     {
       
   674                     iStanbyContainerIF->SetRect( ClientRect() );
       
   675                     }
       
   676                 if ( iAppView )
       
   677                     {
       
   678                     iAppView->DrawNow();
       
   679                     }
       
   680 
       
   681                 }
       
   682             }
       
   683         }
       
   684     }
       
   685     
       
   686 void CAppUi::ExtHSThemeChanged()
       
   687     {
       
   688     //TRAP_IGNORE( iFwEventHandler->HandleUiThemeChangeStartL( *iUiCtl ) );
       
   689     TRAP_IGNORE( iFwEventHandler->HandleUiReadyEventL( *iUiCtl ) );
       
   690     }
       
   691 
       
   692 TInt CAppUi::HandlePowerkeyEvent( TAny* aPtr )
       
   693     {
       
   694     CAppUi* self = static_cast<CAppUi*>(aPtr);
       
   695     if( self && self->iStanbyContainerIF )
       
   696         {
       
   697         TKeyEvent keyEvent;
       
   698         keyEvent.iCode = EKeyPhoneEnd;
       
   699         TEventCode eventType;
       
   700         eventType = EEventKey;
       
   701         TRAP_IGNORE( self->iStanbyContainerIF->OfferKeyEventL( keyEvent, eventType ) );
       
   702         }
       
   703     return KErrNone;
       
   704     }
       
   705 
       
   706 // End of File.