diff -r 8e5f6eea9c9f -r 5b3385a43d68 photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerhelp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlerhelp.cpp Wed Sep 01 12:33:26 2010 +0100 @@ -0,0 +1,195 @@ +/* +* Copyright (c) 2008-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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Launch help application with appropriate help context +* +*/ + + + + + +/** + * @internal reviewed 03/07/2007 by David Holland + */ + + + +#include "glxcommandhandlerhelp.h" +#include + +#include + +#include +#include + +// --------------------------------------------------------------------------- +// Constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C TGlxHelpContext::TGlxHelpContext() + { + iMajor = TUid::Uid( KGlxGalleryApplicationUid ); + iBrowseContext = KNullDesC; + iViewContext = KNullDesC; + } + +// --------------------------------------------------------------------------- +// Two-phased constructor. +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerHelp* + CGlxCommandHandlerHelp::NewL(TGlxHelpContext aHelpContext) + { + CGlxCommandHandlerHelp* self = new ( ELeave ) + CGlxCommandHandlerHelp(aHelpContext); + + return self; + } + +// --------------------------------------------------------------------------- +// C++ default constructor can NOT contain any code, that +// might leave. +// --------------------------------------------------------------------------- +// +CGlxCommandHandlerHelp::CGlxCommandHandlerHelp(TGlxHelpContext aHelpContext) +:CGlxCommandHandler(), iHelpContext(aHelpContext) + { + // Do nothing + } + + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +EXPORT_C CGlxCommandHandlerHelp::~CGlxCommandHandlerHelp() + { + // No implementation + } + +// --------------------------------------------------------------------------- +// DoActivateL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::DoActivateL(TInt /*aViewId*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// Deactivate +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::Deactivate() + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// DoExecute - the relevant action for the command id +// ----------------------------------------------------------------------------- +// +TBool CGlxCommandHandlerHelp::ExecuteL(TInt aCommandId) + { + TBool handledCommand = ETrue; + + switch (aCommandId) + { + case EAknCmdHelp: + { + LaunchHelpL(); + break; + } + case EGlxCmdStateView: + iInFullScreen = ETrue; + handledCommand = EFalse; + break; + + case EGlxCmdStateBrowse: + iInFullScreen = EFalse; + handledCommand = EFalse; + break; + default: + { + handledCommand = EFalse; + break; + } + } + + return handledCommand; + } + +// --------------------------------------------------------------------------- +// DynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::DynInitMenuPaneL(TInt /*aResourceId*/, + CEikMenuPane* /*aMenuPane*/, + TBool /*aIsBrowseMode*/) + { + // No implementation + } + +// --------------------------------------------------------------------------- +// OfferKeyEventL +// --------------------------------------------------------------------------- +// +TKeyResponse CGlxCommandHandlerHelp:: + OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) + { + return EKeyWasNotConsumed; + } + +// --------------------------------------------------------------------------- +// PreDynInitMenuPaneL +// --------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) + { + // No implementation + } + +// ----------------------------------------------------------------------------- +// LaunchHelpL +// ----------------------------------------------------------------------------- +// +void CGlxCommandHandlerHelp::LaunchHelpL() + { + TCoeHelpContext helpContext; + + helpContext.iMajor = iHelpContext.iMajor; + + if(iInFullScreen) + { + helpContext.iContext = iHelpContext.iViewContext; + } + else + { + helpContext.iContext = iHelpContext.iBrowseContext; + } + + + // Create the context array and append the single context item + CArrayFix* contextArray = + new ( ELeave ) CArrayFixFlat ( 1 ); + + CleanupStack::PushL( contextArray ); + contextArray->AppendL( helpContext ); + CleanupStack::Pop( contextArray ); + + //Launch help - takes ownership of context array + RWsSession& wsSession = CCoeEnv::Static()->WsSession(); + HlpLauncher::LaunchHelpApplicationL( wsSession, + contextArray ); + }