diff -r f7f0874bfe7d -r 6b87b143d312 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwedit.cpp --- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwedit.cpp Tue Feb 02 10:12:14 2010 +0200 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandleraiwedit.cpp Fri Feb 19 22:51:01 2010 +0200 @@ -25,7 +25,7 @@ #include #include #include - +#include #include #include #include @@ -39,15 +39,16 @@ #include "AiwServiceHandler.h" // AIW service handler #include "glxmedia.h" -const TInt KGlxAiwEditCommandSpace = 0x00000200; // ----------------------------------------------------------------------------- // NewL // ----------------------------------------------------------------------------- // -EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL(MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) +EXPORT_C CGlxCommandHandlerAiwEdit* CGlxCommandHandlerAiwEdit::NewL( + MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) { - CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit(aMediaListProvider, aCommandSingleClick); + CGlxCommandHandlerAiwEdit* self = new (ELeave) CGlxCommandHandlerAiwEdit( + aMediaListProvider, aCommandSingleClick); CleanupStack::PushL(self); self->ConstructL(); CleanupStack::Pop(self); @@ -61,6 +62,11 @@ EXPORT_C CGlxCommandHandlerAiwEdit::~CGlxCommandHandlerAiwEdit() { delete iServiceHandler; + + if (NULL != iImageViewerInstance) + { + iImageViewerInstance->DeleteInstance(); + } } // ----------------------------------------------------------------------------- @@ -70,13 +76,13 @@ void CGlxCommandHandlerAiwEdit::ConstructL() { TRAP_IGNORE( - { - iServiceHandler = CAiwServiceHandler::NewL(); - iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); - iEditSupported = ETrue; - } ); - - if(iCommandSingleClick) + { + iServiceHandler = CAiwServiceHandler::NewL(); + iServiceHandler->AttachL( R_GLX_AIW_EDIT_INTEREST ); + iEditSupported = ETrue; + }); + + if (iCommandSingleClick) { TCommandInfo info(EGlxCmdAiwSingleClickEdit); AddCommandL(info); @@ -86,15 +92,18 @@ TCommandInfo info(EGlxCmdAiwEdit); AddCommandL(info); } + + iImageViewerInstance = CGlxImageViewerManager::InstanceL(); } // ----------------------------------------------------------------------------- // CGlxCommandHandlerAiwEdit // ----------------------------------------------------------------------------- // -CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick ) - :CGlxMediaListCommandHandler(aMediaListProvider), - iCommandSingleClick(aCommandSingleClick) +CGlxCommandHandlerAiwEdit::CGlxCommandHandlerAiwEdit( + MGlxMediaListProvider* aMediaListProvider, TBool aCommandSingleClick) : + CGlxMediaListCommandHandler(aMediaListProvider), iCommandSingleClick( + aCommandSingleClick) { // Do Nothing } @@ -112,51 +121,68 @@ // DynInitMenuPaneL // ----------------------------------------------------------------------------- // -void CGlxCommandHandlerAiwEdit::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) +void CGlxCommandHandlerAiwEdit::DynInitMenuPaneL(TInt aResourceId, + CEikMenuPane* aMenuPane) { MGlxMediaList& mediaList = MediaList(); TInt pos; - - if (aMenuPane && iCommandSingleClick && aMenuPane->MenuItemExists(EGlxCmdAiwSingleClickEdit, pos) - && (mediaList.SelectionCount() > 1)) + + if (aMenuPane) { - aMenuPane->SetItemDimmed(EGlxCmdAiwSingleClickEdit, ETrue); + //If stylus menu is present, hide it for multiple selection + if (iCommandSingleClick && aMenuPane->MenuItemExists( + EGlxCmdAiwSingleClickEdit, pos) + && (mediaList.SelectionCount() > 1)) + { + aMenuPane->SetItemDimmed(EGlxCmdAiwSingleClickEdit, ETrue); + } + //For Edit menu item present in Options CBA + else if (aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos)) + { + // If the image path is private or view is in grid & + // selection is not equal to 1, we should hide Edit menu item + if (iImageViewerInstance->IsPrivate() || + (mediaList.SelectionCount() != 1 + && !IsInFullScreenViewingModeL())) + { + aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); + } + } } - else if (aMenuPane && aMenuPane->MenuItemExists(EGlxCmdAiwEdit, pos) - && (mediaList.SelectionCount() != 1) && !IsInFullScreenViewingModeL()) - { - aMenuPane->SetItemDimmed(EGlxCmdAiwEdit, ETrue); - } - } // ----------------------------------------------------------------------------- // DoExecuteL // ----------------------------------------------------------------------------- // -TBool CGlxCommandHandlerAiwEdit::DoExecuteL( TInt aCommandId , MGlxMediaList& aList) +TBool CGlxCommandHandlerAiwEdit::DoExecuteL(TInt aCommandId, + MGlxMediaList& aList) { TBool handled = EFalse; - if (iEditSupported && (EGlxCmdAiwEdit == aCommandId || EGlxCmdAiwSingleClickEdit == aCommandId)) - { + if (iEditSupported && (EGlxCmdAiwEdit == aCommandId + || EGlxCmdAiwSingleClickEdit == aCommandId)) + { CAiwGenericParamList& inputParams = iServiceHandler->InParamListL(); - + TGlxSelectionIterator iterator; iterator.SetToFirst(&aList); TInt index = iterator++; const TGlxMedia& mediaItem = aList.Item(index); - - TAiwGenericParam param( EGenericParamFile, TAiwVariant(mediaItem.Uri())); - inputParams.AppendL( param ); - - TAiwGenericParam param2( EGenericParamMIMEType, TAiwVariant(mediaItem.MimeType())); - inputParams.AppendL( param2 ); + + TAiwGenericParam param(EGenericParamFile, + TAiwVariant(mediaItem.Uri())); + inputParams.AppendL(param); + + TAiwGenericParam param2(EGenericParamMIMEType, TAiwVariant( + mediaItem.MimeType())); + inputParams.AppendL(param2); // Execute the KAiwCmdUpload command EGlxCmdAiwEdit - iServiceHandler->ExecuteServiceCmdL(KAiwCmdEdit, inputParams, iServiceHandler->OutParamListL()); + iServiceHandler->ExecuteServiceCmdL(KAiwCmdEdit, inputParams, + iServiceHandler->OutParamListL()); handled = ETrue; - } + } return handled; } @@ -168,27 +194,30 @@ { TRACER("CGlxCommandHandlerAiwEdit::IsInFullScreenViewingModeL()"); TBool fullscreenViewingMode = EFalse; - CGlxNavigationalState* aNavigationalState = CGlxNavigationalState::InstanceL(); + CGlxNavigationalState* aNavigationalState = + CGlxNavigationalState::InstanceL(); CMPXCollectionPath* naviState = aNavigationalState->StateLC(); - - if ( naviState->Levels() >= 1) + + if (naviState->Levels() >= 1) { - if (aNavigationalState->ViewingMode() == NGlxNavigationalState::EBrowse) + if (aNavigationalState->ViewingMode() + == NGlxNavigationalState::EBrowse) { // For image viewer collection, goto view mode - if (naviState->Id() == TMPXItemId(KGlxCollectionPluginImageViewerImplementationUid)) + if (naviState->Id() == TMPXItemId( + KGlxCollectionPluginImageViewerImplementationUid)) { //it means we are in img viewer fullscreenViewingMode = ETrue; } - } - else + } + else { //it means we are in Fullscreen fullscreenViewingMode = ETrue; - } + } } - CleanupStack::PopAndDestroy( naviState ); + CleanupStack::PopAndDestroy(naviState); aNavigationalState->Close(); return fullscreenViewingMode; }