60
|
1 |
/*
|
|
2 |
* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Launch help application with appropriate help context
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
/**
|
|
23 |
* @internal reviewed 03/07/2007 by David Holland
|
|
24 |
*/
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
#include "glxcommandhandlerhelp.h"
|
|
29 |
#include <glxcommandhandlers.hrh>
|
|
30 |
|
|
31 |
#include <glxgallery.hrh>
|
|
32 |
|
|
33 |
#include <avkon.hrh>
|
|
34 |
#include <coemain.h>
|
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
// Constructor.
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
EXPORT_C TGlxHelpContext::TGlxHelpContext()
|
|
41 |
{
|
|
42 |
iMajor = TUid::Uid( KGlxGalleryApplicationUid );
|
|
43 |
iBrowseContext = KNullDesC;
|
|
44 |
iViewContext = KNullDesC;
|
|
45 |
}
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
// Two-phased constructor.
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
EXPORT_C CGlxCommandHandlerHelp*
|
|
52 |
CGlxCommandHandlerHelp::NewL(TGlxHelpContext aHelpContext)
|
|
53 |
{
|
|
54 |
CGlxCommandHandlerHelp* self = new ( ELeave )
|
|
55 |
CGlxCommandHandlerHelp(aHelpContext);
|
|
56 |
|
|
57 |
return self;
|
|
58 |
}
|
|
59 |
|
|
60 |
// ---------------------------------------------------------------------------
|
|
61 |
// C++ default constructor can NOT contain any code, that
|
|
62 |
// might leave.
|
|
63 |
// ---------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CGlxCommandHandlerHelp::CGlxCommandHandlerHelp(TGlxHelpContext aHelpContext)
|
|
66 |
:CGlxCommandHandler(), iHelpContext(aHelpContext)
|
|
67 |
{
|
|
68 |
// Do nothing
|
|
69 |
}
|
|
70 |
|
|
71 |
|
|
72 |
// ---------------------------------------------------------------------------
|
|
73 |
// Destructor
|
|
74 |
// ---------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
EXPORT_C CGlxCommandHandlerHelp::~CGlxCommandHandlerHelp()
|
|
77 |
{
|
|
78 |
// No implementation
|
|
79 |
}
|
|
80 |
|
|
81 |
// ---------------------------------------------------------------------------
|
|
82 |
// DoActivateL
|
|
83 |
// ---------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
void CGlxCommandHandlerHelp::DoActivateL(TInt /*aViewId*/)
|
|
86 |
{
|
|
87 |
// No implementation
|
|
88 |
}
|
|
89 |
|
|
90 |
// ---------------------------------------------------------------------------
|
|
91 |
// Deactivate
|
|
92 |
// ---------------------------------------------------------------------------
|
|
93 |
//
|
|
94 |
void CGlxCommandHandlerHelp::Deactivate()
|
|
95 |
{
|
|
96 |
// No implementation
|
|
97 |
}
|
|
98 |
|
|
99 |
// -----------------------------------------------------------------------------
|
|
100 |
// DoExecute - the relevant action for the command id
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
TBool CGlxCommandHandlerHelp::ExecuteL(TInt aCommandId)
|
|
104 |
{
|
|
105 |
TBool handledCommand = ETrue;
|
|
106 |
|
|
107 |
switch (aCommandId)
|
|
108 |
{
|
|
109 |
case EAknCmdHelp:
|
|
110 |
{
|
|
111 |
LaunchHelpL();
|
|
112 |
break;
|
|
113 |
}
|
|
114 |
case EGlxCmdStateView:
|
|
115 |
iInFullScreen = ETrue;
|
|
116 |
handledCommand = EFalse;
|
|
117 |
break;
|
|
118 |
|
|
119 |
case EGlxCmdStateBrowse:
|
|
120 |
iInFullScreen = EFalse;
|
|
121 |
handledCommand = EFalse;
|
|
122 |
break;
|
|
123 |
default:
|
|
124 |
{
|
|
125 |
handledCommand = EFalse;
|
|
126 |
break;
|
|
127 |
}
|
|
128 |
}
|
|
129 |
|
|
130 |
return handledCommand;
|
|
131 |
}
|
|
132 |
|
|
133 |
// ---------------------------------------------------------------------------
|
|
134 |
// DynInitMenuPaneL
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
void CGlxCommandHandlerHelp::DynInitMenuPaneL(TInt /*aResourceId*/,
|
|
138 |
CEikMenuPane* /*aMenuPane*/,
|
|
139 |
TBool /*aIsBrowseMode*/)
|
|
140 |
{
|
|
141 |
// No implementation
|
|
142 |
}
|
|
143 |
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
// OfferKeyEventL
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
TKeyResponse CGlxCommandHandlerHelp::
|
|
149 |
OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/)
|
|
150 |
{
|
|
151 |
return EKeyWasNotConsumed;
|
|
152 |
}
|
|
153 |
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
// PreDynInitMenuPaneL
|
|
156 |
// ---------------------------------------------------------------------------
|
|
157 |
//
|
|
158 |
void CGlxCommandHandlerHelp::PreDynInitMenuPaneL( TInt /*aResourceId*/ )
|
|
159 |
{
|
|
160 |
// No implementation
|
|
161 |
}
|
|
162 |
|
|
163 |
// -----------------------------------------------------------------------------
|
|
164 |
// LaunchHelpL
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
void CGlxCommandHandlerHelp::LaunchHelpL()
|
|
168 |
{
|
|
169 |
TCoeHelpContext helpContext;
|
|
170 |
|
|
171 |
helpContext.iMajor = iHelpContext.iMajor;
|
|
172 |
|
|
173 |
if(iInFullScreen)
|
|
174 |
{
|
|
175 |
helpContext.iContext = iHelpContext.iViewContext;
|
|
176 |
}
|
|
177 |
else
|
|
178 |
{
|
|
179 |
helpContext.iContext = iHelpContext.iBrowseContext;
|
|
180 |
}
|
|
181 |
|
|
182 |
|
|
183 |
// Create the context array and append the single context item
|
|
184 |
CArrayFix<TCoeHelpContext>* contextArray =
|
|
185 |
new ( ELeave ) CArrayFixFlat<TCoeHelpContext> ( 1 );
|
|
186 |
|
|
187 |
CleanupStack::PushL( contextArray );
|
|
188 |
contextArray->AppendL( helpContext );
|
|
189 |
CleanupStack::Pop( contextArray );
|
|
190 |
|
|
191 |
//Launch help - takes ownership of context array
|
|
192 |
RWsSession& wsSession = CCoeEnv::Static()->WsSession();
|
|
193 |
HlpLauncher::LaunchHelpApplicationL( wsSession,
|
|
194 |
contextArray );
|
|
195 |
}
|