113 CWPASecuritySettingsImpl* aSecuritySettings, |
113 CWPASecuritySettingsImpl* aSecuritySettings, |
114 const TDesC& aTitle ) |
114 const TDesC& aTitle ) |
115 { |
115 { |
116 CleanupStack::PushL( this ); |
116 CleanupStack::PushL( this ); |
117 |
117 |
118 const TInt Titles_Wpa_Main[KNumOfFieldsMain+2] = |
118 const TInt Titles_Wpa_Main[KNumOfFieldsMain+1] = |
119 { |
119 { |
120 R_WPA_MODE, |
120 R_WPA_MODE, |
121 R_WPA_EAP_CONFIG, |
121 R_WPA_EAP_CONFIG, |
122 R_WPA_MODE_PRESHARED_KEY, |
122 R_WPA_MODE_PRESHARED_KEY, |
123 R_WPA_TKIP_CIPHER, |
123 R_WPA_TKIP_CIPHER |
124 R_WPA_UNENCRYPTED_CONN |
|
125 }; |
124 }; |
126 |
125 |
127 const TInt Fields_Wpa_Main[KNumOfFieldsMain+2] = |
126 const TInt Fields_Wpa_Main[KNumOfFieldsMain+1] = |
128 { |
127 { |
129 EWpaMode, |
128 EWpaMode, |
130 EWpaEapConfig, |
129 EWpaEapConfig, |
131 EWpaPreSharedKey, |
130 EWpaPreSharedKey, |
132 EWpaWpa2Only, |
131 EWpaWpa2Only |
133 EWpaUnencryptedConn |
|
134 }; |
132 }; |
135 |
133 |
136 iSecuritySettings = aSecuritySettings; |
134 iSecuritySettings = aSecuritySettings; |
137 iConnectionName = aTitle; |
135 iConnectionName = aTitle; |
138 |
136 |
465 TInt numOfFields = iSecuritySettings->SecurityMode() == ESecurityModeWpa ? |
457 TInt numOfFields = iSecuritySettings->SecurityMode() == ESecurityModeWpa ? |
466 KNumOfFieldsMain : KNumOfFieldsMain-1; |
458 KNumOfFieldsMain : KNumOfFieldsMain-1; |
467 |
459 |
468 for( TInt i = 0; i < numOfFields; i++ ) |
460 for( TInt i = 0; i < numOfFields; i++ ) |
469 { |
461 { |
470 // 802.1x has no WpaMode (PSK not supported) and no Wpa2Only selection |
|
471 if ( iSecuritySettings->SecurityMode() == ESecurityMode8021x && |
|
472 (*wpaMember == EWpaMode ||*wpaMember == EWpaWpa2Only ) ) |
|
473 { |
|
474 wpaMember++; |
|
475 aRes++; |
|
476 } |
|
477 // If PSK in use, EAP plug-in configuration is not shown |
|
478 if ( *wpaMember == EWpaEapConfig && iSecuritySettings->WPAMode() ) |
462 if ( *wpaMember == EWpaEapConfig && iSecuritySettings->WPAMode() ) |
479 { |
463 { |
480 wpaMember++; |
464 wpaMember++; |
481 aRes++; |
465 aRes++; |
482 } |
466 } |
498 |
482 |
499 aItemArray.AppendL( *itemText ); |
483 aItemArray.AppendL( *itemText ); |
500 |
484 |
501 CleanupStack::PopAndDestroy( 2, title ); // itemText, title |
485 CleanupStack::PopAndDestroy( 2, title ); // itemText, title |
502 |
486 |
503 // If Eap in use, PreSharedKey is not shown |
|
504 wpaMember++; |
487 wpaMember++; |
505 aRes++; |
488 aRes++; |
506 } |
489 } |
507 else // EWpaMode, EWpaPreSharedKey, EWpaWpa2Only, EWpaUnencryptedConn: |
490 else // EWpaMode, EWpaPreSharedKey, EWpaWpa2Only: |
508 { |
491 { |
509 if (( *wpaMember != EWpaUnencryptedConn ) || |
492 HBufC* itemText = CreateTextualListBoxItemL( *wpaMember, *aRes ); |
510 (FeatureManager::FeatureSupported( KFeatureIdFfWlanAuthenticationOnlySupport ) ) ) |
493 CleanupStack::PushL( itemText ); |
511 { |
494 aItemArray.AppendL( itemText->Des() ); |
512 HBufC* itemText = CreateTextualListBoxItemL( *wpaMember, *aRes ); |
495 CleanupStack::PopAndDestroy( itemText ); |
513 CleanupStack::PushL( itemText ); |
|
514 aItemArray.AppendL( itemText->Des() ); |
|
515 CleanupStack::PopAndDestroy( itemText ); |
|
516 } |
|
517 } |
496 } |
518 |
497 |
519 wpaMember++; |
498 wpaMember++; |
520 aRes++; |
499 aRes++; |
521 } |
500 } |
598 valueResourceID = iSecuritySettings->Wpa2Only() ? |
577 valueResourceID = iSecuritySettings->Wpa2Only() ? |
599 R_WPA_CIPHER_NOT_ALLOWED : R_WPA_CIPHER_ALLOWED; |
578 R_WPA_CIPHER_NOT_ALLOWED : R_WPA_CIPHER_ALLOWED; |
600 break; |
579 break; |
601 } |
580 } |
602 |
581 |
603 case EWpaUnencryptedConn: |
|
604 { |
|
605 valueResourceID = iSecuritySettings->WPAUnencryptedConn() ? |
|
606 R_WPA_UNENCRYPTED_CONN_ALLOW : R_WPA_UNENCRYPTED_CONN_NOT_ALLOW; |
|
607 break; |
|
608 } |
|
609 |
|
610 case EWpaPreSharedKey: |
582 case EWpaPreSharedKey: |
611 { |
583 { |
612 valueResourceID = |
584 valueResourceID = |
613 iSecuritySettings->WPAPreSharedKey()->Length() == 0 ? |
585 iSecuritySettings->WPAPreSharedKey()->Length() == 0 ? |
614 R_WPA_PRESHARED_KEY_MUST_BE_DEFINED : 0; |
586 R_WPA_PRESHARED_KEY_MUST_BE_DEFINED : 0; |
671 // |
643 // |
672 TBool CWPASecuritySettingsDlg::ShowPopupSettingPageL( TWpaMember aData ) |
644 TBool CWPASecuritySettingsDlg::ShowPopupSettingPageL( TWpaMember aData ) |
673 { |
645 { |
674 TInt currvalue( 0 ); |
646 TInt currvalue( 0 ); |
675 TBool retval( EFalse ); |
647 TBool retval( EFalse ); |
676 TInt attr_resid( 0 ); |
|
677 |
|
678 CDesCArrayFlat* items = FillPopupSettingPageLC( aData, currvalue ); |
648 CDesCArrayFlat* items = FillPopupSettingPageLC( aData, currvalue ); |
679 |
649 |
680 |
650 TInt attr_resid = aData == EWpaMode ? R_WPA_MODE : R_WPA_TKIP_CIPHER; |
681 if ( aData == EWpaUnencryptedConn) |
|
682 { |
|
683 attr_resid = R_WPA_UNENCRYPTED_CONN; |
|
684 } |
|
685 else |
|
686 { |
|
687 attr_resid = aData == EWpaMode ? R_WPA_MODE : R_WPA_TKIP_CIPHER; |
|
688 } |
|
689 |
651 |
690 HBufC* titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid ); |
652 HBufC* titlebuf = iEikonEnv->AllocReadResourceLC( attr_resid ); |
691 CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( |
653 CAknRadioButtonSettingPage* dlg = new ( ELeave )CAknRadioButtonSettingPage( |
692 R_RADIO_BUTTON_SETTING_PAGE, currvalue, items ); |
654 R_RADIO_BUTTON_SETTING_PAGE, currvalue, items ); |
693 CleanupStack::PushL( dlg ); |
655 CleanupStack::PushL( dlg ); |
817 |
779 |
818 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
780 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
819 R_WPA_MODE_PRESHARED_KEY ) ); |
781 R_WPA_MODE_PRESHARED_KEY ) ); |
820 CleanupStack::PopAndDestroy(); |
782 CleanupStack::PopAndDestroy(); |
821 } |
783 } |
822 else if ( aData == EWpaWpa2Only ) |
784 else // EWpaWpa2Only: |
823 { |
785 { |
824 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
786 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
825 R_WPA_CIPHER_ALLOWED ) ); |
787 R_WPA_CIPHER_ALLOWED ) ); |
826 CleanupStack::PopAndDestroy(); |
788 CleanupStack::PopAndDestroy(); |
827 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
789 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
828 R_WPA_CIPHER_NOT_ALLOWED ) ); |
790 R_WPA_CIPHER_NOT_ALLOWED ) ); |
829 CleanupStack::PopAndDestroy(); |
791 CleanupStack::PopAndDestroy(); |
830 |
792 |
831 aCurrvalue = iSecuritySettings->Wpa2Only(); |
793 aCurrvalue = iSecuritySettings->Wpa2Only(); |
832 } |
794 } |
833 else // EWpaUnencryptedConn |
795 |
834 { |
|
835 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
836 R_WPA_UNENCRYPTED_CONN_NOT_ALLOW ) ); |
|
837 CleanupStack::PopAndDestroy(); |
|
838 items->AppendL( *iEikonEnv->AllocReadResourceLC( |
|
839 R_WPA_UNENCRYPTED_CONN_ALLOW ) ); |
|
840 CleanupStack::PopAndDestroy(); |
|
841 |
|
842 aCurrvalue = iSecuritySettings->WPAUnencryptedConn(); |
|
843 } |
|
844 |
|
845 return items; |
796 return items; |
846 } |
797 } |
847 |
798 |
848 |
799 |
849 // --------------------------------------------------------- |
800 // --------------------------------------------------------- |
866 { |
817 { |
867 iSecuritySettings->SetWPAMode( aCurrvalue ); |
818 iSecuritySettings->SetWPAMode( aCurrvalue ); |
868 retVal = ETrue; |
819 retVal = ETrue; |
869 } |
820 } |
870 } |
821 } |
871 else if ( aData == EWpaWpa2Only ) |
822 else // EWpaWpa2Only: |
872 { |
823 { |
873 if ( iSecuritySettings->Wpa2Only() != aCurrvalue ) |
824 if ( iSecuritySettings->Wpa2Only() != aCurrvalue ) |
874 { |
825 { |
875 iSecuritySettings->SetWpa2Only( aCurrvalue ); |
826 iSecuritySettings->SetWpa2Only( aCurrvalue ); |
876 retVal = ETrue; |
827 retVal = ETrue; |
877 } |
828 } |
878 } |
829 } |
879 else // EWpaUnencryptedConn |
|
880 { |
|
881 if ( iSecuritySettings->WPAUnencryptedConn() != aCurrvalue ) |
|
882 { |
|
883 iSecuritySettings->SetWPAUnencryptedConn( aCurrvalue ); |
|
884 retVal = ETrue; |
|
885 } |
|
886 } |
|
887 |
830 |
888 return retVal; |
831 return retVal; |
889 } |
832 } |
890 |
833 |
891 |
834 |
913 TInt itemIndex; |
856 TInt itemIndex; |
914 TInt shift; |
857 TInt shift; |
915 |
858 |
916 itemIndex = ( Max( iList->CurrentItemIndex(), 0 ) ); |
859 itemIndex = ( Max( iList->CurrentItemIndex(), 0 ) ); |
917 |
860 |
918 //In 802.1x the first item is EapConfig and second item is UncryptedConn |
861 shift = ( itemIndex >= EWpaWpa2Only || |
919 if (iSecuritySettings->SecurityMode() == ESecurityMode8021x) |
862 ( itemIndex == EWpaEapConfig && |
920 { |
863 iSecuritySettings->WPAMode() ) ) ? 1 : 0; |
921 shift = ( itemIndex == EWpaMode ) ? 1 : 3; |
864 |
922 } |
|
923 else |
|
924 { |
|
925 shift = ( itemIndex >= EWpaWpa2Only || |
|
926 ( itemIndex == EWpaEapConfig && |
|
927 iSecuritySettings->WPAMode() ) ) ? 1 : 0; |
|
928 } |
|
929 |
|
930 TWpaMember* ptr = iFieldsMain + itemIndex + shift; |
865 TWpaMember* ptr = iFieldsMain + itemIndex + shift; |
931 TInt* titPtr = iTitlesMain + itemIndex + shift; |
866 TInt* titPtr = iTitlesMain + itemIndex + shift; |
932 |
867 |
933 switch ( *ptr ) |
868 switch ( *ptr ) |
934 { |
869 { |
986 UpdateTextualListBoxItemL( *ptr, *titPtr, itemIndex ); |
921 UpdateTextualListBoxItemL( *ptr, *titPtr, itemIndex ); |
987 *iEventStore |= CWPASecuritySettings::EModified; |
922 *iEventStore |= CWPASecuritySettings::EModified; |
988 } |
923 } |
989 break; |
924 break; |
990 } |
925 } |
991 |
|
992 case EWpaUnencryptedConn: |
|
993 { // Setting item with two available values |
|
994 TBool changed( ETrue ); |
|
995 if ( aQuick ) |
|
996 { |
|
997 iSecuritySettings->SetWPAUnencryptedConn( |
|
998 !iSecuritySettings->WPAUnencryptedConn() ); |
|
999 } |
|
1000 else |
|
1001 { |
|
1002 changed = ShowPopupSettingPageL( EWpaUnencryptedConn ); |
|
1003 } |
|
1004 |
|
1005 if ( changed ) |
|
1006 { |
|
1007 UpdateTextualListBoxItemL( *ptr, *titPtr, itemIndex ); |
|
1008 *iEventStore |= CWPASecuritySettings::EModified; |
|
1009 } |
|
1010 break; |
|
1011 } |
|
1012 |
926 |
1013 case EWpaPreSharedKey: |
927 case EWpaPreSharedKey: |
1014 { // Text setting item |
928 { // Text setting item |
1015 if ( ShowPopupTextSettingPageL() ) |
929 if ( ShowPopupTextSettingPageL() ) |
1016 { |
930 { |