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: GSProfilesPlugin implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // User includes |
|
20 #include "devencgsplugin.h" |
|
21 #include <gsparentplugin.h> |
|
22 #include <gscommon.hrh> |
|
23 #include <devencgspluginrsc.rsg> // GUI Resource |
|
24 #include <devencgsplugin.mbg> |
|
25 #include <gsprivatepluginproviderids.h> |
|
26 #include <hwrmvibrasdkcrkeys.h> |
|
27 #include <AknLaunchAppService.h> |
|
28 #include <AiwCommon.h> |
|
29 // System includes |
|
30 #include <AknNullService.h> |
|
31 #include <bautils.h> |
|
32 #include <StringLoader.h> |
|
33 |
|
34 // ========================= MEMBER FUNCTIONS ================================ |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CDeviceEncryptionGsPlugin::CDeviceEncryptionGsPlugin |
|
38 // |
|
39 // --------------------------------------------------------------------------- |
|
40 // |
|
41 CDeviceEncryptionGsPlugin::CDeviceEncryptionGsPlugin() |
|
42 : iResources( *iCoeEnv ), iNullService(NULL) |
|
43 { |
|
44 } |
|
45 |
|
46 |
|
47 // --------------------------------------------------------------------------- |
|
48 // CDeviceEncryptionGsPlugin::~CDeviceEncryptionGsPlugin |
|
49 // |
|
50 // --------------------------------------------------------------------------- |
|
51 // |
|
52 CDeviceEncryptionGsPlugin::~CDeviceEncryptionGsPlugin() |
|
53 { |
|
54 iResources.Close(); |
|
55 |
|
56 if ( iNullService ) |
|
57 { |
|
58 delete iNullService; |
|
59 } |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // CDeviceEncryptionGsPlugin::ConstructL |
|
65 // |
|
66 // --------------------------------------------------------------------------- |
|
67 // |
|
68 void CDeviceEncryptionGsPlugin::ConstructL() |
|
69 { |
|
70 OpenLocalizedResourceFileL( KDeviceEncryptionGsPluginResourceFileName, iResources ); |
|
71 } |
|
72 |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CDeviceEncryptionGsPlugin::NewL |
|
76 // |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 CDeviceEncryptionGsPlugin* CDeviceEncryptionGsPlugin::NewL( TAny* /*aInitParams*/ ) |
|
80 { |
|
81 CDeviceEncryptionGsPlugin* self = new ( ELeave ) CDeviceEncryptionGsPlugin(); |
|
82 CleanupStack::PushL(self); |
|
83 self->ConstructL(); |
|
84 CleanupStack::Pop(self); |
|
85 return self; |
|
86 } |
|
87 |
|
88 |
|
89 // ----------------------------------------------------------------------------- |
|
90 // CDeviceEncryptionGsPlugin::Id (from CGSPluginInterface) |
|
91 // |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 TUid CDeviceEncryptionGsPlugin::Id() const |
|
95 { |
|
96 return KDeviceEncryptionGsPluginImplUID; |
|
97 } |
|
98 |
|
99 |
|
100 // ----------------------------------------------------------------------------- |
|
101 // CDeviceEncryptionGsPlugin::DoActivateL (from CGSPluginInterface) |
|
102 // |
|
103 // ----------------------------------------------------------------------------- |
|
104 // |
|
105 void CDeviceEncryptionGsPlugin::DoActivateL( const TVwsViewId& /*aPrevViewId*/, |
|
106 TUid /*aCustomMessageId*/, |
|
107 const TDesC8& /*aCustomMessage*/ ) |
|
108 { |
|
109 } |
|
110 |
|
111 |
|
112 // ----------------------------------------------------------------------------- |
|
113 // CDeviceEncryptionGsPlugin::DoDeactivate (from CGSPluginInterface) |
|
114 // |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 void CDeviceEncryptionGsPlugin::DoDeactivate() |
|
118 { |
|
119 } |
|
120 |
|
121 |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // CDeviceEncryptionGsPlugin::GetCaptionL (from CGSPluginInterface) |
|
125 // |
|
126 // ----------------------------------------------------------------------------- |
|
127 // |
|
128 void CDeviceEncryptionGsPlugin::GetCaptionL( TDes& aCaption ) const |
|
129 { |
|
130 // HBufC* result = iEikonEnv->AllocReadResourceAsDes16L( R_GS_DE_PLUGIN_CAPTION ); |
|
131 HBufC* result = StringLoader::LoadL( R_GS_DE_PLUGIN_CAPTION ); |
|
132 |
|
133 if (result->Des().Length() < aCaption.MaxLength()) |
|
134 { |
|
135 aCaption.Copy( *result ); |
|
136 } |
|
137 else |
|
138 { |
|
139 aCaption = KNullDesC; |
|
140 } |
|
141 |
|
142 delete result; |
|
143 // aCaption.Copy( _L("Device Encryption") ); |
|
144 } |
|
145 |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // CDeviceEncryptionGsPlugin::PluginProviderCategory (from CGSPluginInterface) |
|
149 // |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TInt CDeviceEncryptionGsPlugin::PluginProviderCategory() const |
|
153 { |
|
154 return KGSPluginProviderInternal; |
|
155 } |
|
156 |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CDeviceEncryptionGsPlugin::ItemType (from CGSPluginInterface) |
|
160 // |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TGSListboxItemTypes CDeviceEncryptionGsPlugin::ItemType() |
|
164 { |
|
165 return EGSItemTypeSettingDialog; |
|
166 } |
|
167 |
|
168 |
|
169 // ----------------------------------------------------------------------------- |
|
170 // CDeviceEncryptionGsPlugin::GetValue (from CGSPluginInterface) |
|
171 // |
|
172 // ----------------------------------------------------------------------------- |
|
173 // |
|
174 void CDeviceEncryptionGsPlugin::GetValue( const TGSPluginValueKeys /*aKey*/, |
|
175 TDes& /*aValue*/ ) |
|
176 { |
|
177 } |
|
178 |
|
179 |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CDeviceEncryptionGsPlugin::HandleSelection (from CGSPluginInterface) |
|
182 // |
|
183 // ----------------------------------------------------------------------------- |
|
184 // |
|
185 void CDeviceEncryptionGsPlugin::HandleSelection( |
|
186 const TGSSelectionTypes /*aSelectionType*/ ) |
|
187 { |
|
188 //TRAP_IGNORE( LaunchDEAppL() ); |
|
189 LaunchDEAppL(); |
|
190 } |
|
191 |
|
192 // --------------------------------------------------------------------------- |
|
193 // CDeviceEncryptionGsPlugin::CreateIconL (from CGSPluginInterface) |
|
194 // |
|
195 // --------------------------------------------------------------------------- |
|
196 // |
|
197 |
|
198 CGulIcon* CDeviceEncryptionGsPlugin::CreateIconL( const TUid aIconType ) |
|
199 { |
|
200 CGulIcon* icon; |
|
201 TParse* fp = new ( ELeave ) TParse(); |
|
202 CleanupStack::PushL( fp ); |
|
203 fp->Set( KDeviceEncryptionGsPluginIconDirAndName, &KDC_BITMAP_DIR, NULL ); |
|
204 |
|
205 if ( aIconType == KGSIconTypeLbxItem ) |
|
206 { |
|
207 icon = AknsUtils::CreateGulIconL( |
|
208 AknsUtils::SkinInstance(), |
|
209 KAknsIIDQgnPropCpPersoProf, |
|
210 //KAknsIIDQgnPropCpDevenc, |
|
211 fp->FullName(), |
|
212 EMbmDevencgspluginQgn_prop_cp_devenc, |
|
213 EMbmDevencgspluginQgn_prop_cp_devenc_mask ); |
|
214 } |
|
215 else |
|
216 { |
|
217 icon = CGSPluginInterface::CreateIconL( aIconType ); |
|
218 } |
|
219 |
|
220 CleanupStack::PopAndDestroy( fp ); |
|
221 |
|
222 return icon; |
|
223 } |
|
224 |
|
225 |
|
226 // ----------------------------------------------------------------------------- |
|
227 // CDeviceEncryptionGsPlugin::OpenLocalizedResourceFileL |
|
228 // |
|
229 // ----------------------------------------------------------------------------- |
|
230 |
|
231 void CDeviceEncryptionGsPlugin::OpenLocalizedResourceFileL( |
|
232 const TDesC& aResourceFileName, |
|
233 RConeResourceLoader& aResourceLoader ) |
|
234 { |
|
235 RFs fsSession; |
|
236 User::LeaveIfError( fsSession.Connect() ); |
|
237 CleanupClosePushL(fsSession); |
|
238 |
|
239 // Find the resource file: |
|
240 TParse parse; |
|
241 parse.Set( aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
242 TFileName fileName( parse.FullName() ); |
|
243 |
|
244 // Get language of resource file: |
|
245 BaflUtils::NearestLanguageFile( fsSession, fileName ); |
|
246 |
|
247 // Open resource file: |
|
248 aResourceLoader.OpenL( fileName ); |
|
249 |
|
250 CleanupStack::PopAndDestroy(&fsSession); |
|
251 } |
|
252 |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CDeviceEncryptionGsPlugin::LaunchProfilesAppL |
|
256 // |
|
257 // ----------------------------------------------------------------------------- |
|
258 // |
|
259 void CDeviceEncryptionGsPlugin::LaunchDEAppL() |
|
260 { |
|
261 // Get the correct application data |
|
262 RWsSession ws; |
|
263 User::LeaveIfError(ws.Connect()); |
|
264 CleanupClosePushL(ws); |
|
265 |
|
266 // Find the task with uid |
|
267 TApaTaskList taskList(ws); |
|
268 TApaTask task = taskList.FindApp( KDeviceEncryptionAppUid ); |
|
269 |
|
270 if ( task.Exists() ) |
|
271 { |
|
272 task.BringToForeground(); |
|
273 } |
|
274 else |
|
275 { |
|
276 //Launch application as embedded |
|
277 TAppInfo app( KDeviceEncryptionAppUid, KDeviceEncryptionApp ); |
|
278 iEmbedded=NULL; |
|
279 EmbedAppL( app ); |
|
280 } |
|
281 CleanupStack::PopAndDestroy(&ws); |
|
282 } |
|
283 |
|
284 |
|
285 // ----------------------------------------------------------------------------- |
|
286 // CDeviceEncryptionGsPlugin::EmbedAppL |
|
287 // |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 void CDeviceEncryptionGsPlugin::EmbedAppL( const TAppInfo& aApp ) |
|
291 { |
|
292 if ( iNullService ) |
|
293 { |
|
294 delete iNullService; |
|
295 iNullService = NULL; |
|
296 } |
|
297 iNullService = CAknNullService::NewL( aApp.iUid, this ); |
|
298 } |
|
299 |
|
300 // End of file |
|