idlehomescreen/xmluirendering/uiengine/src/xnviewadapter.cpp
changeset 0 f72a12da539e
child 2 08c6ee43b396
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Xuikon view adapter source file
       
    15 *
       
    16 */
       
    17 
       
    18 // System includes
       
    19 #include <aknViewAppUi.h>
       
    20 #include <eikbtgpc.h>
       
    21 
       
    22 // User includes
       
    23 #include "xnappuiadapter.h"
       
    24 #include "xnviewmanager.h"
       
    25 #include "xnviewdata.h"
       
    26 #include "xnuiengine.h"
       
    27 
       
    28 #include "xnkeyeventdispatcher.h"
       
    29 #include "xncontroladapter.h"
       
    30 
       
    31 #include "xndomdocument.h"
       
    32 #include "xndomnode.h"
       
    33 #include "xndomlist.h"
       
    34 #include "xnodt.h"
       
    35 #include "xnproperty.h"
       
    36 #include "xnnodeimpl.h"
       
    37 #include "xnnode.h"
       
    38 #include "xntype.h"
       
    39 #include "xnbgcontrol.h"
       
    40 #include "xnfocuscontrol.h"
       
    41 
       
    42 #include "xnviewadapter.h"
       
    43 #include "xnmenu.h"
       
    44 
       
    45 // Constants
       
    46 const TUid KXmlViewUid = { 1 };
       
    47 
       
    48 // Data types
       
    49 enum 
       
    50     {
       
    51     EIsActivated,
       
    52     EIsInCall,
       
    53     EIsLightsOn,
       
    54     EIsForeground,    
       
    55     EIsControlsAwake,    
       
    56     EIsDestructionRunning
       
    57     };
       
    58 
       
    59 // ============================= LOCAL FUNCTIONS ===============================
       
    60 // -----------------------------------------------------------------------------
       
    61 // BuildTriggerL
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 static CXnNode* BuildTriggerL(
       
    65     CXnUiEngine& aUiEngine,
       
    66     const TDesC8& aTriggerName )
       
    67     {
       
    68     CXnNode* node = CXnNode::NewL();
       
    69     CleanupStack::PushL( node );
       
    70     CXnType* type = CXnType::NewL( XnPropertyNames::action::KTrigger );
       
    71     CleanupStack::PushL( type );
       
    72     CXnNodeImpl* impl = CXnNodeImpl::NewL( type );
       
    73     CleanupStack::Pop( type );
       
    74     node->SetImpl( impl );
       
    75     node->SetUiEngine( aUiEngine );
       
    76     
       
    77     CXnDomPropertyValue* nameValue = CXnDomPropertyValue::NewL(
       
    78         aUiEngine.ODT()->DomDocument().StringPool() );
       
    79     CleanupStack::PushL( nameValue );
       
    80     nameValue->SetStringValueL( CXnDomPropertyValue::EString, aTriggerName );
       
    81     CXnProperty* name = CXnProperty::NewL(
       
    82         XnPropertyNames::action::trigger::KName,
       
    83         nameValue,
       
    84         aUiEngine.ODT()->DomDocument().StringPool() );
       
    85     CleanupStack::Pop( nameValue );
       
    86     CleanupStack::PushL( name );
       
    87     node->SetPropertyL( name );
       
    88     CleanupStack::Pop( 2, node ); // name 
       
    89     
       
    90     return node;
       
    91     }
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // BuildActivateTriggerL
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 static CXnNode* BuildActivateTriggerL( CXnUiEngine& aUiEngine )
       
    98     {
       
    99     return BuildTriggerL(
       
   100         aUiEngine, XnPropertyNames::action::trigger::name::KViewActivate );
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // BuildDeactivateTriggerL
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 static CXnNode* BuildDeactivateTriggerL( CXnUiEngine& aUiEngine )
       
   108     {
       
   109     return BuildTriggerL(
       
   110         aUiEngine, XnPropertyNames::action::trigger::name::KViewDeactivate );
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // BuildEditStateTriggerL
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 static CXnNode* BuildEditStateTriggerL( CXnUiEngine& aUiEngine )
       
   118     {
       
   119     CXnDomStringPool& sp( aUiEngine.ODT()->DomDocument().StringPool() );
       
   120     
       
   121     CXnProperty* value = CXnProperty::NewL(
       
   122         XnPropertyNames::action::KValue,
       
   123         KNullDesC8, CXnDomPropertyValue::EString, sp );
       
   124     CleanupStack::PushL( value );
       
   125     
       
   126     CXnNode* trigger( BuildTriggerL(
       
   127         aUiEngine, XnPropertyNames::action::trigger::name::KEditMode ) );    
       
   128     CleanupStack::PushL( trigger );
       
   129     
       
   130     trigger->SetPropertyL( value );
       
   131     CleanupStack::Pop( 2, value ); // trigger
       
   132     
       
   133     return trigger;
       
   134     }
       
   135 
       
   136 // ============================ MEMBER FUNCTIONS ===============================
       
   137 
       
   138 // -----------------------------------------------------------------------------
       
   139 // CXnViewAdapter::CXnViewAdapter
       
   140 // C++ default constructor can NOT contain any code, that
       
   141 // might leave.
       
   142 // -----------------------------------------------------------------------------
       
   143 //
       
   144 CXnViewAdapter::CXnViewAdapter( CXnAppUiAdapter& aAdapter )
       
   145     : iAppUiAdapter( aAdapter )
       
   146     {
       
   147     }
       
   148 
       
   149 // -----------------------------------------------------------------------------
       
   150 // CXnViewAdapter::~CXnViewAdapter
       
   151 // Destructor.
       
   152 // -----------------------------------------------------------------------------
       
   153 //
       
   154 CXnViewAdapter::~CXnViewAdapter()
       
   155     {           
       
   156     delete iActivate;
       
   157     delete iDeactivate;
       
   158     delete iEditState;
       
   159     delete iBgControl;
       
   160     delete iFocusControl;
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CXnViewAdapter::NewL
       
   165 // 2nd phase construction.
       
   166 // -----------------------------------------------------------------------------
       
   167 //
       
   168 CXnViewAdapter* CXnViewAdapter::NewL( CXnAppUiAdapter& aAdapter )
       
   169     {
       
   170     CXnViewAdapter* self = new ( ELeave ) CXnViewAdapter( aAdapter );
       
   171     CleanupStack::PushL( self );
       
   172     self->ConstructL();
       
   173     CleanupStack::Pop( self );
       
   174     return self;
       
   175     }
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CXnViewAdapter::ConstructL
       
   179 // 2nd phase construction.
       
   180 // -----------------------------------------------------------------------------
       
   181 //
       
   182 void CXnViewAdapter::ConstructL()
       
   183     {
       
   184     BaseConstructL();
       
   185     
       
   186     // Base class CAknViewAppUi takes ownership of iViewAdapter
       
   187     iAppUiAdapter.AddViewL( this );    
       
   188     
       
   189     iBgControl = CXnBgControl::NewL();
       
   190     iBgControl->SetMopParent( this );
       
   191 
       
   192     iFocusControl = CXnFocusControl::NewL( iAppUiAdapter );   
       
   193     
       
   194     iEventDispatcher = 
       
   195         CXnKeyEventDispatcher::NewL( iAppUiAdapter.UiEngine() );
       
   196     
       
   197     iAppUiAdapter.UiEngine().SetEventDispatcher( iEventDispatcher );
       
   198     
       
   199     iAppUiAdapter.UiStateListener().AddObserver( *this );
       
   200     }
       
   201 
       
   202 // -----------------------------------------------------------------------------
       
   203 // CXnViewAdapter::ReloadUiL
       
   204 // Called when application UI is reloaded
       
   205 // -----------------------------------------------------------------------------
       
   206 //
       
   207 void CXnViewAdapter::ReloadUiL()
       
   208     {
       
   209     DeactivateContainerL();
       
   210     
       
   211     iAppUiAdapter.RemoveFromStack( iEventDispatcher );
       
   212     
       
   213     delete iEventDispatcher;
       
   214     iEventDispatcher = NULL;
       
   215     
       
   216     delete iActivate;
       
   217     iActivate = NULL;
       
   218     
       
   219     delete iDeactivate;
       
   220     iDeactivate = NULL;
       
   221     
       
   222     delete iEditState;
       
   223     iEditState = NULL;
       
   224         
       
   225     iEventDispatcher = CXnKeyEventDispatcher::NewL( iAppUiAdapter.UiEngine() );
       
   226     
       
   227     iAppUiAdapter.UiEngine().SetEventDispatcher( iEventDispatcher );
       
   228     
       
   229     if ( iFlags.IsSet( EIsActivated ) )
       
   230         {
       
   231         iAppUiAdapter.AddToStackL( *this, iEventDispatcher );
       
   232         }
       
   233     }
       
   234 
       
   235 // -----------------------------------------------------------------------------
       
   236 // CXnViewAdapter::PrepareDestroy
       
   237 // Sets view to be destroyed
       
   238 // -----------------------------------------------------------------------------
       
   239 //
       
   240 void CXnViewAdapter::PrepareDestroy()
       
   241     {
       
   242     iAppUiAdapter.UiStateListener().RemoveObserver( *this );
       
   243     
       
   244     TRAP_IGNORE( DeactivateContainerL() );
       
   245     
       
   246     iAppUiAdapter.RemoveFromStack( iEventDispatcher );
       
   247     delete iEventDispatcher;
       
   248     iEventDispatcher = NULL;
       
   249     
       
   250     iContainer = NULL;
       
   251     
       
   252     iFlags.Set( EIsDestructionRunning );    
       
   253     }
       
   254 
       
   255 // -----------------------------------------------------------------------------
       
   256 // CXnViewAdapter::EventDispatcher
       
   257 // Get event dispatcher
       
   258 // -----------------------------------------------------------------------------
       
   259 //
       
   260 CXnKeyEventDispatcher* CXnViewAdapter::EventDispatcher() const
       
   261     {
       
   262     return iEventDispatcher;
       
   263     }
       
   264 
       
   265 // -----------------------------------------------------------------------------
       
   266 // CXnViewAdapter::BgControl
       
   267 // Returns bg control.
       
   268 // -----------------------------------------------------------------------------
       
   269 //
       
   270 CCoeControl& CXnViewAdapter::BgControl() const
       
   271     {
       
   272     return *iBgControl;
       
   273     }
       
   274 
       
   275 // -----------------------------------------------------------------------------
       
   276 // CXnViewAdapter::BgControl
       
   277 // Returns focus control.
       
   278 // -----------------------------------------------------------------------------
       
   279 //
       
   280 CXnFocusControl& CXnViewAdapter::FocusControl() const
       
   281     {
       
   282     return *iFocusControl;
       
   283     }
       
   284 
       
   285 // -----------------------------------------------------------------------------
       
   286 // CXnViewAdapter::Id
       
   287 // Returns view uid.
       
   288 // -----------------------------------------------------------------------------
       
   289 //
       
   290 TUid CXnViewAdapter::Id() const
       
   291     {
       
   292     return KXmlViewUid;
       
   293     }
       
   294 
       
   295 // -----------------------------------------------------------------------------
       
   296 // CXnViewAdapter::DoActivateL
       
   297 // Activates view.
       
   298 // -----------------------------------------------------------------------------
       
   299 //
       
   300 void CXnViewAdapter::DoActivateL( const TVwsViewId& /*aPrevViewId*/,    
       
   301     TUid /*aCustomMessageId*/,
       
   302     const TDesC8& /*aCustomMessage*/ )
       
   303     {
       
   304     if ( iFlags.IsSet( EIsDestructionRunning ) )
       
   305         {
       
   306         return;
       
   307         }
       
   308     
       
   309     iFlags.Set( EIsActivated );
       
   310     
       
   311     iAppUiAdapter.AddToStackL( *this, iEventDispatcher );
       
   312 
       
   313     CEikButtonGroupContainer* bgc( iAppUiAdapter.Cba() );
       
   314     
       
   315     if ( bgc )
       
   316         {
       
   317         // EventDispatcher will handle sotkey keyevents 
       
   318         CEikCba* cba( 
       
   319             static_cast< CEikCba* >( bgc->ButtonGroup() ) );
       
   320 
       
   321         iAppUiAdapter.RemoveFromStack( cba );        
       
   322         }
       
   323     
       
   324     iBgControl->MakeVisible( ETrue );
       
   325     
       
   326     // Set the active container
       
   327     ActivateContainerL( iAppUiAdapter.ViewManager().ActiveViewData() );             
       
   328     }
       
   329 
       
   330 // -----------------------------------------------------------------------------
       
   331 // CXnViewAdapter::DoDeactivate
       
   332 // Deactivates view.
       
   333 // -----------------------------------------------------------------------------
       
   334 //
       
   335 void CXnViewAdapter::DoDeactivate()
       
   336     {        
       
   337     if ( iFlags.IsSet( EIsDestructionRunning ) )
       
   338         {
       
   339         return;
       
   340         }
       
   341     
       
   342     iAppUiAdapter.RemoveFromStack( iEventDispatcher );
       
   343 
       
   344     TRAP_IGNORE( DeactivateContainerL() );
       
   345     
       
   346     iBgControl->MakeVisible( EFalse );
       
   347     iFocusControl->MakeVisible( EFalse );
       
   348     
       
   349     iFlags.Clear( EIsActivated );
       
   350     }
       
   351 
       
   352 // -----------------------------------------------------------------------------
       
   353 // CXnViewAdapter::ActivateContainerL
       
   354 // Activates container
       
   355 // -----------------------------------------------------------------------------
       
   356 //
       
   357 void CXnViewAdapter::ActivateContainerL( CXnViewData& aContainer, 
       
   358     TBool aEnterEditState )
       
   359     {                       
       
   360     if ( iContainer == &aContainer )    
       
   361         {            
       
   362         return;
       
   363         }
       
   364 
       
   365     // Deactivate previous
       
   366     DeactivateContainerL();
       
   367     
       
   368     if ( iFlags.IsClear( EIsActivated ) )
       
   369         {
       
   370         // Some other view than this in this appui is currently active,
       
   371         // postpone container activation
       
   372         return;
       
   373         }
       
   374     
       
   375     // Update
       
   376     iContainer = &aContainer;
       
   377         
       
   378     // Disable layout and redraw until container activation is done
       
   379     iAppUiAdapter.UiEngine().DisableRenderUiLC();
       
   380 
       
   381     // Try exit controls from powersave mode
       
   382     ChangeControlsStateL( ETrue );
       
   383     
       
   384     if ( !iActivate )
       
   385         {
       
   386         iActivate = BuildActivateTriggerL( iAppUiAdapter.UiEngine() );
       
   387         }
       
   388 
       
   389     CXnNode* node( aContainer.Node()->LayoutNode() );
       
   390     
       
   391     node->ReportXuikonEventL( *iActivate );
       
   392                            
       
   393     if ( iFlags.IsSet( EIsInCall ) )
       
   394         {
       
   395         iFlags.Clear( EIsInCall );
       
   396         
       
   397         // This container is in-call state
       
   398         NotifyInCallStateChaged( ETrue );        
       
   399         }
       
   400                  
       
   401     iAppUiAdapter.ViewManager().NotifyContainerChangedL( aContainer );
       
   402     
       
   403     if ( !iEditState )
       
   404         {
       
   405         iEditState = BuildEditStateTriggerL( iAppUiAdapter.UiEngine() ); 
       
   406         }
       
   407     
       
   408     CXnProperty* prop( iEditState->GetPropertyL( 
       
   409         XnPropertyNames::action::KValue ) );
       
   410     
       
   411     if ( aEnterEditState || iAppUiAdapter.UiEngine().IsEditMode() )
       
   412         {
       
   413         static_cast< CXnDomPropertyValue* >(
       
   414             prop->Property()->PropertyValueList().Item( 0 ) )
       
   415             ->SetStringValueL( CXnDomPropertyValue::EString,
       
   416             XnPropertyNames::action::trigger::name::editmode::KEnter() );                        
       
   417         }
       
   418     else
       
   419         {
       
   420         static_cast< CXnDomPropertyValue* >(
       
   421             prop->Property()->PropertyValueList().Item( 0 ) )
       
   422             ->SetStringValueL( CXnDomPropertyValue::EString,
       
   423             XnPropertyNames::action::trigger::name::editmode::KExit() );                                
       
   424         }
       
   425     
       
   426     node->ReportXuikonEventL( *iEditState );
       
   427     
       
   428     CXnControlAdapter* adapter( node->Control() );
       
   429     
       
   430     iBgControl->SetCompoundControl( adapter );
       
   431             
       
   432     iAppUiAdapter.UiEngine().RenderUIL();
       
   433     
       
   434     CleanupStack::PopAndDestroy(); // DisableRenderUiLC        
       
   435     }
       
   436 
       
   437 // -----------------------------------------------------------------------------
       
   438 // CXnViewAdapter::DeactivateContainerL
       
   439 // Deactivates current container
       
   440 // -----------------------------------------------------------------------------
       
   441 //
       
   442 void CXnViewAdapter::DeactivateContainerL()
       
   443     {
       
   444     if ( !iContainer )    
       
   445         {
       
   446         return;
       
   447         }
       
   448     
       
   449     // Run controls to powersave mode
       
   450     ChangeControlsStateL( EFalse );
       
   451 
       
   452     if ( !iDeactivate )
       
   453         {
       
   454         iDeactivate = BuildDeactivateTriggerL( iAppUiAdapter.UiEngine() );
       
   455         }
       
   456 
       
   457     CXnNode* node( iContainer->Node()->LayoutNode() );
       
   458                 
       
   459     node->ReportXuikonEventL( *iDeactivate );
       
   460 
       
   461     iBgControl->SetCompoundControl( NULL );
       
   462     
       
   463     iContainer = NULL;
       
   464     }
       
   465 
       
   466 // -----------------------------------------------------------------------------
       
   467 // CXnViewAdapter::NotifyForegroundChanged
       
   468 // 
       
   469 // -----------------------------------------------------------------------------
       
   470 //
       
   471 void CXnViewAdapter::NotifyForegroundChanged( 
       
   472     MXnUiStateObserver::TForegroundStatus aStatus ) 
       
   473     {     
       
   474     if ( aStatus == MXnUiStateObserver::EPartialForeground || 
       
   475          aStatus == MXnUiStateObserver::EBackground )
       
   476         {
       
   477         iFlags.Clear( EIsForeground );
       
   478         
       
   479         iFocusControl->MakeVisible( EFalse );
       
   480         
       
   481         TRAP_IGNORE( ChangeControlsStateL( EFalse ) );
       
   482         }
       
   483     else
       
   484         {
       
   485         iFlags.Set( EIsForeground );
       
   486         
       
   487         TRAP_IGNORE( ChangeControlsStateL( ETrue ) );               
       
   488         }
       
   489     }
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CXnViewAdapter::NotifyLightStatusChanged
       
   493 // 
       
   494 // -----------------------------------------------------------------------------
       
   495 //
       
   496 void CXnViewAdapter::NotifyLightStatusChanged( TBool aLightsOn )
       
   497     {       
       
   498     if ( aLightsOn )
       
   499         {
       
   500         iFlags.Set( EIsLightsOn );
       
   501         
       
   502         TRAP_IGNORE( ChangeControlsStateL( ETrue ) );        
       
   503         }
       
   504     else 
       
   505         {
       
   506         iFlags.Clear( EIsLightsOn );
       
   507         
       
   508         TRAP_IGNORE( ChangeControlsStateL( EFalse ) );        
       
   509         }        
       
   510     }
       
   511 
       
   512 // -----------------------------------------------------------------------------
       
   513 // CXnViewAdapter::NotifyInCallStateChaged
       
   514 // 
       
   515 // -----------------------------------------------------------------------------
       
   516 //
       
   517 void CXnViewAdapter::NotifyInCallStateChaged( TBool aInCall )
       
   518     {       
       
   519     if ( !iContainer )
       
   520         {
       
   521         return;
       
   522         }
       
   523     
       
   524     TBool incallNow( iFlags.IsSet( EIsInCall ) ? ETrue : EFalse );
       
   525     
       
   526     if ( incallNow == aInCall )
       
   527         {
       
   528         return;
       
   529         }
       
   530 
       
   531     if ( aInCall )
       
   532         {
       
   533         iFlags.Set( EIsInCall );
       
   534         }
       
   535     else
       
   536         {
       
   537         iFlags.Clear( EIsInCall );
       
   538         }
       
   539     
       
   540     TRAP_IGNORE( UpdateRskByModeL() );
       
   541     }
       
   542 
       
   543 // -----------------------------------------------------------------------------
       
   544 // CXnViewAdapter::ChangeControlsStateL
       
   545 // 
       
   546 // -----------------------------------------------------------------------------
       
   547 //
       
   548 void CXnViewAdapter::ChangeControlsStateL( TBool aAwake )
       
   549     {
       
   550     if ( !iContainer )
       
   551         {
       
   552         return;
       
   553         }
       
   554 
       
   555     TBool awakeNow( iFlags.IsSet( EIsControlsAwake ) ? ETrue : EFalse );
       
   556     
       
   557     if ( aAwake == awakeNow )
       
   558         {
       
   559         // No change in the state
       
   560         return;
       
   561         }
       
   562 
       
   563     TBool changeState( EFalse );
       
   564     
       
   565     if ( aAwake )
       
   566         {
       
   567         if ( iFlags.IsSet( EIsForeground ) && iFlags.IsSet( EIsLightsOn ) )
       
   568             {
       
   569             iFlags.Set( EIsControlsAwake );
       
   570             changeState = ETrue;
       
   571             }       
       
   572         }
       
   573     else
       
   574         {
       
   575         iFlags.Clear( EIsControlsAwake );
       
   576         changeState = ETrue;
       
   577         }
       
   578     
       
   579     if( changeState )
       
   580         {
       
   581         RPointerArray< CXnControlAdapter > controls;
       
   582         CleanupClosePushL( controls );
       
   583         
       
   584         iContainer->ControlsL( controls );
       
   585         
       
   586         for ( TInt i = 0; i < controls.Count(); i++ )
       
   587             {
       
   588             if ( aAwake )
       
   589                 {
       
   590                 controls[i]->ExitPowerSaveModeL();
       
   591                 }
       
   592             else
       
   593                 {
       
   594                 controls[i]->EnterPowerSaveModeL();
       
   595                 }               
       
   596             }
       
   597             
       
   598         CleanupStack::PopAndDestroy( &controls );            
       
   599         }           
       
   600     }
       
   601 
       
   602 // -----------------------------------------------------------------------------
       
   603 // CXnViewAdapter::UpdateRskByModeL()
       
   604 // 
       
   605 // -----------------------------------------------------------------------------
       
   606 //
       
   607 void CXnViewAdapter::UpdateRskByModeL()
       
   608     {
       
   609     CXnNode* menubar( iAppUiAdapter.UiEngine().MenuBarNode() );
       
   610     
       
   611     if( menubar )
       
   612         {
       
   613         const TDesC8* state( NULL );
       
   614         
       
   615         if( iAppUiAdapter.UiEngine().IsEditMode() )
       
   616             {
       
   617             state = &XnPropertyNames::softkey::mode::KModeEdit;
       
   618             }     
       
   619         else if( iFlags.IsSet( EIsInCall ) )
       
   620             {
       
   621             state = &XnPropertyNames::softkey::mode::KModeCallActive;
       
   622             }
       
   623         else
       
   624             {
       
   625             state = &XnPropertyNames::softkey::mode::KModeCallInactive;
       
   626             }
       
   627         
       
   628         XnMenuInterface::MXnMenuInterface* menuIf( NULL );
       
   629         XnComponentInterface::MakeInterfaceL( menuIf, menubar->AppIfL() );
       
   630                
       
   631         RPointerArray<CXnNode>& childrens( menubar->Children() );
       
   632         
       
   633         for( TInt i=0; i < childrens.Count(); i++ )
       
   634             {
       
   635             CXnNode* node = childrens[i];
       
   636             
       
   637             if( node && node->Type()->Type() == XnPropertyNames::softkey::KNodeName )
       
   638                 {                  
       
   639                 CXnProperty* mode = node->GetPropertyL( XnPropertyNames::softkey::KModeAttribute );
       
   640                 CXnProperty* type = node->GetPropertyL( XnPropertyNames::softkey::KTypeAttribute );
       
   641                 
       
   642                 if( ( mode && *state == mode->StringValue() ) &&
       
   643                         ( type && type->StringValue().Compare( XnPropertyNames::softkey::type::KRight ) == 0 ) )
       
   644                     {
       
   645                     menuIf->SetSoftKeyL( &node->PluginIfL() , XnMenuInterface::MXnMenuInterface::ERight );
       
   646                     node->SetDirtyL( XnDirtyLevel::ERender );
       
   647                     } 
       
   648                 }
       
   649             }
       
   650         }
       
   651     }
       
   652 
       
   653 
       
   654 // End of file