|
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 { |
|
140 // No implementation |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // OfferKeyEventL |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 TKeyResponse CGlxCommandHandlerHelp:: |
|
148 OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/, TEventCode /*aType*/) |
|
149 { |
|
150 return EKeyWasNotConsumed; |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // PreDynInitMenuPaneL |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 void CGlxCommandHandlerHelp::PreDynInitMenuPaneL( TInt /*aResourceId*/ ) |
|
158 { |
|
159 // No implementation |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // LaunchHelpL |
|
164 // ----------------------------------------------------------------------------- |
|
165 // |
|
166 void CGlxCommandHandlerHelp::LaunchHelpL() |
|
167 { |
|
168 TCoeHelpContext helpContext; |
|
169 |
|
170 helpContext.iMajor = iHelpContext.iMajor; |
|
171 |
|
172 if(iInFullScreen) |
|
173 { |
|
174 helpContext.iContext = iHelpContext.iViewContext; |
|
175 } |
|
176 else |
|
177 { |
|
178 helpContext.iContext = iHelpContext.iBrowseContext; |
|
179 } |
|
180 |
|
181 |
|
182 // Create the context array and append the single context item |
|
183 CArrayFix<TCoeHelpContext>* contextArray = |
|
184 new ( ELeave ) CArrayFixFlat<TCoeHelpContext> ( 1 ); |
|
185 |
|
186 CleanupStack::PushL( contextArray ); |
|
187 contextArray->AppendL( helpContext ); |
|
188 CleanupStack::Pop( contextArray ); |
|
189 |
|
190 //Launch help - takes ownership of context array |
|
191 RWsSession& wsSession = CCoeEnv::Static()->WsSession(); |
|
192 HlpLauncher::LaunchHelpApplicationL( wsSession, |
|
193 contextArray ); |
|
194 } |