|
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: View for Device & SIM Security sub-folder |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <coeaui.h> |
|
21 #include <hlplch.h> // For HlpLauncher |
|
22 #include <bautils.h> |
|
23 #include <gulicon.h> |
|
24 #include <eikfrlbd.h> |
|
25 #include <eiktxlbx.h> |
|
26 #include <aknradiobuttonsettingpage.h> |
|
27 #include <aknPopup.h> |
|
28 #include <aknlists.h> |
|
29 #include <RSSSettings.h> |
|
30 #include <AknQueryDialog.h> |
|
31 #include <aknnotedialog.h> |
|
32 #include <aknViewAppUi.h> |
|
33 #include <featmgr.h> |
|
34 #include <StringLoader.h> |
|
35 #include <secui.h> |
|
36 #include <secuisecuritysettings.h> |
|
37 #include <BTSapDomainPSKeys.h> |
|
38 #include <e32property.h> |
|
39 |
|
40 #include <GSSimSecPluginRsc.rsg> |
|
41 #include <gsprivatepluginproviderids.h> |
|
42 #include <gsmainview.h> |
|
43 #include <gsbasecontainer.h> |
|
44 |
|
45 #include "GSSimSecPlugin.h" |
|
46 #include "GSSimSecPluginContainer.h" |
|
47 #include "GSSimSecPlugin.hrh" |
|
48 |
|
49 |
|
50 #ifdef RD_REMOTELOCK |
|
51 #include <RemoteLockSettings.h> |
|
52 #endif // RD_REMOTELOCK |
|
53 |
|
54 |
|
55 // EXTERNAL DATA STRUCTURES |
|
56 |
|
57 // EXTERNAL FUNCTION PROTOTYPES |
|
58 |
|
59 // CONSTANTS |
|
60 |
|
61 // MACROS |
|
62 |
|
63 // LOCAL CONSTANTS AND MACROS |
|
64 const TInt KEmptyCugIndex( -100000000 ); |
|
65 _LIT( KGSSimSecPluginResourceFileName, "z:GSSimSecPluginRsc.rsc" ); |
|
66 |
|
67 // MODULE DATA STRUCTURES |
|
68 |
|
69 // LOCAL FUNCTION PROTOTYPES |
|
70 |
|
71 // FORWARD DECLARATIONS |
|
72 |
|
73 /** |
|
74 * CCugQuery |
|
75 * It defines CCugQuery used in closed user group settings |
|
76 */ |
|
77 class CCugQuery |
|
78 : public CAknNumberQueryDialog |
|
79 { |
|
80 public: // Constructors and destructors |
|
81 /** |
|
82 * C++ constructor. |
|
83 */ |
|
84 CCugQuery( TInt& aNumber,const TTone aTone = ENoTone ); |
|
85 protected: // From base classes |
|
86 /** |
|
87 * From CCAknNumberQueryDialog Left softkey is allways OK. |
|
88 */ |
|
89 void UpdateLeftSoftKeyL(); |
|
90 }; |
|
91 |
|
92 // ============================= LOCAL FUNCTIONS ============================== |
|
93 |
|
94 // ========================= MEMBER FUNCTIONS ================================= |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // GSSimSecPlugin::NewL() |
|
98 // |
|
99 // --------------------------------------------------------------------------- |
|
100 CGSSimSecPlugin* CGSSimSecPlugin::NewL( TAny* /*aInitParams*/ ) |
|
101 { |
|
102 CGSSimSecPlugin* self = new( ELeave ) CGSSimSecPlugin(); |
|
103 |
|
104 CleanupStack::PushL( self ); |
|
105 self->ConstructL(); |
|
106 CleanupStack::Pop( self ); |
|
107 |
|
108 return self; |
|
109 } |
|
110 |
|
111 |
|
112 // --------------------------------------------------------------------------- |
|
113 // GSSimSecPlugin::CGSSimSecPlugin() |
|
114 // |
|
115 // --------------------------------------------------------------------------- |
|
116 CGSSimSecPlugin::CGSSimSecPlugin() |
|
117 : iResourceLoader( *iCoeEnv ) |
|
118 { |
|
119 } |
|
120 |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // CGSSimSecPlugin::ConstructL() |
|
124 // |
|
125 // Symbian OS two-phased constructor |
|
126 // --------------------------------------------------------------------------- |
|
127 void CGSSimSecPlugin::ConstructL() |
|
128 { |
|
129 FeatureManager::InitializeLibL(); |
|
130 |
|
131 iModel = CGSSimSecPluginModel::NewL(); |
|
132 //PS listener initialization |
|
133 iBtSapListener = CGSPubSubsListener::NewL( |
|
134 KPSUidBluetoothSapConnectionState, |
|
135 KBTSapConnectionState, this ); |
|
136 |
|
137 iSecurity= CSecuritySettings::NewL(); |
|
138 if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) |
|
139 { |
|
140 User::LeaveIfError( iCugSettings.Open() ); |
|
141 } |
|
142 // Find the resource file |
|
143 TParse parse; |
|
144 parse.Set( KGSSimSecPluginResourceFileName, |
|
145 &KDC_RESOURCE_FILES_DIR, NULL ); |
|
146 TFileName fileName( parse.FullName() ); |
|
147 |
|
148 // Get language of resource file |
|
149 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
150 |
|
151 // Open resource file |
|
152 iResourceLoader.OpenL( fileName ); |
|
153 |
|
154 BaseConstructL( R_GS_SIM_SECURITY_VIEW ); |
|
155 |
|
156 // secui resource file |
|
157 TSecUi::InitializeLibL(); |
|
158 } |
|
159 |
|
160 |
|
161 // --------------------------------------------------------------------------- |
|
162 // CGSSimSecPlugin::~CGSSettListSecurityView() |
|
163 // |
|
164 // |
|
165 // --------------------------------------------------------------------------- |
|
166 CGSSimSecPlugin::~CGSSimSecPlugin() |
|
167 { |
|
168 FeatureManager::UnInitializeLib(); |
|
169 // close resource loader |
|
170 iResourceLoader.Close(); |
|
171 if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) |
|
172 { |
|
173 iCugSettings.Close(); |
|
174 } |
|
175 if ( iSecurity ) |
|
176 { |
|
177 delete iSecurity; |
|
178 } |
|
179 |
|
180 if ( iModel ) |
|
181 { |
|
182 delete iModel; |
|
183 } |
|
184 delete iBtSapListener; |
|
185 |
|
186 TSecUi::UnInitializeLib(); |
|
187 } |
|
188 |
|
189 |
|
190 // --------------------------------------------------------------------------- |
|
191 // TUid CGSSettSimListSecurityView::Id() |
|
192 // |
|
193 // |
|
194 // --------------------------------------------------------------------------- |
|
195 TUid CGSSimSecPlugin::Id() const |
|
196 { |
|
197 return KGSSimSecPluginUid; |
|
198 } |
|
199 |
|
200 |
|
201 // --------------------------------------------------------------------------- |
|
202 // CGSSimSecPlugin::HandleCommandL() |
|
203 // |
|
204 // |
|
205 // --------------------------------------------------------------------------- |
|
206 void CGSSimSecPlugin::HandleCommandL( TInt aCommand ) |
|
207 { |
|
208 switch ( aCommand ) |
|
209 { |
|
210 case EGSCmdAppChange: |
|
211 case EAknSoftkeyChange: |
|
212 { |
|
213 const TInt currentFeatureId = Container()->CurrentFeatureId(); |
|
214 |
|
215 if ( currentFeatureId != EGSSettIdSatOperations ) |
|
216 { |
|
217 HandleListBoxSelectionL(); |
|
218 } |
|
219 else |
|
220 { |
|
221 if(aCommand == EGSCmdAppChange) |
|
222 SetSatWithSettingPageL(); |
|
223 else //user pressed MSK, don't show setting page. |
|
224 SetSatOperationsL(); |
|
225 } |
|
226 } |
|
227 break; |
|
228 case EAknSoftkeyBack: |
|
229 iAppUi->ActivateLocalViewL( KGSSecurityPluginUid ); |
|
230 break; |
|
231 case EAknCmdHelp: |
|
232 { |
|
233 if( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
234 { |
|
235 HlpLauncher::LaunchHelpApplicationL( |
|
236 iEikonEnv->WsSession(), iAppUi->AppHelpContextL() ); |
|
237 } |
|
238 } |
|
239 break; |
|
240 default: |
|
241 iAppUi->HandleCommandL( aCommand ); |
|
242 break; |
|
243 } |
|
244 } |
|
245 |
|
246 |
|
247 // --------------------------------------------------------------------------- |
|
248 // CGSSimSecPlugin::UpdateListBoxL |
|
249 // |
|
250 // Update the current item in the listbox. |
|
251 // --------------------------------------------------------------------------- |
|
252 void CGSSimSecPlugin::UpdateListBoxL( TInt aItemId ) |
|
253 { |
|
254 Container()->UpdateListBoxL( aItemId ); |
|
255 } |
|
256 |
|
257 |
|
258 // --------------------------------------------------------------------------- |
|
259 // CGSSimSecPlugin::DoActivateL(...) |
|
260 // |
|
261 // |
|
262 // --------------------------------------------------------------------------- |
|
263 void CGSSimSecPlugin::DoActivateL( const TVwsViewId& aPrevViewId, |
|
264 TUid aCustomMessageId, |
|
265 const TDesC8& aCustomMessage ) |
|
266 { |
|
267 CGSBaseView::DoActivateL( aPrevViewId, aCustomMessageId, aCustomMessage ); |
|
268 } |
|
269 |
|
270 |
|
271 // ---------------------------------------------------------------------------- |
|
272 // CGSSimSecPlugin::Container |
|
273 // |
|
274 // Return handle to container class. |
|
275 // ---------------------------------------------------------------------------- |
|
276 // |
|
277 CGSSimSecPluginContainer* CGSSimSecPlugin::Container() |
|
278 { |
|
279 return static_cast<CGSSimSecPluginContainer*>( iContainer ); |
|
280 } |
|
281 |
|
282 |
|
283 // --------------------------------------------------------------------------- |
|
284 // CGSSimSecPlugin::NewContainerL() |
|
285 // |
|
286 // Creates new iContainer. |
|
287 // --------------------------------------------------------------------------- |
|
288 // |
|
289 void CGSSimSecPlugin::NewContainerL() |
|
290 { |
|
291 iContainer = new( ELeave ) CGSSimSecPluginContainer( iModel ); |
|
292 } |
|
293 |
|
294 |
|
295 // --------------------------------------------------------------------------- |
|
296 // CGSSimSecPlugin::HandleListBoxSelectionL() |
|
297 // |
|
298 // |
|
299 // --------------------------------------------------------------------------- |
|
300 void CGSSimSecPlugin::HandleListBoxSelectionL() |
|
301 { |
|
302 const TInt currentFeatureId = Container()->CurrentFeatureId(); |
|
303 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
304 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
305 switch ( currentFeatureId ) |
|
306 { |
|
307 case EGSSettIdCodeInUse: |
|
308 if(wcdmaSupported || upinSupported) |
|
309 { |
|
310 if(iSecurity->SwitchPinCodesL()) |
|
311 { |
|
312 UpdateListBoxL( currentFeatureId ); |
|
313 } |
|
314 } |
|
315 break; |
|
316 case EGSSettIdUpinRequest: |
|
317 if(wcdmaSupported || upinSupported) |
|
318 { |
|
319 if(iSecurity->ChangeUPinRequestL()) |
|
320 { |
|
321 UpdateListBoxL( currentFeatureId ); |
|
322 } |
|
323 } |
|
324 break; |
|
325 case EGSSettIdUpinCode: |
|
326 if(wcdmaSupported || upinSupported) |
|
327 { |
|
328 iSecurity->ChangeUPinL(); |
|
329 } |
|
330 break; |
|
331 case EGSSettIdPinRequest: |
|
332 if(iSecurity->ChangePinRequestL()) |
|
333 { |
|
334 UpdateListBoxL( currentFeatureId ); |
|
335 } |
|
336 break; |
|
337 case EGSSettIdPinCode: |
|
338 iSecurity->ChangePinL(); |
|
339 break; |
|
340 case EGSSettIdPin2Code: |
|
341 iSecurity->ChangePin2L(); |
|
342 break; |
|
343 case EGSSettIdAutolock: |
|
344 SetAutolockTimeL( iSecurity->ChangeAutoLockPeriodL( |
|
345 iModel->AutoLockPeriod() ) ); |
|
346 break; |
|
347 case EGSSettIdSecurityCode: |
|
348 iSecurity->ChangeSecCodeL(); |
|
349 break; |
|
350 case EGSSettIdSimChange: |
|
351 if(iSecurity->ChangeSimSecurityL()) |
|
352 { |
|
353 UpdateListBoxL( currentFeatureId ); |
|
354 } |
|
355 break; |
|
356 |
|
357 #ifdef RD_REMOTELOCK |
|
358 case EGSSettIdRemoteLock: |
|
359 SetRemoteLockStatusL( iModel->AutoLockPeriod() ); |
|
360 break; |
|
361 |
|
362 #endif |
|
363 case EGSSettIdClosedUserGroup: |
|
364 if(!FeatureManager::FeatureSupported( KFeatureIdFfNoCugSupport )) |
|
365 { |
|
366 CugModeL(); |
|
367 UpdateListBoxL( currentFeatureId ); |
|
368 } |
|
369 break; |
|
370 case EGSSettIdSatOperations: |
|
371 SetSatOperationsL(); |
|
372 break; |
|
373 default: |
|
374 break; |
|
375 } |
|
376 |
|
377 } |
|
378 |
|
379 // --------------------------------------------------------------------------- |
|
380 // CGSSimSecPlugin::SetAutolockTimeL() |
|
381 // |
|
382 // |
|
383 // --------------------------------------------------------------------------- |
|
384 void CGSSimSecPlugin::SetAutolockTimeL( TInt aPeriod ) |
|
385 { |
|
386 iModel->SetAutoLockPeriod( aPeriod ); |
|
387 UpdateListBoxL( EGSSettIdAutolock ); |
|
388 } |
|
389 |
|
390 // --------------------------------------------------------------------------- |
|
391 // CGSSimSecPlugin::SetSatOperationsL() |
|
392 // |
|
393 // |
|
394 // --------------------------------------------------------------------------- |
|
395 void CGSSimSecPlugin::SetSatOperationsL() |
|
396 { |
|
397 TInt i = iModel->SatOperations(); |
|
398 |
|
399 if ( i == 0 ) |
|
400 { |
|
401 iModel->SetSatOperations( 1 ); |
|
402 } |
|
403 else |
|
404 { |
|
405 iModel->SetSatOperations( 0 ); |
|
406 } |
|
407 UpdateListBoxL( EGSSettIdSatOperations ); |
|
408 } |
|
409 |
|
410 // --------------------------------------------------------------------------- |
|
411 // CGSSimSecPlugin::SetSatOperationsL() |
|
412 // |
|
413 // |
|
414 // --------------------------------------------------------------------------- |
|
415 void CGSSimSecPlugin::SetSatWithSettingPageL() |
|
416 { |
|
417 TInt currentItem = iModel->SatOperations(); |
|
418 |
|
419 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_SAT_ARRAY ); |
|
420 CleanupStack::PushL( items ); |
|
421 |
|
422 CAknRadioButtonSettingPage* page = |
|
423 new( ELeave ) CAknRadioButtonSettingPage( R_SAT_SETTING_PAGE, |
|
424 currentItem, items ); |
|
425 |
|
426 if ( page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
427 { |
|
428 iModel->SetSatOperations( currentItem ); |
|
429 } |
|
430 |
|
431 CleanupStack::PopAndDestroy( items ); |
|
432 |
|
433 UpdateListBoxL( EGSSettIdSatOperations ); |
|
434 } |
|
435 |
|
436 |
|
437 // --------------------------------------------------------------------------- |
|
438 // CGSSimSecPlugin::CugModeL() |
|
439 // |
|
440 // |
|
441 // --------------------------------------------------------------------------- |
|
442 void CGSSimSecPlugin::CugModeL() |
|
443 { |
|
444 TInt cugIndex = 0; |
|
445 TInt currentItem = 0; |
|
446 TInt cugMode = 0; |
|
447 TInt cugDefault; |
|
448 TInt err = KErrNone; |
|
449 |
|
450 err = iCugSettings.Get( ESSSettingsDefaultCug, cugDefault ); |
|
451 User::LeaveIfError( err ); |
|
452 |
|
453 |
|
454 if ( iCugSettings.Get( ESSSettingsCug, cugMode ) != KErrNone ) |
|
455 {// getting mode was not succesful |
|
456 cugMode = cugDefault; |
|
457 } |
|
458 |
|
459 if ( cugMode == cugDefault ) |
|
460 { |
|
461 currentItem = EGSCugNetworkDefault; |
|
462 if ( iCugSettings.PreviousCugValue( cugIndex ) != KErrNone ) |
|
463 { |
|
464 cugIndex = 0; |
|
465 } |
|
466 } |
|
467 else |
|
468 { |
|
469 switch ( cugMode ) |
|
470 { |
|
471 case ESSSettingsCugSuppress: |
|
472 currentItem = EGSCugOff; |
|
473 if ( iCugSettings.PreviousCugValue( cugIndex ) != KErrNone ) |
|
474 { |
|
475 cugIndex = 0; |
|
476 } |
|
477 break; |
|
478 default: |
|
479 currentItem = EGSCugOn; |
|
480 cugIndex = cugMode; |
|
481 break; |
|
482 } |
|
483 } |
|
484 |
|
485 |
|
486 CDesCArrayFlat* items = iCoeEnv->ReadDesC16ArrayResourceL( R_CUG_LBX ); |
|
487 CleanupStack::PushL( items ); |
|
488 |
|
489 CAknRadioButtonSettingPage* page = |
|
490 new( ELeave ) CAknRadioButtonSettingPage( R_CUG_SETTING_PAGE, |
|
491 currentItem, items ); |
|
492 |
|
493 // call the appropriate cug- methods here |
|
494 if ( page->ExecuteLD( CAknSettingPage::EUpdateWhenChanged ) ) |
|
495 { |
|
496 |
|
497 switch ( currentItem ) |
|
498 { |
|
499 case EGSCugNetworkDefault://cug mode set default, |
|
500 User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, |
|
501 cugDefault ) ); |
|
502 break; |
|
503 case EGSCugOn: //1, index is queried, if query ok then |
|
504 // set the index and mode |
|
505 if ( CugIndexQueryL( cugIndex, cugDefault ) ) |
|
506 { |
|
507 if ( iCugSettings.IsValueValidCugIndex( cugIndex ) ) |
|
508 { |
|
509 User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, |
|
510 cugIndex ) ); |
|
511 } |
|
512 else |
|
513 { |
|
514 User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, |
|
515 cugDefault ) ); |
|
516 User::LeaveIfError( iCugSettings.ResetPreviousCugValue() ); |
|
517 } |
|
518 } |
|
519 break; |
|
520 case EGSCugOff://2, sets cug mode "inactive" |
|
521 User::LeaveIfError( iCugSettings.Set( ESSSettingsCug, |
|
522 ESSSettingsCugSuppress ) ); |
|
523 break; |
|
524 default: |
|
525 break; |
|
526 } |
|
527 } |
|
528 CleanupStack::PopAndDestroy( items ); |
|
529 return; |
|
530 } |
|
531 |
|
532 |
|
533 // --------------------------------------------------------------------------- |
|
534 // CGSSimSecPlugin::CugIndexQueryL() |
|
535 // |
|
536 // |
|
537 // --------------------------------------------------------------------------- |
|
538 TInt CGSSimSecPlugin::CugIndexQueryL( TInt& aCugIndex, TInt& aCugDefault ) |
|
539 { |
|
540 while ( ETrue ) |
|
541 { |
|
542 CCugQuery* dlg = new( ELeave ) CCugQuery( aCugIndex, |
|
543 CAknQueryDialog::ENoTone ); |
|
544 |
|
545 if ( dlg->ExecuteLD( R_CUG_INDEX ) ) |
|
546 { |
|
547 // check content validity (?-32767), |
|
548 // ui spec concerned only values above limit |
|
549 if( !iCugSettings.IsValueValidCugIndex( aCugIndex ) |
|
550 && ( aCugIndex != KEmptyCugIndex ) |
|
551 && ( aCugIndex != aCugDefault ) ) |
|
552 { |
|
553 CAknNoteDialog* dlg = new ( ELeave ) |
|
554 CAknNoteDialog( CAknNoteDialog::EErrorTone, |
|
555 CAknNoteDialog::ELongTimeout ); |
|
556 dlg->ExecuteLD( R_CUG_INDEX_ERROR_NOTE ); |
|
557 } |
|
558 else //index ok, break |
|
559 { |
|
560 break; |
|
561 } |
|
562 } |
|
563 else // query cancelled |
|
564 { |
|
565 return EFalse; |
|
566 } |
|
567 } |
|
568 |
|
569 return ETrue; |
|
570 } |
|
571 |
|
572 |
|
573 // --------------------------------------------------------------------------- |
|
574 // CCugQuery::CCugQuery() |
|
575 // |
|
576 // --------------------------------------------------------------------------- |
|
577 // |
|
578 CCugQuery::CCugQuery( TInt& aNumber, const TTone aTone ) |
|
579 : CAknNumberQueryDialog( aNumber, aTone ) |
|
580 { |
|
581 } |
|
582 |
|
583 |
|
584 // --------------------------------------------------------------------------- |
|
585 // CCugQuery::UpdateLeftSoftKeyL() |
|
586 // Left softkey is allways visible |
|
587 // --------------------------------------------------------------------------- |
|
588 // |
|
589 void CCugQuery::UpdateLeftSoftKeyL() |
|
590 { |
|
591 MakeLeftSoftkeyVisible( ETrue ); |
|
592 } |
|
593 |
|
594 |
|
595 // --------------------------------------------------------------------------- |
|
596 // CGSSimSecPlugin::HandleResourceChangeL( TInt aType ) |
|
597 // Updates view layout |
|
598 // |
|
599 // --------------------------------------------------------------------------- |
|
600 // |
|
601 void CGSSimSecPlugin::HandleResourceChangeL( TInt aType ) |
|
602 { |
|
603 if( aType == KAknsMessageSkinChange || |
|
604 aType == KEikDynamicLayoutVariantSwitch ) |
|
605 { |
|
606 //iContainer->HandleResourceChangeL( aType ); |
|
607 } |
|
608 } |
|
609 |
|
610 |
|
611 // --------------------------------------------------------------------------- |
|
612 // CGSSimSecPlugin::HandleNotifyPSL |
|
613 // |
|
614 // Handling PS keys change |
|
615 // --------------------------------------------------------------------------- |
|
616 // |
|
617 void CGSSimSecPlugin::HandleNotifyPSL( const TUid aUid, const TInt& aKey, |
|
618 const TRequestStatus& /* aStatus */ ) |
|
619 { |
|
620 if ( aUid == KPSUidBluetoothSapConnectionState && |
|
621 aKey == KBTSapConnectionState ) |
|
622 { |
|
623 Visible(); |
|
624 } |
|
625 } |
|
626 |
|
627 |
|
628 // ========================= From CGSPluginInterface ================== |
|
629 |
|
630 // ---------------------------------------------------------------------------- |
|
631 // CGSSimSecPlugin::GetCaption |
|
632 // |
|
633 // Return application/view caption. |
|
634 // ---------------------------------------------------------------------------- |
|
635 // |
|
636 void CGSSimSecPlugin::GetCaptionL( TDes& aCaption ) const |
|
637 { |
|
638 // the resource file is already opened. |
|
639 HBufC* result = StringLoader::LoadL( R_GS_SIM_SECURITY_VIEW_CAPTION ); |
|
640 |
|
641 aCaption.Copy( *result ); |
|
642 delete result; |
|
643 } |
|
644 |
|
645 |
|
646 // ---------------------------------------------------------------------------- |
|
647 // CGSSimSecPlugin::PluginProviderCategory |
|
648 // |
|
649 // A means to identify the location of this plug-in in the framework. |
|
650 // ---------------------------------------------------------------------------- |
|
651 // |
|
652 TInt CGSSimSecPlugin::PluginProviderCategory() const |
|
653 { |
|
654 //To identify internal plug-ins. |
|
655 return KGSPluginProviderInternal; |
|
656 } |
|
657 |
|
658 |
|
659 // ---------------------------------------------------------------------------- |
|
660 // CGSSimSecPlugin::Visible |
|
661 // |
|
662 // Provides the visibility status of self to framework. |
|
663 // ---------------------------------------------------------------------------- |
|
664 // |
|
665 TBool CGSSimSecPlugin::Visible() const |
|
666 { |
|
667 TInt btSapConnectionState; |
|
668 TBool visible = ETrue; |
|
669 |
|
670 iBtSapListener->Get( btSapConnectionState ); |
|
671 |
|
672 if ( btSapConnectionState == EBTSapConnected ) |
|
673 { |
|
674 visible = EFalse; |
|
675 } |
|
676 |
|
677 return visible; |
|
678 } |
|
679 |
|
680 |
|
681 |
|
682 // --------------------------------------------------------------------------- |
|
683 // CGSSimSecPlugin::SetRemoteLockStatusL() |
|
684 // |
|
685 // |
|
686 // --------------------------------------------------------------------------- |
|
687 TInt CGSSimSecPlugin::SetRemoteLockStatusL( TInt aAutoLockPeriod ) |
|
688 { |
|
689 #ifdef RD_REMOTELOCK |
|
690 #ifdef _DEBUG |
|
691 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Enter" ) ); |
|
692 #endif // DEBUG |
|
693 |
|
694 TInt retValue( KErrNone ); |
|
695 TBool remoteLockStatus( EFalse ); |
|
696 TBuf<KRLockMaxLockCodeLength> remoteLockCode; |
|
697 |
|
698 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewLC(); |
|
699 |
|
700 // Get the current remote lock status |
|
701 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
|
702 { |
|
703 // Show remote lock setting page |
|
704 retValue = iSecurity->ChangeRemoteLockStatusL( remoteLockStatus, remoteLockCode, aAutoLockPeriod ); |
|
705 |
|
706 if ( retValue == KErrNone ) |
|
707 { |
|
708 if ( remoteLockStatus ) |
|
709 { |
|
710 // Set remote lock status |
|
711 if ( remoteLockSettings->SetEnabledL( remoteLockCode ) ) |
|
712 { |
|
713 // Remote lock status was set successfully |
|
714 #ifdef _DEBUG |
|
715 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Remote lock enabled and code set" ) ); |
|
716 #endif // DEBUG |
|
717 } |
|
718 else |
|
719 { |
|
720 // Failed to enabled remote lock |
|
721 retValue = KErrGeneral; |
|
722 |
|
723 #ifdef _DEBUG |
|
724 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->SetEnabledL failed" ) ); |
|
725 #endif // DEBUG |
|
726 } |
|
727 } |
|
728 else |
|
729 { |
|
730 // Disable remote lock |
|
731 if ( remoteLockSettings->SetDisabled() ) |
|
732 { |
|
733 // Remote lock disabled |
|
734 #ifdef _DEBUG |
|
735 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Remote lock disabled" ) ); |
|
736 #endif // DEBUG |
|
737 } |
|
738 else |
|
739 { |
|
740 // Failed to disable remote lock |
|
741 retValue = KErrGeneral; |
|
742 |
|
743 #ifdef _DEBUG |
|
744 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->SetDisabled failed" ) ); |
|
745 #endif // DEBUG |
|
746 } |
|
747 } |
|
748 } |
|
749 else |
|
750 { |
|
751 // User interaction (setting page) failed for some reason |
|
752 #ifdef _DEBUG |
|
753 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - iSecurity->ChangeRemoteLockStatusL failed" ) ); |
|
754 #endif // DEBUG |
|
755 } |
|
756 } |
|
757 else |
|
758 { |
|
759 // Failed to retreive the current remote lock status |
|
760 retValue = KErrGeneral; |
|
761 |
|
762 #ifdef _DEBUG |
|
763 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - remoteLockSettings->GetEnabled failed" ) ); |
|
764 #endif // DEBUG |
|
765 } |
|
766 |
|
767 CleanupStack::PopAndDestroy( remoteLockSettings ); |
|
768 remoteLockSettings = NULL; |
|
769 |
|
770 UpdateListBoxL( EGSSettIdRemoteLock ); |
|
771 |
|
772 #ifdef _DEBUG |
|
773 RDebug::Print( _L( "(GS)CGSSettListSimSecurityView::SetRemoteLockStatusL() - Exit" ) ); |
|
774 #endif // DEBUG |
|
775 return retValue; |
|
776 #else //!RD_REMOTELOCK |
|
777 return KErrNotSupported; |
|
778 #endif // RD_REMOTELOCK |
|
779 } |
|
780 |
|
781 |
|
782 // ---------------------------------------------------------------------------- |
|
783 // CGSSimSecPlugin::DynInitMenuPaneL() |
|
784 // |
|
785 // Display the dynamic menu |
|
786 // ---------------------------------------------------------------------------- |
|
787 void CGSSimSecPlugin::DynInitMenuPaneL( TInt aResourceId, |
|
788 CEikMenuPane* aMenuPane ) |
|
789 { |
|
790 |
|
791 // show or hide the 'help' menu item when supported |
|
792 if( aResourceId == R_GS_SIM_SEC_MENU_ITEM_HELP ) |
|
793 { |
|
794 User::LeaveIfNull( aMenuPane ); |
|
795 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
796 { |
|
797 aMenuPane->SetItemDimmed( EAknCmdHelp, EFalse ); |
|
798 } |
|
799 else |
|
800 { |
|
801 aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue ); |
|
802 } |
|
803 } |
|
804 |
|
805 } |
|
806 // End of File |