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