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