wlansecuritysettings/wpasecuritysettingsui/src/WPASecuritySettingsImpl.cpp
branchRCL_3
changeset 55 9c2aa05919d9
parent 46 c74b3d9f6b9e
--- a/wlansecuritysettings/wpasecuritysettingsui/src/WPASecuritySettingsImpl.cpp	Wed Sep 01 12:23:57 2010 +0100
+++ b/wlansecuritysettings/wpasecuritysettingsui/src/WPASecuritySettingsImpl.cpp	Wed Oct 13 14:35:46 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 /*
-* %version: tr1cfwln#29 %
+* %version: tr1cfwln#27 %
 */
 
 // INCLUDE FILES
@@ -69,8 +69,7 @@
                                                 TSecurityMode aSecurityMode )
 : iSecurityMode( aSecurityMode ),
   iWPAMode( EFalse ),
-  iWpa2Only( EFalse ),
-  iWPAUnencryptedConn( EFalse )
+  iWpa2Only( EFalse )
     {
     iWPAEAPPlugin.Zero();
     iWPAPreSharedKey.Zero();
@@ -124,26 +123,18 @@
     TInt errorCode = wLanServiceTable->GotoFirstRecord();
     if ( errorCode == KErrNone )
         {
-        if ( iSecurityMode == ESecurityMode8021x )
-            {
-            // in 802.1x PSK mode is not supported
-            iWPAMode = EFalse;
+        // Get WPA Mode
+        TRAPD( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_ENABLE_WPA_PSK ),
+                                                ( TUint32& ) iWPAMode ) );
+        if ( err != KErrNone )
+            { // do not leave if value is not present in table...
+            if ( err != KErrUnknown )
+                User::Leave( err );
             }
-        else
-            {
-            // Get WPA Mode
-            TRAPD( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_ENABLE_WPA_PSK ),
-                                                    ( TUint32& ) iWPAMode ) );
-            if ( err != KErrNone )
-                { // do not leave if value is not present in table...
-                if ( err != KErrUnknown )
-                    User::Leave( err );
-                }
-            }
-        
+
         TUint32 secMode = 0;
         // Get WPA2 Only Mode
-        TRAPD( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_SECURITY_MODE ),
+        TRAP( err, wLanServiceTable->ReadUintL( TPtrC( WLAN_SECURITY_MODE ),
                                                  secMode ) );
         if ( err != KErrNone )
             { // do not leave if value is not present in table...
@@ -153,19 +144,6 @@
 
         iWpa2Only = secMode == EWpa2;
 
-        // Get Unencrypted Connection mode for 802.1x
-        if ( iSecurityMode == ESecurityMode8021x )
-            {
-            // WLAN_WPA_KEY_LENGTH is used also for Unencrypted Connection mode
-            TRAPD( err2, wLanServiceTable->ReadUintL( TPtrC( WLAN_WPA_KEY_LENGTH ),
-                                                ( TUint32& ) iWPAUnencryptedConn ) );
-            if ( err2 != KErrNone )
-                { // do not leave if value is not present in table...
-                if ( err2 != KErrUnknown )
-                    User::Leave( err2 );
-                }
-            }
-
         // Get EAP list
     	iWPAEAPPlugin.Copy( *wLanServiceTable->ReadLongTextLC( 
                                                         TPtrC( WLAN_EAPS ) ) );
@@ -270,11 +248,8 @@
 	        }
 	        
         // Get PreShared Key
-	    if ( iSecurityMode != ESecurityMode8021x )
-	        {
-            wLanServiceTable->ReadTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), 
+        wLanServiceTable->ReadTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), 
                                     iWPAPreSharedKey );
-	        }
 
         if ( !IsValidPsk( iWPAPreSharedKey ) )
             {       
@@ -318,11 +293,8 @@
         }
 
     // Save WPA Mode
-    if ( iSecurityMode != ESecurityMode8021x )
-        {
-        wLanServiceTable->WriteUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), 
+    wLanServiceTable->WriteUintL( TPtrC( WLAN_ENABLE_WPA_PSK ), 
                                   ( TUint32& ) iWPAMode );
-        }
 
     TUint32 secMode;
 
@@ -359,26 +331,13 @@
                                   iWPADisabledEAPPlugin? 
                                         (const TDesC8&)*iWPADisabledEAPPlugin: 
                                         (const TDesC8&)KNullDesC8 );
- 
-
+    // Save PreShared Key
+    wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), 
+                                  iWPAPreSharedKey );
 
-    if ( iSecurityMode == ESecurityMode8021x )
-        {
-        // In 802.1x WpaKeyLength is not used 
-        // and the field is reused to save UnencryptedConn mode
-        wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), 
-                                      ( TUint32& ) iWPAUnencryptedConn );
-        }
-    else
-        {
-        // Save PreShared Key
-        wLanServiceTable->WriteTextL( TPtrC( WLAN_WPA_PRE_SHARED_KEY ), 
-                                  iWPAPreSharedKey );
-    
-        // Save PreShared Key Length
-        wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), 
-                                        iWPAPreSharedKey.Length() );
-        }
+    // Save PreShared Key Length
+    wLanServiceTable->WriteUintL( TPtrC( WLAN_WPA_KEY_LENGTH ), 
+                                  iWPAPreSharedKey.Length() );
 
     wLanServiceTable->PutRecordChanges();
 
@@ -583,32 +542,16 @@
 
     if( generic->FindL( aSession) )
         {
-        if ( iSecurityMode == ESecurityMode8021x )
-            {
-            // in 802.1x PSK mode is not supported
-            iWPAMode = EFalse;
-            }
-        else
-            {
-            // Get WPA mode
-            CMDBField<TUint>* enableWpaPskField = static_cast<CMDBField<TUint>*>
+        // Get WPA mode
+        CMDBField<TUint>* enableWpaPskField = static_cast<CMDBField<TUint>*>
                           ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) );
-            iWPAMode = *enableWpaPskField;
-            }
+        iWPAMode = *enableWpaPskField;
         
         // Get WPA2 Only Mode
         CMDBField<TUint>* secModeField = static_cast<CMDBField<TUint>*>
                                ( generic->GetFieldByIdL( KCDTIdWlanSecMode ) );
         TUint32 secMode = *secModeField;
         iWpa2Only = secMode == EWpa2;
- 
-        // Get 802.1x Unencrypted Connection saved in reused WpaKeyLengthField
-        if ( iSecurityMode == ESecurityMode8021x )
-            {
-            CMDBField<TUint>* WpaKeyLengthField = static_cast<CMDBField<TUint>*>
-                          ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) );
-            iWPAUnencryptedConn = *WpaKeyLengthField;
-            }
         
         // Get EAP plugins
         CMDBField<TDesC>* wlanEapsField = static_cast<CMDBField<TDesC>*>
@@ -709,13 +652,10 @@
 	        }
 
         // GetWPA preshared key
-	    if ( iSecurityMode != ESecurityMode8021x )
-	        {
-            CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*>
+        CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*>
                        ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) );
-            iWPAPreSharedKey = *wpaPskField;
-	        }
-	    
+        iWPAPreSharedKey = *wpaPskField;
+        
         if ( !IsValidPsk( iWPAPreSharedKey ) )
             {       
             // invalid key format
@@ -758,14 +698,11 @@
    
     // If loading failed, WLAN service record will be 
     // created and StoreL()-d, otherwise, ModifyL()
-
-    if ( iSecurityMode != ESecurityMode8021x )
-        {
-        // Set WPA mode
-        CMDBField<TUint>* enableWpaPskField = static_cast<CMDBField<TUint>*>
-                ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) );
-        enableWpaPskField->SetL( iWPAMode );
-        }
+    
+    // Set WPA mode
+    CMDBField<TUint>* enableWpaPskField = static_cast<CMDBField<TUint>*>
+                          ( generic->GetFieldByIdL( KCDTIdWlanEnableWpaPsk ) );
+    enableWpaPskField->SetL( iWPAMode );
     
     // Set security mode
     TUint32 secMode;
@@ -808,23 +745,15 @@
                                     (const TDesC8&)*iWPADisabledEAPPlugin: 
                                     (const TDesC8&)KNullDesC8 );
 
+    // Save PreShared Key
+    CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*>
+                       ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) );
+    wpaPskField->SetL( iWPAPreSharedKey );
+
     // Save PreShared Key length
     CMDBField<TUint>* keyLengthField = static_cast<CMDBField<TUint>*>
                         ( generic->GetFieldByIdL( KCDTIdWlanWpaKeyLength ) );
-    if ( iSecurityMode == ESecurityMode8021x )
-        {
-        // In 802.1x keyLengthField is reused to contain Unencrypted Connection info
-        keyLengthField->SetL( iWPAUnencryptedConn );
-        }
-    else
-        {
-        keyLengthField->SetL( iWPAPreSharedKey.Length() );
-        
-        // Save PreShared Key
-        CMDBField<TDesC8>* wpaPskField = static_cast<CMDBField<TDesC8>*>
-                           ( generic->GetFieldByIdL( KCDTIdWlanWpaPreSharedKey ) );
-        wpaPskField->SetL( iWPAPreSharedKey );
-        }
+    keyLengthField->SetL( iWPAPreSharedKey.Length() );
     
     TInt error( KErrNone );