|
1 /* |
|
2 * Copyright (c) 2008 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: AuthtypePlugin implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // User includes |
|
20 #include "Authtypeplugin.h" |
|
21 |
|
22 #include <gsparentplugin.h> |
|
23 #include <gscommon.hrh> |
|
24 #include <AuthtypepluginRsc.rsg> // GUI Resource |
|
25 #include <Authtypeplugin.mbg> |
|
26 #include <gsprivatepluginproviderids.h> |
|
27 #include <gsfwviewuids.h> |
|
28 #include "ProvisioningInternalCRKeys.h" |
|
29 #include <gsbaseview.h> |
|
30 |
|
31 // System includes |
|
32 #include <AknWaitDialog.h> |
|
33 #include <AknNullService.h> |
|
34 #include <aknnotewrappers.h> |
|
35 #include <akntextsettingpage.h> |
|
36 #include <aknViewAppUi.h> |
|
37 #include <bautils.h> |
|
38 #include <featmgr.h> |
|
39 #include <hlplch.h> // HlpLauncher |
|
40 #include <StringLoader.h> |
|
41 |
|
42 #include <badesca.h> |
|
43 #include <aknlists.h> |
|
44 #include <AknListBoxSettingPage.h> |
|
45 #include <centralrepository.h> |
|
46 #include "ProvisioningDebug.h" |
|
47 |
|
48 // ========================= MEMBER FUNCTIONS ================================ |
|
49 |
|
50 // --------------------------------------------------------------------------- |
|
51 // CAuthtypePlugin::CAuthtypePlugin() |
|
52 // Constructor |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CAuthtypePlugin::CAuthtypePlugin() : |
|
56 iResources( *iCoeEnv) |
|
57 { |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // CAuthtypePlugin::~CAuthtypePlugin() |
|
62 // Destructor |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 CAuthtypePlugin::~CAuthtypePlugin() |
|
66 { |
|
67 iResources.Close(); |
|
68 } |
|
69 |
|
70 // --------------------------------------------------------------------------- |
|
71 // CAuthtypePlugin::ConstructL(const TRect& aRect) |
|
72 // Symbian OS two-phased constructor |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CAuthtypePlugin::ConstructL() |
|
76 { |
|
77 |
|
78 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::ConstructL:" ) ); |
|
79 OpenLocalizedResourceFileL(KOperatorLogoResourceFileName, iResources); |
|
80 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::ConstructL: DONE" ) ); |
|
81 |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------- |
|
85 // CAuthtypePlugin::NewL() |
|
86 // Static constructor |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 CAuthtypePlugin* CAuthtypePlugin::NewL(TAny* /*aInitParams*/) |
|
90 { |
|
91 |
|
92 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::NewL:" ) ); |
|
93 |
|
94 CAuthtypePlugin* self = new( ELeave ) CAuthtypePlugin(); |
|
95 CleanupStack::PushL(self); |
|
96 self->ConstructL(); |
|
97 CleanupStack::Pop(self); |
|
98 return self; |
|
99 |
|
100 } |
|
101 |
|
102 // ----------------------------------------------------------------------------- |
|
103 // CAuthtypePlugin::Id |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 TUid CAuthtypePlugin::Id() const |
|
107 { |
|
108 return KAuthtypePluginUID; |
|
109 } |
|
110 |
|
111 // ----------------------------------------------------------------------------- |
|
112 // CAuthtypePlugin::DoActivateL |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 void CAuthtypePlugin::DoActivateL(const TVwsViewId& /*aPrevViewId*/, |
|
116 TUid /*aCustomMessageId*/, const TDesC8& /*aCustomMessage*/) |
|
117 { |
|
118 |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CAuthtypePlugin::DoDeactivate |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CAuthtypePlugin::DoDeactivate() |
|
126 { |
|
127 |
|
128 } |
|
129 |
|
130 // ========================= From CGSPluginInterface ================== |
|
131 |
|
132 |
|
133 // ----------------------------------------------------------------------------- |
|
134 // CAuthtypePlugin::GetCaptionL |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 void CAuthtypePlugin::GetCaptionL(TDes& aCaption) const |
|
138 { |
|
139 |
|
140 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::GetCaptionL" ) ); |
|
141 |
|
142 HBufC* result = StringLoader::LoadL( R_SET_CONF_MSG_AUTHENTICATION_CP); |
|
143 aCaption.Copy( *result); |
|
144 delete result; |
|
145 |
|
146 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::GetCaptionL DONE" ) ); |
|
147 } |
|
148 |
|
149 // ----------------------------------------------------------------------------- |
|
150 // CAuthtypePlugin::PluginProviderCategory |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 TInt CAuthtypePlugin::PluginProviderCategory() const |
|
154 { |
|
155 return KGSPluginProviderInternal; |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CAuthtypePlugin::ItemType() |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 TGSListboxItemTypes CAuthtypePlugin::ItemType() |
|
163 { |
|
164 return EGSItemTypeSettingDialog; |
|
165 } |
|
166 |
|
167 // ----------------------------------------------------------------------------- |
|
168 // CAuthtypePlugin::GetValue() |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 void CAuthtypePlugin::GetValue(const TGSPluginValueKeys /*aKey*/, TDes& /*aValue*/) |
|
172 { |
|
173 } |
|
174 |
|
175 // ----------------------------------------------------------------------------- |
|
176 // CAuthtypePlugin::HandleSelection() |
|
177 // ----------------------------------------------------------------------------- |
|
178 // |
|
179 void CAuthtypePlugin::HandleSelection(const TGSSelectionTypes /*aSelectionType*/) |
|
180 { |
|
181 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::HandleSelection" ) ); |
|
182 |
|
183 TRAP_IGNORE( HandleItemContentL() ); |
|
184 |
|
185 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::HandleSelection DONE" ) ); |
|
186 } |
|
187 |
|
188 // --------------------------------------------------------------------------- |
|
189 // CAuthtypePlugin::CreateIconL |
|
190 // --------------------------------------------------------------------------- |
|
191 // |
|
192 CGulIcon* CAuthtypePlugin::CreateIconL(const TUid aIconType) |
|
193 { |
|
194 |
|
195 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::CreateIconL" ) ); |
|
196 |
|
197 //EMbm<Mbm_file_name><Bitmap_name> |
|
198 CGulIcon* icon; |
|
199 TParse* fp = new( ELeave ) TParse(); |
|
200 CleanupStack::PushL(fp); |
|
201 fp->Set(KAuthtypePluginIconDirAndName, &KDC_BITMAP_DIR, NULL); |
|
202 |
|
203 if (aIconType == KGSIconTypeLbxItem) |
|
204 { |
|
205 icon = AknsUtils::CreateGulIconL(AknsUtils::SkinInstance(), |
|
206 KAknsIIDDefault, fp->FullName(), |
|
207 EMbmAuthtypepluginQgn_prop_set_conn_config, |
|
208 EMbmAuthtypepluginQgn_prop_set_conn_config_mask); |
|
209 } |
|
210 else |
|
211 { |
|
212 icon = CGSPluginInterface::CreateIconL(aIconType); |
|
213 } |
|
214 |
|
215 CleanupStack::PopAndDestroy(fp); |
|
216 |
|
217 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::CreateIconL: DONE" ) ); |
|
218 |
|
219 return icon; |
|
220 |
|
221 } |
|
222 |
|
223 // ----------------------------------------------------------------------------- |
|
224 // CAuthtypePlugin::OpenLocalizedResourceFileL() |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 void CAuthtypePlugin::OpenLocalizedResourceFileL( |
|
228 const TDesC& aResourceFileName, RConeResourceLoader& aResourceLoader) |
|
229 { |
|
230 |
|
231 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::OpenLocalizedResourceFileL" ) ); |
|
232 |
|
233 RFs fsSession; |
|
234 User::LeaveIfError(fsSession.Connect() ); |
|
235 |
|
236 CleanupClosePushL(fsSession); |
|
237 |
|
238 // Find the resource file: |
|
239 TParse parse; |
|
240 parse.Set(aResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL); |
|
241 TFileName fileName(parse.FullName() ); |
|
242 |
|
243 // Get language of resource file: |
|
244 BaflUtils::NearestLanguageFile(fsSession, fileName); |
|
245 |
|
246 // Open resource file: |
|
247 aResourceLoader.OpenL(fileName); |
|
248 |
|
249 CleanupStack::PopAndDestroy(); //fssession |
|
250 |
|
251 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::OpenLocalizedResourceFileL DONE" ) ); |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CAuthtypePlugin::HandleItemContentL() |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 |
|
259 void CAuthtypePlugin::HandleItemContentL() |
|
260 { |
|
261 |
|
262 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::HandleItemContentL" ) ); |
|
263 |
|
264 // Holds the index of selected item |
|
265 TInt selectedItem(KThirdItemSelected); |
|
266 |
|
267 // Holds the authentication type value |
|
268 TInt getAuthValue(KAllMethodsSupported); |
|
269 |
|
270 //Load all the strings from resource file |
|
271 |
|
272 HBufC *title = StringLoader::LoadLC(R_QTN_SET_CONF_AUTH_METHOD); |
|
273 |
|
274 HBufC *netPinSupport = StringLoader::LoadLC(R_QTN_CONF_AUTH_NETWORK_PIN); |
|
275 HBufC *netUserPinSupport = |
|
276 StringLoader::LoadLC(R_QTN_CONF_AUTH_NETWORK_OR_USER_PIN); |
|
277 HBufC *allMethodsSupport = StringLoader::LoadLC(R_QTN_CONF_AUTH_ALL_AUTH); |
|
278 |
|
279 //creation of list |
|
280 |
|
281 CAknSinglePopupMenuStyleListBox* list = new(ELeave)CAknSinglePopupMenuStyleListBox; |
|
282 CleanupStack::PushL(list); |
|
283 |
|
284 CAknPopupList* popupList = CAknPopupList::NewL(list, |
|
285 R_AVKON_SOFTKEYS_OK_CANCEL__OK, AknPopupLayouts::EMenuWindow); |
|
286 |
|
287 CleanupStack::PushL(popupList); |
|
288 |
|
289 list->ConstructL(popupList, 0); |
|
290 list->CreateScrollBarFrameL(ETrue); |
|
291 list->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, |
|
292 CEikScrollBarFrame::EAuto); |
|
293 |
|
294 //Append strings into array which will be populated into list |
|
295 |
|
296 CDesCArrayFlat* ItemArray = new(ELeave)CDesCArrayFlat(3); |
|
297 CleanupStack::PushL(ItemArray); |
|
298 |
|
299 ItemArray->AppendL(*netPinSupport); |
|
300 ItemArray->AppendL(*netUserPinSupport); |
|
301 ItemArray->AppendL(*allMethodsSupport); |
|
302 |
|
303 CleanupStack::Pop(); //ItemArray |
|
304 |
|
305 list->Model()->SetItemTextArray(ItemArray); |
|
306 list->Model()->SetOwnershipType(ELbmOwnsItemArray); |
|
307 |
|
308 popupList->SetTitleL(*title); |
|
309 |
|
310 /* Get authentication type value from Central Repository and based on current cenrep value |
|
311 * List box item will be selected */ |
|
312 |
|
313 CRepository * rep= NULL; |
|
314 TRAPD( err, rep = CRepository::NewL( KCRUidOMAProvisioningLV )) |
|
315 ; |
|
316 |
|
317 if (err == KErrNone) |
|
318 { |
|
319 rep->Get(KOMAProvAuthenticationLVFlag, getAuthValue); |
|
320 delete rep; |
|
321 } |
|
322 |
|
323 switch (getAuthValue) |
|
324 { |
|
325 case KNetworkPinOnly: |
|
326 selectedItem = KFirstItemSelected; |
|
327 break; |
|
328 |
|
329 case KNetworkorUserPin: |
|
330 selectedItem = KSecondItemSelected; |
|
331 break; |
|
332 |
|
333 case KAllMethodsSupported: |
|
334 selectedItem = KThirdItemSelected; |
|
335 break; |
|
336 |
|
337 default: |
|
338 break; |
|
339 } |
|
340 |
|
341 list->View()->SetCurrentItemIndex(selectedItem); |
|
342 |
|
343 // Show popup list and then show return value. |
|
344 TInt popupOk = popupList->ExecuteLD(); |
|
345 |
|
346 //When user selects item from list based on selection cenrep value will be set |
|
347 |
|
348 if (popupOk) |
|
349 { |
|
350 |
|
351 selectedItem = list->CurrentItemIndex(); |
|
352 |
|
353 switch (selectedItem) |
|
354 { |
|
355 case KFirstItemSelected: |
|
356 SetCenrepItemL(selectedItem, KNetworkPinOnly); |
|
357 break; |
|
358 case KSecondItemSelected: |
|
359 SetCenrepItemL(selectedItem, KNetworkorUserPin); |
|
360 break; |
|
361 case KThirdItemSelected: |
|
362 SetCenrepItemL(selectedItem, KAllMethodsSupported); |
|
363 break; |
|
364 default: |
|
365 break; |
|
366 |
|
367 } |
|
368 |
|
369 } |
|
370 |
|
371 CleanupStack::Pop(); // popuplist |
|
372 CleanupStack::PopAndDestroy(5); // list, title, netPinSupport, netUserPinSupport, allMethodsSupport |
|
373 |
|
374 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::HandleItemContentL DONE" ) ); |
|
375 |
|
376 } |
|
377 |
|
378 // --------------------------------------------------------- |
|
379 // CAuthtypeUIContainer::SetCenrepItemL() |
|
380 // --------------------------------------------------------- |
|
381 // |
|
382 void CAuthtypePlugin::SetCenrepItemL(TInt aSelected, TInt aSetAuthValue) |
|
383 { |
|
384 |
|
385 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::SetCenrepItemL" ) ); |
|
386 //Based on current selection item from list set the cenrep with different authentication type |
|
387 |
|
388 CRepository * rep= NULL; |
|
389 TRAPD( err, rep = CRepository::NewL( KCRUidOMAProvisioningLV )) |
|
390 ; |
|
391 |
|
392 if (err == KErrNone) |
|
393 { |
|
394 rep->Set(KOMAProvAuthenticationLVFlag, aSetAuthValue); |
|
395 delete rep; |
|
396 } |
|
397 |
|
398 //Shows Information note to user on selection of second and third Item from List |
|
399 |
|
400 if (aSelected == KSecondItemSelected) |
|
401 { |
|
402 |
|
403 HBufC |
|
404 * netUserPinNote = |
|
405 StringLoader::LoadLC(R_QTN_CONF_AUTH_NETWORK_OR_USER_PIN_NOTE); |
|
406 ShowPopupNoteL(netUserPinNote); |
|
407 CleanupStack::PopAndDestroy(); // netUserPinNote |
|
408 } |
|
409 |
|
410 else |
|
411 if (aSelected == KThirdItemSelected) |
|
412 { |
|
413 HBufC* allMethodsNote = |
|
414 StringLoader::LoadLC(R_QTN_CONF_AUTH_ALL_AUTH_NOTE); |
|
415 ShowPopupNoteL(allMethodsNote); |
|
416 CleanupStack::PopAndDestroy(); // allMethodsNote |
|
417 } |
|
418 |
|
419 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::SetCenrepItemL DONE" ) ); |
|
420 } |
|
421 |
|
422 // --------------------------------------------------------- |
|
423 // CAuthtypeUIContainer::ShowPopupNoteL() |
|
424 // --------------------------------------------------------- |
|
425 // |
|
426 void CAuthtypePlugin::ShowPopupNoteL(HBufC *aNote) |
|
427 { |
|
428 |
|
429 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::ShowPopupNoteL" ) ); |
|
430 |
|
431 CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog; |
|
432 queryDialog->ExecuteLD(R_AUTHTYPEUI_INFORMATION_QUERY, *aNote); |
|
433 |
|
434 FLOG( _L( "[AuthtypePlugin] CAuthtypePlugin::ShowPopupNoteL DONE" ) ); |
|
435 |
|
436 } |
|
437 |
|
438 // End of file |