diff -r 9ba538e329bd -r 7d9067c6fcb1 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersave.cpp --- a/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersave.cpp Thu Jan 07 12:46:23 2010 +0200 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersave.cpp Mon Jan 18 20:19:20 2010 +0200 @@ -11,53 +11,27 @@ * * Contributors: * -* Description: Delete command handler +* Description: Save command handler * */ - - #include "glxcommandhandlersave.h" -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include // for CGlxResourceUtilities #include -#include -#include -#include -#include -#include -#include #include -#include #include -#include -#include -#include "glxcommandfactory.h" - - - +#include // --------------------------------------------------------------------------- // Two-phased constructor. // --------------------------------------------------------------------------- // -EXPORT_C CGlxCommandHandlerSave* CGlxCommandHandlerSave::NewL( - MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) +EXPORT_C CGlxCommandHandlerSave* CGlxCommandHandlerSave::NewL() { TRACER("CGlxCommandHandlerSave::NewL"); - CGlxCommandHandlerSave* self = new (ELeave) CGlxCommandHandlerSave(aMediaListProvider, aHasToolbarItem); + CGlxCommandHandlerSave* self = new (ELeave) CGlxCommandHandlerSave(); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -69,8 +43,7 @@ // might leave. // --------------------------------------------------------------------------- // -CGlxCommandHandlerSave::CGlxCommandHandlerSave(MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem) - : CGlxMpxCommandCommandHandler( aMediaListProvider, aHasToolbarItem ) +CGlxCommandHandlerSave::CGlxCommandHandlerSave() { // Don't do anything. } @@ -82,21 +55,7 @@ void CGlxCommandHandlerSave::ConstructL() { TRACER("CGlxCommandHandlerSave::ConstructL"); - iUiUtility = CGlxUiUtility::UtilityL(); iImageViewerInstance = CGlxImageViewerManager::InstanceL(); - // Load resource file - TParse parse; - parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL); - TFileName resourceFile; - resourceFile.Append(parse.FullName()); - CGlxResourceUtilities::GetResourceFilenameL(resourceFile); - iResourceOffset = CCoeEnv::Static()->AddResourceFileL(resourceFile); - - // Add supported command - TCommandInfo saveInfo( EGlxCmdSave ); - // Filter out static items - saveInfo.iMinSelectionLength = 1; - AddCommandL(saveInfo); } // --------------------------------------------------------------------------- @@ -106,14 +65,6 @@ EXPORT_C CGlxCommandHandlerSave::~CGlxCommandHandlerSave() { TRACER("CGlxCommandHandlerSave::~CGlxCommandHandlerSave"); - if (iResourceOffset) - { - CCoeEnv::Static()->DeleteResourceFile(iResourceOffset); - } - if(iUiUtility) - { - iUiUtility->Close(); - } if ( NULL != iImageViewerInstance) { iImageViewerInstance->DeleteInstance(); @@ -121,20 +72,26 @@ } // --------------------------------------------------------------------------- -// Create an add to container command +// Create save command // --------------------------------------------------------------------------- // -CMPXCommand* CGlxCommandHandlerSave::CreateCommandL(TInt /*aCommandId*/, - MGlxMediaList& /*aMediaList*/, TBool& /*aConsume*/) const +TBool CGlxCommandHandlerSave::ExecuteL(TInt aCommandId) { TRACER("CGlxCommandHandlerSave::CreateCommandL"); - CMPXCommand* command = NULL; - TDataType nullType; - CDocumentHandler* handler = CDocumentHandler::NewLC( NULL ); - HBufC* imagePath = iImageViewerInstance->ImageUri(); - TInt err = handler->CopyL( *imagePath, *imagePath, nullType, NULL ); - CleanupStack::PopAndDestroy(handler); - return command; + if(aCommandId == EGlxCmdSave) + { + TDataType nullType; + RFile64& imageHandle = iImageViewerInstance->ImageFileHandle(); + if ( imageHandle.SubSessionHandle() != KNullHandle ) + { + CDocumentHandler* handler = CDocumentHandler::NewLC(NULL); + __ASSERT_ALWAYS(handler, Panic(EGlxPanicNullPointer)); + TRAP_IGNORE(handler->CopyL(imageHandle, KNullDesC, nullType, NULL)); + CleanupStack::PopAndDestroy(handler); + } + return ETrue; + } + return EFalse; } // --------------------------------------------------------------------------- // DynInitMenuPaneL @@ -161,7 +118,16 @@ // ---------------------------------------------------------------------------- void CGlxCommandHandlerSave::DoActivateL(TInt /*aViewId*/) { + // Do Nothing + } +// ----------------------------------------------------------------------------- +// Deactivate +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerSave::Deactivate() + { + // Do Nothing } // ---------------------------------------------------------------------------- @@ -174,7 +140,7 @@ // Is the key event from the Cancel (Backspace) key if (aKeyEvent.iCode == EKeyBackspace && aType == EEventKey) { - // try to execute the delete command + // try to execute the save command if(ExecuteL( EGlxCmdSave )) { response = EKeyWasConsumed; @@ -183,15 +149,13 @@ return response; } -// ---------------------------------------------------------------------------- -// PopulateToolbar -// ---------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// ----------------------------------------------------------------------------- // -void CGlxCommandHandlerSave::PopulateToolbarL() +void CGlxCommandHandlerSave::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) { - TRACER( "CGlxCommandHandlerRename::PopulateToolbar" ); - - iUiUtility->ScreenFurniture()->SetTooltipL( EGlxCmdSave, CAknButton::EPositionLeft ); + // Do Nothing } - - + +//End of file