uifw/EikStd/coctlsrc/aknitemactionmenuregister.cpp
branchRCL_3
changeset 10 3d340a0166ff
parent 8 71dd06cfe933
child 13 a8834a2e9a96
equal deleted inserted replaced
9:0aa5fbdfbc30 10:3d340a0166ff
    39 
    39 
    40     AknItemActionMenuRegister* instance( Instance() );
    40     AknItemActionMenuRegister* instance( Instance() );
    41 
    41 
    42     if ( instance )
    42     if ( instance )
    43         {
    43         {
    44         instance->DoSetConstructingMenuBarOwnerL( aMenuBarOwner ); 
    44         instance->iMenuBarOwner = aMenuBarOwner;
    45         }
    45         }
    46 
    46 
    47     _AKNTRACE_FUNC_EXIT;
    47     _AKNTRACE_FUNC_EXIT;
    48     }
    48     }
    49 
    49 
   903 
   903 
   904     _AKNTRACE_FUNC_EXIT;
   904     _AKNTRACE_FUNC_EXIT;
   905     return instance;
   905     return instance;
   906     }
   906     }
   907 
   907 
   908 // ---------------------------------------------------------------------------
       
   909 // AknItemActionMenuRegister::DoSetConstructingMenuBarOwnerL
       
   910 // ---------------------------------------------------------------------------
       
   911 //
       
   912 void AknItemActionMenuRegister::DoSetConstructingMenuBarOwnerL( 
       
   913         MObjectProvider* aMenuBarOwner )
       
   914     {
       
   915     if ( aMenuBarOwner )
       
   916         {
       
   917         CEikDialog* dialog( NULL );
       
   918         aMenuBarOwner->MopGetObjectNoChaining( dialog );
       
   919         // Get information if the constructing menu bar owner is a dialog  
       
   920         // and store it to iIsConstructingDialog
       
   921         if ( dialog )
       
   922             {
       
   923             iIsConstructingDialog = ETrue; 
       
   924             }
       
   925         }
       
   926     
       
   927     iMenuBarOwner = aMenuBarOwner;
       
   928     }
       
   929 
       
   930 
   908 
   931 // ---------------------------------------------------------------------------
   909 // ---------------------------------------------------------------------------
   932 // AknItemActionMenuRegister::DoRemoveConstructingMenuBarOwner
   910 // AknItemActionMenuRegister::DoRemoveConstructingMenuBarOwner
   933 // ---------------------------------------------------------------------------
   911 // ---------------------------------------------------------------------------
   934 //
   912 //
   943         TAknUnregisteredMenuData& data( iUnregisteredMenus[i] );
   921         TAknUnregisteredMenuData& data( iUnregisteredMenus[i] );
   944 
   922 
   945         if ( data.iOwner == iMenuBarOwner ) 
   923         if ( data.iOwner == iMenuBarOwner ) 
   946             {
   924             {
   947             data.iOwner = iMenuBarOwner = NULL;
   925             data.iOwner = iMenuBarOwner = NULL;
   948             
       
   949             // When setting constructing menubar owner to NULL from a dialog
       
   950             // check if there is item with the same menubar owner in 
       
   951             // iUnregisteredMenus and try to find correct menubar for it.
       
   952             if ( iIsConstructingDialog )
       
   953                 {
       
   954                 CEikMenuBar* menuBar = FindCurrentMenuBar(); 
       
   955 
       
   956                 if ( menuBar )
       
   957                     {
       
   958                     TRAP_IGNORE( AddRegisterEntryL( *menuBar, *data.iMenu ) );
       
   959                     iUnregisteredMenus.Remove( i );
       
   960                     continue;
       
   961                     }
       
   962                 }
       
   963             }
   926             }
   964         
   927         
   965         ++i;
   928         ++i;
   966         }
   929         }
   967     
   930     
   976             }
   939             }
   977         }
   940         }
   978     
   941     
   979     if ( iMenuBarOwner == aMenuBarOwner )
   942     if ( iMenuBarOwner == aMenuBarOwner )
   980         {
   943         {
   981         iIsConstructingDialog = EFalse; 
       
   982         iMenuBarOwner = NULL;
   944         iMenuBarOwner = NULL;
   983         }
   945         }
   984     }
   946     }
   985 
   947 
   986 
   948