diff -r fcdfafb36fe7 -r aecbbf00d063 uifw/EikStd/coctlsrc/aknitemactionmenu.cpp --- a/uifw/EikStd/coctlsrc/aknitemactionmenu.cpp Thu Aug 19 10:11:06 2010 +0300 +++ b/uifw/EikStd/coctlsrc/aknitemactionmenu.cpp Tue Aug 31 15:28:30 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -28,8 +28,6 @@ #include "akncollectionobserver.h" #include "aknitemactionmenudata.h" #include "aknitemactionmenuregister.h" -#include "akntrace.h" -#include "aknmarkingmode.h" /** * Index for invalid list index. @@ -41,13 +39,10 @@ // --------------------------------------------------------------------------- // CAknItemActionMenu* CAknItemActionMenu::NewL( - MAknCollection& aCollection, MObjectProvider* aOwner ) + MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; - CAknItemActionMenu* self = CAknItemActionMenu::NewLC( - aCollection, aOwner ); + CAknItemActionMenu* self = CAknItemActionMenu::NewLC( aCollection ); CleanupStack::Pop( self ); - _AKNTRACE_FUNC_EXIT; return self; } @@ -56,14 +51,11 @@ // CAknItemActionMenu::NewLC // --------------------------------------------------------------------------- // -CAknItemActionMenu* CAknItemActionMenu::NewLC( - MAknCollection& aCollection, MObjectProvider* aOwner ) +CAknItemActionMenu* CAknItemActionMenu::NewLC( MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; - CAknItemActionMenu* self = new ( ELeave ) CAknItemActionMenu( aOwner ); + CAknItemActionMenu* self = new ( ELeave ) CAknItemActionMenu(); CleanupStack::PushL( self ); self->ConstructL( aCollection ); - _AKNTRACE_FUNC_EXIT; return self; } @@ -74,21 +66,12 @@ // CAknItemActionMenu::~CAknItemActionMenu() { - _AKNTRACE_FUNC_ENTER; AKNTASHOOK_REMOVE(); delete iPopupMenu; delete iMenuPane; delete iMenuData; - delete iMarking; iStates.Close(); - - for ( TInt i = 0; i < iObservers.Count(); ++i ) - { - iObservers[i]->SetItemActionMenu( NULL ); - } - iObservers.Close(); - _AKNTRACE_FUNC_EXIT; } @@ -99,24 +82,7 @@ EXPORT_C CAknItemActionMenu* CAknItemActionMenu::RegisterCollectionL( MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; - return AknItemActionMenuRegister::RegisterCollectionL( - aCollection, NULL ); - } - - -// --------------------------------------------------------------------------- -// CAknItemActionMenu::RegisterCollectionL -// --------------------------------------------------------------------------- -// -EXPORT_C CAknItemActionMenu* CAknItemActionMenu::RegisterCollectionL( - MAknCollection& aCollection, MObjectProvider* aMenuBarOwner ) - { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; - return AknItemActionMenuRegister::RegisterCollectionL( - aCollection, aMenuBarOwner ); + return AknItemActionMenuRegister::RegisterCollectionL( aCollection ); } @@ -127,7 +93,6 @@ EXPORT_C void CAknItemActionMenu::RemoveCollection( MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; for ( TInt i = 0; i < iStates.Count(); i++ ) { MAknCollection* state( iStates[ i ] ); @@ -138,7 +103,6 @@ } } UnregisterMenu(); - _AKNTRACE_FUNC_EXIT; } @@ -148,7 +112,6 @@ // EXPORT_C TBool CAknItemActionMenu::InitMenuL() { - _AKNTRACE_FUNC_ENTER; iMenuData->Reset(); if ( !iMenuBar ) { @@ -168,7 +131,6 @@ return EFalse; } - _AKNTRACE_FUNC_EXIT; return iMenuData->Count(); } @@ -181,13 +143,11 @@ const TPoint& aPosition, TUint /*aFlags*/ ) { - _AKNTRACE_FUNC_ENTER; if ( iMenuData->Count() ) { if ( !iPopupMenu ) { - iPopupMenu = CAknStylusPopUpMenu::NewL( this, TPoint(), NULL, - CAknStylusPopUpMenu::EConsumeKeyEvents ); + iPopupMenu = CAknStylusPopUpMenu::NewL( this, TPoint() ); } iPopupMenu->Clear(); iMenuData->AddMenuItemsToStylusPopupMenuL( iPopupMenu ); @@ -196,7 +156,6 @@ CAknStylusPopUpMenu::EPositionTypeRightBottom ); iPopupMenu->ShowMenu(); } - _AKNTRACE_FUNC_EXIT; } @@ -207,14 +166,12 @@ EXPORT_C void CAknItemActionMenu::CollectionChanged( MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; if ( iObservers.Count() && iStates.Find( &aCollection ) != KErrNotFound ) { TBool collectionVisible( aCollection.CollectionState() & MAknCollection::EStateCollectionVisible ); NotifyChangeToActiveObserver( collectionVisible ); } - _AKNTRACE_FUNC_EXIT; } @@ -225,12 +182,10 @@ void CAknItemActionMenu::AddCollectionStateL( MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; if ( iStates.Find( &aCollection ) == KErrNotFound ) { iStates.InsertL( &aCollection, 0 ); } - _AKNTRACE_FUNC_EXIT; } @@ -242,10 +197,8 @@ MEikMenuObserver* aMenuObserver, CEikMenuBar* aMenuBar ) { - _AKNTRACE_FUNC_ENTER; iMenuBarObserver = aMenuObserver; iMenuBar = aMenuBar; - _AKNTRACE_FUNC_EXIT; } @@ -255,23 +208,18 @@ // TBool CAknItemActionMenu::CollectionHighlightVisible() const { - _AKNTRACE_FUNC_ENTER; TBool highlightVisible( ETrue ); for ( TInt i = 0; i < iStates.Count(); i++ ) { - MAknCollection* collection( iStates[ i ] ); - TUint state = collection->CollectionState(); - - highlightVisible = state & MAknCollection::EStateHighlightVisible; - - if ( highlightVisible ) + MAknCollection* state( iStates[ i ] ); + if ( state->CollectionState() & + MAknCollection::EStateCollectionVisible ) { - // Highlight can't be visible if the collection is not visible. - highlightVisible = state & MAknCollection::EStateCollectionVisible; + highlightVisible = state->CollectionState() + & MAknCollection::EStateHighlightVisible; break; } } - _AKNTRACE_FUNC_EXIT; return highlightVisible; } @@ -283,7 +231,6 @@ TBool CAknItemActionMenu::CollectionSoftkeyVisible( TBool aVisibleCollection ) const { - _AKNTRACE_FUNC_ENTER; TBool softkeyVisible( ETrue ); for ( TInt i = 0; i < iStates.Count(); i++ ) { @@ -304,7 +251,6 @@ break; } } - _AKNTRACE_FUNC_EXIT; return softkeyVisible; } @@ -315,8 +261,6 @@ // CAknItemActionMenuData& CAknItemActionMenu::MenuData() { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; return *iMenuData; } @@ -328,13 +272,11 @@ void CAknItemActionMenu::RegisterCollectionObserverL( MAknCollectionObserver& aObserver ) { - _AKNTRACE_FUNC_ENTER; if ( iObservers.Find( &aObserver ) == KErrNotFound ) { iObservers.InsertL( &aObserver, 0 ); aObserver.SetItemActionMenu( this ); } - _AKNTRACE_FUNC_EXIT; } @@ -345,14 +287,12 @@ void CAknItemActionMenu::RemoveCollectionObserver( MAknCollectionObserver& aObserver ) { - _AKNTRACE_FUNC_ENTER; TInt index( iObservers.Find( &aObserver ) ); if ( index != KErrNotFound ) { iObservers.Remove( index ); UnregisterMenu(); } - _AKNTRACE_FUNC_EXIT; } @@ -362,89 +302,22 @@ // TInt CAknItemActionMenu::CollectionCount() const { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; return iStates.Count(); } // --------------------------------------------------------------------------- -// CAknItemActionMenu::Owner -// --------------------------------------------------------------------------- -// - MObjectProvider* CAknItemActionMenu::Owner() const - { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; - return iOwner; - } - - -// --------------------------------------------------------------------------- -// CAknItemActionMenu::MarkingMode -// --------------------------------------------------------------------------- -// -CAknMarkingMode& CAknItemActionMenu::MarkingMode() - { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; - return *iMarking; - } - - -// --------------------------------------------------------------------------- -// CAknItemActionMenu::CollectionHasMarkedItems -// --------------------------------------------------------------------------- -// -TBool CAknItemActionMenu::CollectionHasMarkedItems() - { - _AKNTRACE_FUNC_ENTER; - TBool markedItems( EFalse ); - for ( TInt i = 0; i < iStates.Count(); i++ ) - { - TInt state( iStates[ i ]->CollectionState() ); - if ( state & MAknCollection::EStateCollectionVisible ) - { - if ( state & MAknCollection::EStateMarkedItems ) - { - markedItems = ETrue; - } - } - } - _AKNTRACE_FUNC_EXIT; - return markedItems; - } - - -// --------------------------------------------------------------------------- -// CAknItemActionMenu::HideMenu -// --------------------------------------------------------------------------- -// -void CAknItemActionMenu::HideMenu() - { - if ( iPopupMenu && !iProcessingCommand ) - { - iPopupMenu->HideMenu(); - } - } - - -// --------------------------------------------------------------------------- // CAknItemActionMenu::CAknItemActionMenu // --------------------------------------------------------------------------- // -CAknItemActionMenu::CAknItemActionMenu( MObjectProvider* aOwner ) +CAknItemActionMenu::CAknItemActionMenu() : iPopupMenu( NULL ), iMenuBarObserver( NULL ), iMenuBar( NULL ), iMenuPane( NULL ), - iMenuData( NULL ), - iOwner( aOwner ), - iMarking( NULL ) + iMenuData( NULL ) { - _AKNTRACE_FUNC_ENTER; AKNTASHOOK_ADD( this, "CAknItemActionMenu" ); - _AKNTRACE_FUNC_EXIT; } @@ -454,11 +327,8 @@ // void CAknItemActionMenu::ConstructL( MAknCollection& aCollection ) { - _AKNTRACE_FUNC_ENTER; AddCollectionStateL( aCollection ); iMenuData = CAknItemActionMenuData::NewL(); - iMarking = CAknMarkingMode::NewL( *this, iStates ); - _AKNTRACE_FUNC_EXIT; } @@ -468,7 +338,6 @@ // TInt CAknItemActionMenu::LaunchSubMenuQueryL( const TDesC& aHeading ) { - _AKNTRACE_FUNC_ENTER; TInt selectedIndex( KInvalidListIndex ); if ( iMenuData->Count() ) { @@ -484,7 +353,6 @@ } queryDialog->RunLD(); } - _AKNTRACE_FUNC_EXIT; return ++selectedIndex; } @@ -496,7 +364,6 @@ void CAknItemActionMenu::NotifyChangeToActiveObserver( TBool aCollectionVisible ) { - _AKNTRACE_FUNC_ENTER; for ( TInt i = 0; i < iObservers.Count(); i++ ) { MAknCollectionObserver* observer( iObservers[ i ] ); @@ -506,7 +373,6 @@ break; } } - _AKNTRACE_FUNC_EXIT; } @@ -518,8 +384,6 @@ CCoeControl* /*aMenuControl*/, TBool /*aEmphasis*/ ) { - _AKNTRACE_FUNC_ENTER; - _AKNTRACE_FUNC_EXIT; } @@ -529,7 +393,6 @@ // void CAknItemActionMenu::ProcessCommandL( TInt aCommandId ) { - _AKNTRACE_FUNC_ENTER; MAknCollection* informState ( NULL ); // Store collection state before sending the command for ( TInt i = 0; i < iStates.Count(); i++ ) @@ -550,33 +413,25 @@ { TMenuItemTextBuf text = iMenuData->MenuItemText( aCommandId ); iMenuData->Reset(); - iMenuPane->AddCascadeMenuItemsToMenuL( - cascadeId, EFalse, ETrue, iMenuData ); + iMenuPane->AddCascadeMenuItemsToActionMenuL( + cascadeId, EFalse, *iMenuData ); aCommandId = LaunchSubMenuQueryL( text ); } - if ( aCommandId > 0 && iMenuData->MenuItemCommandId( aCommandId ) - == EAknCmdMarkingModeMarkOne && iMenuBar ) - { - MarkingMode().MarkCurrentItemL(); - } - else if ( aCommandId > 0 && iMenuBarObserver ) + if ( aCommandId > 0 && iMenuBarObserver ) { iProcessingCommand = ETrue; iMenuBarObserver->ProcessCommandL( iMenuData->MenuItemCommandId( aCommandId ) ); iProcessingCommand = EFalse; - // Try exit marking mode - MarkingMode().TryExitMarkingMode(); } } // Inform collection that submenu was closed - if ( informState && iStates.Find( informState ) != KErrNotFound ) + if ( iStates.Find( informState ) != KErrNotFound ) { informState->ItemActionMenuClosed(); } UnregisterMenu(); - _AKNTRACE_FUNC_EXIT; } @@ -586,7 +441,6 @@ // void CAknItemActionMenu::UnregisterMenu() { - _AKNTRACE_FUNC_ENTER; if ( !iProcessingCommand && !iStates.Count() && !iObservers.Count() ) { delete iPopupMenu; @@ -595,8 +449,6 @@ iMenuPane = NULL; AknItemActionMenuRegister::UnregisterItemActionMenu( *this ); } - _AKNTRACE_FUNC_EXIT; } // End of File -