|
1 /* |
|
2 * Copyright (c) 2005 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: GSGenPlugin source code. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // Includes |
|
20 #include "GSGenPlugin.h" |
|
21 #include "GsLogger.h" |
|
22 #include <gsfwviewuids.h> |
|
23 #include <gsgenplugin.mbg> // Icons |
|
24 #include <GSGenPluginRsc.rsg> |
|
25 #include <gsmainview.h> |
|
26 #include <gsprivatepluginproviderids.h> |
|
27 #include <csxhelp/cp.hlp.hrh> |
|
28 #include <aknViewAppUi.h> |
|
29 #include <ConeResLoader.h> |
|
30 #include <StringLoader.h> |
|
31 #include <barsread.h> // For TResourceReader |
|
32 #include <featmgr.h> |
|
33 |
|
34 #ifndef RD_CONTROL_PANEL |
|
35 #include <GSTabHelper.h> |
|
36 #endif //RD_CONTROL_PANEL |
|
37 |
|
38 // Constants |
|
39 |
|
40 |
|
41 // ========================= MEMBER FUNCTIONS ================================ |
|
42 |
|
43 |
|
44 // --------------------------------------------------------------------------- |
|
45 // CGSGenPlugin::CGSGenPlugin() |
|
46 // |
|
47 // |
|
48 // --------------------------------------------------------------------------- |
|
49 // |
|
50 CGSGenPlugin::CGSGenPlugin() |
|
51 : CGSParentPlugin(), iResourceLoader( *iCoeEnv ) |
|
52 { |
|
53 __GSLOGSTRING( "[CGSGenPlugin] CGSGenPlugin()" ); |
|
54 |
|
55 } |
|
56 |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CGSGenPlugin::~CGSGenPlugin() |
|
60 // |
|
61 // |
|
62 // --------------------------------------------------------------------------- |
|
63 // |
|
64 CGSGenPlugin::~CGSGenPlugin() |
|
65 { |
|
66 __GSLOGSTRING( "[CGSGenPlugin] ~CGSGenPlugin()|->" ); |
|
67 FeatureManager::UnInitializeLib(); |
|
68 iResourceLoader.Close(); |
|
69 |
|
70 #ifndef RD_CONTROL_PANEL |
|
71 if ( iTabHelper ) |
|
72 { |
|
73 delete iTabHelper; |
|
74 } |
|
75 #endif //RD_CONTROL_PANEL |
|
76 __GSLOGSTRING( "[CGSGenPlugin] ~CGSGenPlugin()-|" ); |
|
77 } |
|
78 |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // CGSGenPlugin::ConstructL() |
|
82 // |
|
83 // |
|
84 // --------------------------------------------------------------------------- |
|
85 // |
|
86 void CGSGenPlugin::ConstructL() |
|
87 { |
|
88 __GSLOGSTRING( "[CGSGenPlugin] ConstructL()|->" ); |
|
89 FeatureManager::InitializeLibL(); |
|
90 OpenLocalizedResourceFileL( KGSGenPluginResourceFileName, |
|
91 iResourceLoader ); |
|
92 BaseConstructL( R_GS_GEN_VIEW, R_GS_GEN_VIEW_TITLE ); |
|
93 |
|
94 #ifndef RD_CONTROL_PANEL |
|
95 iTabHelper = CGSTabHelper::NewL(); |
|
96 #endif //RD_CONTROL_PANEL |
|
97 __GSLOGSTRING( "[CGSGenPlugin] ConstructL()-|" ); |
|
98 } |
|
99 |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // CGSGenPlugin::NewL() |
|
103 // |
|
104 // |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 CGSGenPlugin* CGSGenPlugin::NewL( TAny* /*aInitParams*/ ) |
|
108 { |
|
109 __GSLOGSTRING( "[CGSGenPlugin] NewL()" ); |
|
110 |
|
111 CGSGenPlugin* self = new(ELeave) CGSGenPlugin(); |
|
112 CleanupStack::PushL(self); |
|
113 self->ConstructL(); |
|
114 CleanupStack::Pop(self); |
|
115 return self; |
|
116 } |
|
117 |
|
118 |
|
119 // --------------------------------------------------------------------------- |
|
120 // CGSParentPlugin::Id() |
|
121 // |
|
122 // |
|
123 // --------------------------------------------------------------------------- |
|
124 // |
|
125 TUid CGSGenPlugin::Id() const |
|
126 { |
|
127 __GSLOGSTRING1( "[CGSGenPlugin] Id():0x%X", KGSGenPluginUid.iUid ); |
|
128 return KGSGenPluginUid; |
|
129 } |
|
130 |
|
131 |
|
132 // --------------------------------------------------------------------------- |
|
133 // CGSParentPlugin::DoActivateL() |
|
134 // |
|
135 // |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 void CGSGenPlugin::DoActivateL |
|
139 ( const TVwsViewId& aPrevViewId, |
|
140 TUid aCustomMessageId, |
|
141 const TDesC8& aCustomMessage ) |
|
142 { |
|
143 __GSLOGSTRING( "[CGSGenPlugin] DoActivateL()|->" ); |
|
144 CGSParentPlugin::DoActivateL( aPrevViewId, |
|
145 aCustomMessageId, |
|
146 aCustomMessage ); |
|
147 CGSMainView* parent = |
|
148 static_cast<CGSMainView*> ( AppUi()->View( KGSMainViewUid ) ); |
|
149 |
|
150 |
|
151 #ifndef RD_CONTROL_PANEL |
|
152 // Create tab group for this view (do only if casting parent succeeds): |
|
153 if( parent ) |
|
154 { |
|
155 iTabHelper->CreateTabGroupL( Id(), parent ); |
|
156 } |
|
157 #endif //RD_CONTROL_PANEL |
|
158 __GSLOGSTRING( "[CGSGenPlugin] DoActivateL()-|" ); |
|
159 } |
|
160 |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // CGSParentPlugin::DoDeactivate() |
|
164 // |
|
165 // |
|
166 // --------------------------------------------------------------------------- |
|
167 // |
|
168 void CGSGenPlugin::DoDeactivate() |
|
169 { |
|
170 __GSLOGSTRING( "[CGSGenPlugin] DoDeactivate()|->" ); |
|
171 CGSParentPlugin::DoDeactivate(); |
|
172 |
|
173 #ifndef RD_CONTROL_PANEL |
|
174 iTabHelper->RemoveTabGroup(); |
|
175 #endif //RD_CONTROL_PANEL |
|
176 __GSLOGSTRING( "[CGSGenPlugin] DoDeactivate()-|" ); |
|
177 } |
|
178 |
|
179 |
|
180 // ========================= From CGSParentPlugin ===================== |
|
181 |
|
182 |
|
183 // --------------------------------------------------------------------------- |
|
184 // CGSGenPlugin::UpperLevelViewUid() |
|
185 // |
|
186 // |
|
187 // --------------------------------------------------------------------------- |
|
188 // |
|
189 TUid CGSGenPlugin::UpperLevelViewUid() |
|
190 { |
|
191 return KGSMainViewUid; |
|
192 } |
|
193 |
|
194 |
|
195 // ========================= From CGSPluginInterface ================== |
|
196 |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // CGSGenPlugin::GetCaptionL() |
|
200 // |
|
201 // |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 void CGSGenPlugin::GetCaptionL( TDes& aCaption ) const |
|
205 { |
|
206 __GSLOGSTRING( "[CGSGenPlugin] GetCaptionL()|->" ); |
|
207 // The resource file is already opened by iResourceLoader. |
|
208 HBufC* result = StringLoader::LoadL( R_GS_GEN_VIEW_CAPTION ); |
|
209 aCaption.Copy( *result ); |
|
210 delete result; |
|
211 __GSLOGSTRING( "[CGSGenPlugin] GetCaptionL()-|" ); |
|
212 } |
|
213 |
|
214 |
|
215 // --------------------------------------------------------------------------- |
|
216 // CGSGenPlugin::PluginProviderCategory() |
|
217 // |
|
218 // |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 TInt CGSGenPlugin::PluginProviderCategory() const |
|
222 { |
|
223 return KGSPluginProviderInternal; |
|
224 } |
|
225 |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CGSGenPlugin::GetHelpContext() |
|
229 // |
|
230 // |
|
231 // ----------------------------------------------------------------------------- |
|
232 // |
|
233 void CGSGenPlugin::GetHelpContext( TCoeHelpContext& aContext ) |
|
234 { |
|
235 aContext.iMajor = KUidGS; |
|
236 aContext.iContext = KCP_HLP_DEVICE; |
|
237 } |
|
238 |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // CGSGenPlugin::CreateIconL() |
|
242 // |
|
243 // |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 CGulIcon* CGSGenPlugin::CreateIconL( const TUid aIconType ) |
|
247 { |
|
248 //EMbm<Mbm_file_name><Bitmap_name> |
|
249 CGulIcon* icon; |
|
250 TParse* fp = new( ELeave ) TParse(); |
|
251 CleanupStack::PushL( fp ); |
|
252 fp->Set( KGSGenPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); |
|
253 |
|
254 if( aIconType == KGSIconTypeLbxItem ) |
|
255 { |
|
256 icon = AknsUtils::CreateGulIconL( |
|
257 AknsUtils::SkinInstance(), |
|
258 KAknsIIDQgnPropCpDev, |
|
259 fp->FullName(), |
|
260 EMbmGsgenpluginQgn_prop_cp_dev, |
|
261 EMbmGsgenpluginQgn_prop_cp_dev_mask ); |
|
262 } |
|
263 else |
|
264 { |
|
265 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
266 } |
|
267 |
|
268 CleanupStack::PopAndDestroy( fp ); |
|
269 |
|
270 return icon; |
|
271 } |
|
272 |
|
273 |
|
274 // ---------------------------------------------------------------------------- |
|
275 // CGSGenPlugin::DynInitMenuPaneL() |
|
276 // |
|
277 // Display the dynamic menu |
|
278 // ---------------------------------------------------------------------------- |
|
279 void CGSGenPlugin::DynInitMenuPaneL( TInt aResourceId, |
|
280 CEikMenuPane* aMenuPane ) |
|
281 { |
|
282 // show or hide the 'help' menu item when supported |
|
283 if( aResourceId == R_GS_MENU_ITEM_HELP ) |
|
284 { |
|
285 User::LeaveIfNull( aMenuPane ); |
|
286 |
|
287 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
288 { |
|
289 aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); |
|
290 } |
|
291 else |
|
292 { |
|
293 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
294 } |
|
295 } |
|
296 } |
|
297 |
|
298 // End of File |