Changeset 2904

Show
Ignore:
Timestamp:
10/14/08 14:54:18 (17 months ago)
Author:
kris
Message:

Commit of a large update to the wifi configuration tool. Now you can save multiple ssid / wifi profiles to the wpa_supplicant.conf file, and the system will connect to what the best one available is. Very handy for travel now :)

Location:
pcbsd
Files:
18 added
18 modified

Legend:

Unmodified
Added
Removed
  • pcbsd/branches/7.0/wificonfig/dialogwpapersonal.cpp

    r2166 r2904  
    2424{ 
    2525  if ( lineKey->text() != lineKey2->text() ) 
    26     { 
    27         QMessageBox::warning( this, "Network Key Error", "Error: The entered network keys do not match!\n" ); 
    28     } else { 
    29         emit saved(lineKey->text()); 
    30         close(); 
    31     } 
     26  { 
     27     QMessageBox::warning( this, "Network Key Error", "Error: The entered network keys do not match!\n" ); 
     28     return; 
     29  }  
     30   
     31  if ( lineKey->text().length() < 8 || lineKey->text().length() > 63 ) 
     32  { 
     33     QMessageBox::warning( this, "Network Key Error", "Error: The network key must be between 8-63 characters in length!\n" ); 
     34     return; 
     35  }  
     36 
     37  emit saved(lineKey->text()); 
     38  close(); 
    3239} 
  • pcbsd/branches/7.0/wificonfig/wificonfig.pro

    r2669 r2904  
    1212           wepconfig.h \ 
    1313           wificonfigwidgetbase.h \ 
     14           wifiscanssid.h \ 
    1415           wifiselectiondialog.h 
    1516 
     
    1920           wepconfig.cpp \ 
    2021           wificonfigwidgetbase.cpp \ 
     22           wifiscanssid.cpp \ 
    2123           wifiselectiondialog.cpp 
    2224 
     
    2527        wepconfig.ui \ 
    2628        dialogwpapersonal.ui \ 
     29        wifiscanssid.ui \ 
    2730        dialogwpaenterprise.ui 
    2831 
  • pcbsd/branches/7.0/wificonfig/wificonfig.qrc

    r2166 r2904  
    11<RCC> 
    22  <qresource> 
     3    <file>object-locked.png</file> 
     4    <file>object-unlocked.png</file> 
     5    <file>edit-delete.png</file> 
     6    <file>list-add.png</file> 
     7    <file>arrow-up.png</file> 
     8    <file>arrow-down.png</file> 
    39    <file>folder_open.png</file> 
    410    <file>tray_wifi85.png</file> 
  • pcbsd/branches/7.0/wificonfig/wificonfigwidgetbase.cpp

    r2895 r2904  
    7474    } 
    7575         
    76          
    77      // Check if we are not using security and write the entry 
    78      if ( radioSecurityDisabled->isChecked() ) 
    79     { 
    80         saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
    81  
    82         // Now create the wpa_supplicant file based on saved configuration 
    83         QFile fileout( "/etc/wpa_supplicant.conf" ); 
    84         if ( fileout.open( IO_WriteOnly ) ) { 
    85  
    86           QTextStream streamout( &fileout ); 
    87           if ( checkBSSID->isChecked() ) { 
    88             streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n"; 
    89           } else { 
    90             streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n"; 
    91           } 
    92  
    93           streamout << " scan_ssid=1\n"; 
    94           streamout << " key_mgmt=NONE\n"; 
    95           streamout << "}\n"; 
    96           fileout.close(); 
    97  
    98         } 
    99      } else if (radioSecurityWEP->isChecked() ) { 
    100         // Write the settings with WEP enabled 
    101              
    102        // Check that we even have a WEP Key yet 
    103       if ( WEPKey.isEmpty() ) 
    104       { 
    105         QMessageBox::warning( this, tr("Warning"), 
    106             tr("WEP is selected, but not configured!\nPlease configure your WEP key before saving!") ); 
    107         return; 
    108       }     
    109              
    110      // Indicate that we are using WPA supplicant 
    111      saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
    112  
    113      // Now create the wpa_supplicant file based on saved configuration 
     76    saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
     77         
     78    // Now create the wpa_supplicant file based on saved configuration 
    11479    QFile fileout( "/etc/wpa_supplicant.conf" ); 
    11580    if ( fileout.open( IO_WriteOnly ) ) { 
    116         QTextStream streamout( &fileout ); 
    117         if ( checkBSSID->isChecked() ) { 
    118             streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n"; 
    119         } else { 
    120             streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n"; 
    121         } 
    122  
    123         streamout << " scan_ssid=1\n"; 
    124         streamout << " key_mgmt=NONE\n"; 
    125         streamout << " wep_tx_keyidx=" + tmp.setNum(WEPIndex -1) + "\n"; 
    126         streamout << " wep_key" + tmp.setNum(WEPIndex -1) + "=" + WEPKey + "\n"; 
    127         streamout << "}\n"; 
    128         fileout.close(); 
    129     } 
    130  
    131              
    132     } else if (radioSecurityWPAPersonal->isChecked() ) { 
    133       // Write the settings with WPA-Personal enabled 
    134              
    135      // Check that we even have a WPA-Personal Key yet 
    136     if ( WPAPersonalKey.isEmpty() ) 
    137     { 
    138         QMessageBox::warning( this, tr("Warning"), 
    139             tr("WPA-Personal is selected, but not configured!\nPlease configure your WPA key before saving!") ); 
    140                 return; 
    141     }     
    142              
    143              
    144     // If we are using WPA security, write the ifconfig line, and wpa_supplicant line 
    145      saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
    146      // Now create the wpa_supplicant file based on saved configuration    
    147     QFile fileout( "/etc/wpa_supplicant.conf" ); 
    148     if ( fileout.open( IO_WriteOnly ) ) { 
    149         QTextStream streamout( &fileout ); 
    150         if ( checkBSSID->isChecked() ) { 
    151             streamout << "network={\n bssid=\"" + lineBSSID->text() + "\"\n ";  
    152         } else { 
    153             streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n ";  
    154         } 
    155  
    156         streamout << " scan_ssid=1\n";   
    157         streamout << " psk=\"" + WPAPersonalKey + "\"\n}\n";     
    158         fileout.close(); 
    159     } 
    160 } else if (radioSecurityWPAEnt->isChecked() ) { 
    161           // Write the settings with WPA-Enterprise enabled 
    162              
    163    // Check if the key is setup for WPA EAP-TLS 
    164     if ( WPAEType == 1 && ( WPAEIdent.isEmpty() || WPAECACert.isEmpty() || WPAEClientCert.isEmpty() || WPAEPrivKeyFile.isEmpty() || WPAEPassword.isEmpty() )) { 
    165         QMessageBox::warning( this, tr("Warning"), 
    166             tr("WPA-Enterprise is selected, but not configured!\nPlease configure your WPA settings before saving!") ); 
    167                 return; 
    168     }     
    169      
    170        // Check if the key is setup for WPA EAP-TTLS && EAP-PEAP 
    171     if ( (WPAEType == 2 || WPAEType == 3) && ( WPAEIdent.isEmpty() || WPAECACert.isEmpty()  || WPAEPassword.isEmpty() ) ) { 
    172         QMessageBox::warning( this, tr("Warning"), 
    173             tr("WPA-Enterprise is selected, but not configured!\nPlease configure your WPA settings before saving!") ); 
    174                 return; 
    175     }     
    176      
    177              
    178              
    179     // If we are using WPA security, write the ifconfig line, and wpa_supplicant line 
    180      saveValue( "/etc/rc.conf", "ifconfig_" + DeviceName, "ifconfig_" + DeviceName + "=\"WPA " + ifConfigLine + "\"", -1); 
    181      // Now create the wpa_supplicant file based on saved configuration    
    182     QFile fileout( "/etc/wpa_supplicant.conf" ); 
    183     if ( fileout.open( IO_WriteOnly ) ) { 
    184         QTextStream streamout( &fileout ); 
    185          
    186          
    187         streamout << "network={\n ssid=\"" + lineSSID->text() + "\"\n"; 
    188         if ( WPAEType == 1) { 
    189             streamout << " proto=RSN\n key_mgmt=WPA-EAP\n eap=TLS\n"; 
    190             streamout << " identity=\"" + WPAEIdent + "\"\n"; 
    191             streamout << " ca_cert=\"" + WPAECACert + "\"\n"; 
    192             streamout << " client_cert=\"" + WPAEClientCert + "\"\n"; 
    193             streamout << " private_key=\"" + WPAEPrivKeyFile + "\"\n"; 
    194             streamout << " private_key_password=\"" + WPAEPassword + "\"\n"; 
    195             streamout << " scan_ssid=1\n";       
    196         } else if (WPAEType == 2) { 
    197             streamout << " proto=RSN\n key_mgmt=WPA-EAP\n eap=TTLS\n"; 
    198             streamout << " identity=\"" + WPAEIdent + "\"\n"; 
    199             streamout << " password=\"" + WPAEPassword + "\"\n"; 
    200             streamout << " ca_cert=\"" + WPAECACert + "\"\n"; 
    201             streamout << " phase2=\"auth=MD5\"\n"; 
    202             streamout << " scan_ssid=1\n";       
    203              
    204         } else if (WPAEType == 3) { 
    205             streamout << " proto=RSN\n key_mgmt=WPA-EAP\n eap=PEAP\n"; 
    206             streamout << " identity=\"" + WPAEIdent + "\"\n"; 
    207             streamout << " password=\"" + WPAEPassword + "\"\n"; 
    208             streamout << " ca_cert=\"" + WPAECACert + "\"\n"; 
    209             streamout << " phase1=\"peaplabel=0\"\n"; 
    210             streamout << " phase2=\"auth=MSCHAPV2\"\n"; 
    211             streamout << " scan_ssid=1\n";       
    212         } 
    213          
    214         streamout << "}\n";      
    215          
    216          
    217         fileout.close(); 
    218     } 
    219 } 
     81       QTextStream streamout( &fileout ); 
     82 
     83       // Loop through all the devices we have now 
     84       for(int curItem=0; curItem < 149; curItem++) 
     85       { 
     86         if ( ! SSIDList[curItem].isEmpty() ) 
     87         { 
     88 
     89 
     90 
     91 
     92       if ( BSSID[curItem]) { 
     93          streamout << "network={\n bssid=" + SSIDList[curItem] + "\n"; 
     94       } else { 
     95         streamout << "network={\n ssid=\"" + SSIDList[curItem] + "\"\n"; 
     96       } 
     97 
     98       streamout << " scan_ssid=1\n"; 
     99 
     100       if ( SSIDEncType[curItem] == NO_ENCRYPTION ) 
     101       { 
     102          streamout << " key_mgmt=NONE\n"; 
     103       } else if (SSIDEncType[curItem] == WEP_ENCRYPTION ) { 
     104           
     105          streamout << " key_mgmt=NONE\n"; 
     106          streamout << " wep_tx_keyidx=" + tmp.setNum(WEPIndex[curItem]) + "\n"; 
     107          // Check if we are using a plaintext WEP or not 
     108          if ( WEPHex[curItem] ) { 
     109            streamout << " wep_key" + tmp.setNum(WEPIndex[curItem]) + "=" + WEPKey[curItem] + "\n"; 
     110          } else { 
     111            streamout << " wep_key" + tmp.setNum(WEPIndex[curItem]) + "=\"" + WEPKey[curItem] + "\"\n"; 
     112          } 
     113 
     114       } else if (SSIDEncType[curItem] == WPA_ENCRYPTION ) { 
     115 
     116          streamout << " psk=\"" + WPAPersonalKey[curItem] + "\"\n";     
     117 
     118       } else if (SSIDEncType[curItem] == WPAE_ENCRYPTION ) { 
     119 
     120          if ( WPAEType[curItem] == 1) { 
     121             streamout << " proto=RSN\n key_mgmt=WPA-EAP\n eap=TLS\n"; 
     122             streamout << " identity=\"" + WPAEIdent[curItem] + "\"\n"; 
     123             streamout << " ca_cert=\"" + WPAECACert[curItem] + "\"\n"; 
     124             streamout << " client_cert=\"" + WPAEClientCert[curItem] + "\"\n"; 
     125             streamout << " private_key=\"" + WPAEPrivKeyFile[curItem] + "\"\n"; 
     126             streamout << " private_key_password=\"" + WPAEPassword[curItem] + "\"\n"; 
     127 
     128          } else if (WPAEType[curItem] == 2) { 
     129             streamout << " proto=RSN\n key_mgmt=WPA-EAP\n eap=TTLS\n"; 
     130             streamout << " identity=\"" + WPAEIdent[curItem] + "\"\n"; 
     131             streamout << " password=\"" + WPAEPassword[curItem] + "\"\n"; 
     132             streamout << " ca_cert=\"" + WPAECACert[curItem] + "\"\n"; 
     133             streamout << " phase2=\"auth=MD5\"\n"; 
    220134           
    221      
    222      
    223       // Now restart the network for new settings to take effect 
    224  
    225  
    226     QFile filerestart( "/tmp/.netrestart.sh" ); 
    227     if ( filerestart.open( IO_WriteOnly ) ) { 
     135          } else if (WPAEType[curItem] == 3) { 
     136             streamout << " proto=RSN\n key_mgmt=WPA-EAP\n eap=PEAP\n"; 
     137             streamout << " identity=\"" + WPAEIdent[curItem] + "\"\n"; 
     138             streamout << " password=\"" + WPAEPassword[curItem] + "\"\n"; 
     139             streamout << " ca_cert=\"" + WPAECACert[curItem] + "\"\n"; 
     140             streamout << " phase1=\"peaplabel=0\"\n"; 
     141             streamout << " phase2=\"auth=MSCHAPV2\"\n"; 
     142          } 
     143       } 
     144 
     145       streamout << "}\n\n"; 
     146 
     147         } // End of if check if SSIDList is empty 
     148       } // End of for loop 
     149 
     150       fileout.close(); 
     151     }  
     152 
     153     
     154   // Now restart the network for new settings to take effect 
     155   QFile filerestart( "/tmp/.netrestart.sh" ); 
     156   if ( filerestart.open( IO_WriteOnly ) ) { 
    228157        QTextStream streamrestart( &filerestart ); 
    229158        streamrestart << "#!/bin/sh\n"; 
    230159        streamrestart << "/etc/rc.d/netif restart " << DeviceName << "\n"; 
    231         streamrestart << "/etc/rc.d/routing restart";    
     160        //streamrestart << "/etc/rc.d/routing restart";  
    232161        filerestart.close(); 
    233     } 
    234  
    235  
    236      runCommand("chmod 755 /tmp/.netrestart.sh ; sh /tmp/.netrestart.sh"); 
     162   } 
     163 
     164 
     165   runCommand("chmod 755 /tmp/.netrestart.sh ; sh /tmp/.netrestart.sh"); 
    237166      
    238        pushApply->setEnabled(FALSE); 
    239  
    240        // netifProc = new Q3Process( this ); 
    241        // netifProc->addArgument( "/tmp/.netrestart.sh" ); 
    242  
    243        // if ( !netifProc->start() ) { 
    244        // } 
    245         
    246      
     167   pushApply->setEnabled(FALSE); 
    247168} 
    248169 
     
    260181 
    261182 
     183// Function which is called at the program init 
    262184void wificonfigwidgetbase::setDevice( QString Device ) 
    263185{  
    264186     
    265  
    266  
    267 // Make sure our variables are initialized properly 
    268 WEPKey = ""; 
    269 WEPIndex = 1; 
    270 WEPHex = true; 
    271 WPAPersonalKey = ""; 
    272 WPAEType = 1; 
    273 WPAEIdent=""; 
    274 WPAECACert=""; 
    275 WPAEClientCert=""; 
    276 WPAEPrivKeyFile=""; 
    277 WPAEPassword=""; 
     187  // Connect our add / remove buttons for wifi 
     188  connect( pushAddWifi, SIGNAL( clicked() ), this, SLOT( slotAddNewProfile() ) );  
     189  connect( pushRemoveWifi, SIGNAL( clicked() ), this, SLOT( slotRemoveProfile() ) );  
    278190 
    279191 
     
    481393} 
    482394 
    483  
    484 void wificonfigwidgetbase::slotConfig() 
     395void wificonfigwidgetbase::slotRemoveProfile() 
     396{ 
     397    // Check if we have a selection to work with 
     398    if ( listWifi->currentRow() != -1 ) 
     399    { 
     400      // Locate the SSID we want to remove 
     401      QString removeSSID = listWifi->item(listWifi->currentRow())->text(); 
     402      for ( int curItem = 0; curItem < 149; curItem++) 
     403      { 
     404          if ( SSIDList[curItem] == removeSSID ) 
     405          { 
     406             SSIDList[curItem] = ""; 
     407          } 
     408      } 
     409 
     410      // Refresh the SSID list and enable the apply button 
     411      slotRefreshSSIDList(); 
     412      pushApply->setEnabled(TRUE); 
     413 
     414    } 
     415   
     416} 
     417 
     418void wificonfigwidgetbase::slotAddNewProfile() 
    485419{ 
    486420   wifiselect = new wifiselectiondialog(); 
    487    wifiselect->init(DeviceName, lineSSID->text()); 
    488    connect( wifiselect, SIGNAL( saved(QString) ), this, SLOT( slotSSIDChanged(QString) ) );  
     421   wifiselect->init(DeviceName); 
     422 
     423   connect( wifiselect, SIGNAL( signalSavedOpen(QString, bool) ), this, SLOT( slotAddNewProfileOpen(QString, bool) ) );  
     424 
     425   connect( wifiselect, SIGNAL( signalSavedWEP( QString, bool, QString, int, bool ) ), this, SLOT( slotAddNewProfileWEP( QString, bool, QString, int, bool) ) );  
     426   connect( wifiselect, SIGNAL( signalSavedWPA(QString, bool, QString) ), this, SLOT( slotAddNewProfileWPA(QString, bool, QString) ) );  
     427 
     428   connect( wifiselect, SIGNAL( signalSavedWPAE(QString, bool, int, QString, QString, QString, QString, QString) ), this, SLOT( slotAddNewProfileWPAE(QString, bool, int, QString, QString, QString, QString, QString) ) );  
     429 
    489430   wifiselect->exec(); 
    490431} 
     
    497438} 
    498439 
    499  
    500 void wificonfigwidgetbase::slotSSIDChanged( QString newSSID ) 
    501 { 
    502        lineSSID->setText(newSSID); 
    503 } 
    504  
    505  
    506 void wificonfigwidgetbase::slotConfigWEP() 
    507 { 
    508    dialogWEP = new wepConfig(); 
     440void wificonfigwidgetbase::slotAddNewProfileOpen(QString SSID, bool isBSSID) 
     441{ 
     442 
     443   for (int dupItem = 0; dupItem < 149; dupItem++) 
     444   { 
     445      if ( SSID == SSIDList[dupItem] ) { 
     446        QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") ); 
     447        return; 
     448      } 
     449   } 
     450 
     451 
     452   int curItem=0; 
     453 
     454   while( ! SSIDList[curItem].isEmpty() && curItem < 149 ) 
     455   { 
     456     curItem++; 
     457   } 
     458 
     459    // Find which current item we are working on 
     460 
     461    SSIDList[curItem] = SSID; 
     462    BSSID[curItem] = isBSSID; 
     463     
     464    // Refresh the SSID listbox and enable the apply button 
     465    slotRefreshSSIDList(); 
     466    slotCheckGlobalText(); 
     467} 
     468 
     469void wificonfigwidgetbase::slotAddNewProfileWEP( QString SSID, bool isBSSID, QString newKey, int newIndex, bool hexkey ) 
     470{ 
     471   for (int dupItem = 0; dupItem < 149; dupItem++) 
     472   { 
     473      if ( SSID == SSIDList[dupItem] ) { 
     474        QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") ); 
     475        return; 
     476      } 
     477   } 
     478 
     479 
     480   int curItem=0; 
     481 
     482   while( ! SSIDList[curItem].isEmpty() && curItem < 149 ) 
     483   { 
     484     curItem++; 
     485   } 
     486 
     487    // Find which current item we are working on 
     488   
     489    SSIDList[curItem] = SSID; 
     490    SSIDEncType[curItem] = WEP_ENCRYPTION; 
     491    BSSID[curItem] = isBSSID; 
     492    WEPKey[curItem] = newKey; 
     493    WEPIndex[curItem] = newIndex; 
     494    WEPIndex[curItem]--; 
     495    WEPHex[curItem] = hexkey; 
     496 
     497    // Refresh the SSID listbox and enable the apply button 
     498    slotRefreshSSIDList(); 
     499    slotCheckGlobalText(); 
     500 
     501} 
     502 
     503 
     504void wificonfigwidgetbase::slotAddNewProfileWPA( QString SSID, bool isBSSID, QString newKey ) 
     505{ 
     506   for (int dupItem = 0; dupItem < 149; dupItem++) 
     507   { 
     508      if ( SSID == SSIDList[dupItem] ) { 
     509        QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") ); 
     510        return; 
     511      } 
     512   } 
     513 
     514   int curItem=0; 
     515 
     516   while( ! SSIDList[curItem].isEmpty() && curItem < 149 ) 
     517   { 
     518     curItem++; 
     519   } 
     520 
     521 
     522   SSIDList[curItem] = SSID; 
     523   SSIDEncType[curItem] = WPA_ENCRYPTION; 
     524   BSSID[curItem] = isBSSID; 
     525   WPAPersonalKey[curItem] = newKey; 
    509526    
    510    if ( ! WEPKey.isEmpty() ) 
     527   // Refresh the SSID listbox and enable the apply button 
     528   slotRefreshSSIDList(); 
     529   slotCheckGlobalText(); 
     530} 
     531 
     532 
     533void wificonfigwidgetbase::slotAddNewProfileWPAE( QString SSID, bool isBSSID, int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass ) 
     534{ 
     535 
     536   for (int dupItem = 0; dupItem < 149; dupItem++) 
    511537   { 
    512        dialogWEP->setKey(WEPKey, WEPIndex, WEPHex); 
    513    } 
    514     
    515    connect( dialogWEP, SIGNAL( saved(QString, int, bool) ), this, SLOT( slotWEPChanged(QString, int, bool) ) );  
    516    dialogWEP->exec(); 
    517 } 
    518  
    519  
    520 void wificonfigwidgetbase::slotWEPChanged( QString newKey, int newIndex, bool hexkey ) 
    521 { 
    522     WEPKey = newKey; 
    523     WEPIndex = newIndex; 
    524     WEPHex = hexkey; 
    525     // Check the status of the radio buttons 
    526     slotCheckSecurityRadio(); 
    527      
    528 } 
    529  
    530  
    531 void wificonfigwidgetbase::slotCheckSecurityRadio() 
    532 { 
    533     // Check to see which radio button is checked and take approiate actions 
    534      
    535     if ( radioSecurityDisabled->isChecked() ) 
    536     { 
    537         pushSecurity->setEnabled(FALSE); 
    538     } else if ( radioSecurityWEP->isChecked() ) { 
    539         pushSecurity->setEnabled(TRUE); 
    540         // Check if the key is setup 
    541         if ( ! WEPKey.isEmpty() ) 
    542         { 
    543             radioSecurityWEP->setText( tr("WEP (Configured)") ); 
    544         } else { 
    545             radioSecurityWEP->setText( tr("WEP") ); 
    546         } 
    547     } else if ( radioSecurityWPAPersonal->isChecked() ) { 
    548         pushSecurity->setEnabled(TRUE); 
    549         // Check if the key is setup 
    550         if ( ! WPAPersonalKey.isEmpty() ) 
    551         { 
    552             radioSecurityWPAPersonal->setText( tr("WPA Personal (Configured)") ); 
    553         } else { 
    554             radioSecurityWPAPersonal->setText( tr("WPA Personal") ); 
    555         } 
    556          
    557     } else if ( radioSecurityWPAEnt->isChecked() ) { 
    558         pushSecurity->setEnabled(TRUE); 
    559          
    560         // Check if the key is setup 
    561         if ( ! WPAEIdent.isEmpty() && ! WPAECACert.isEmpty() && ! WPAEPassword.isEmpty() ) { 
    562             radioSecurityWPAEnt->setText(tr("WPA Enterprise (Configured)") ); 
    563         } else { 
    564             radioSecurityWPAEnt->setText(tr("WPA Enterprise") ); 
    565         } 
    566  
    567     } 
    568  
    569      pushApply->setEnabled(TRUE); 
    570 } 
    571  
    572  
    573 void wificonfigwidgetbase::slotCheckWhichSecurity() 
    574 { 
    575         if ( radioSecurityDisabled->isChecked() ) 
    576     { 
    577             return; 
    578     } else if ( radioSecurityWEP->isChecked() ) { 
    579         // Run the WEP config dialog 
    580         slotConfigWEP(); 
    581     } else if ( radioSecurityWPAPersonal->isChecked() ) { 
    582         slotConfigWPAP(); 
    583     } else if ( radioSecurityWPAEnt->isChecked() ) { 
    584         slotConfigWPAE(); 
    585     } 
    586  
    587 } 
    588  
    589  
    590 void wificonfigwidgetbase::slotConfigWPAP() 
    591 { 
    592     // Bring up the WPA-Personal config dialog 
    593      
    594    dialogWPAP = new dialogWPAPersonal(); 
    595     
    596    if ( ! WPAPersonalKey.isEmpty() ) 
     538      if ( SSID == SSIDList[dupItem] ) { 
     539        QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") ); 
     540        return; 
     541      } 
     542   } 
     543 
     544   int curItem=0; 
     545 
     546   while( ! SSIDList[curItem].isEmpty() && curItem < 149 ) 
    597547   { 
    598        dialogWPAP->setKey(WPAPersonalKey); 
    599    } 
    600     
    601    connect( dialogWPAP, SIGNAL( saved(QString) ), this, SLOT( slotWPAPChanged(QString) ) );  
    602    dialogWPAP->exec(); 
    603  
    604 } 
    605  
    606  
    607 void wificonfigwidgetbase::slotConfigWPAE() 
    608 { 
    609    // Bring up the WPA-Enterprise config dialog 
    610      
    611    dialogWPAE = new dialogWPAEnterprise(); 
    612     
    613    if ( ! WPAEIdent.isEmpty() ) 
    614    { 
    615        dialogWPAE->setVariables(WPAEType, WPAEIdent, WPAECACert, WPAEClientCert, WPAEPrivKeyFile, WPAEPassword); 
    616    } 
    617     
    618    connect( dialogWPAE, SIGNAL( saved(int, QString, QString, QString, QString, QString) ), this, SLOT( slotWPAEChanged(int, QString, QString, QString, QString, QString) ) );  
    619    dialogWPAE->exec(); 
    620 } 
    621  
    622  
    623 void wificonfigwidgetbase::slotWPAPChanged( QString newKey ) 
    624 { 
    625     WPAPersonalKey = newKey; 
    626     slotCheckSecurityRadio(); 
    627 } 
    628  
    629  
    630 void wificonfigwidgetbase::slotWPAEChanged( int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass ) 
    631 { 
    632 WPAEType = type; 
    633 WPAEIdent=EAPIdent; 
    634 WPAECACert=CACert; 
    635 WPAEClientCert=ClientCert; 
    636 WPAEPrivKeyFile=PrivKeyFile; 
    637 WPAEPassword=PrivKeyPass; 
    638  
    639 slotCheckSecurityRadio(); 
     548     curItem++; 
     549   } 
     550 
     551 
     552   SSIDList[curItem] = SSID; 
     553   SSIDEncType[curItem] = WPAE_ENCRYPTION; 
     554   BSSID[curItem] = isBSSID; 
     555   WPAEType[curItem] = type; 
     556   WPAEIdent[curItem] = EAPIdent; 
     557   WPAECACert[curItem] = CACert; 
     558   WPAEClientCert[curItem] = ClientCert; 
     559   WPAEPrivKeyFile[curItem] = PrivKeyFile; 
     560   WPAEPassword[curItem] = PrivKeyPass; 
     561 
     562   // Refresh the SSID listbox and enable the apply button 
     563   slotRefreshSSIDList(); 
     564   slotCheckGlobalText(); 
    640565 
    641566} 
     
    644569void wificonfigwidgetbase::slotCheckDisabled() 
    645570{ 
    646         if (   checkDisableWireless->isChecked() )  
    647              { 
     571        if ( checkDisableWireless->isChecked() )  
     572        { 
    648573            tabMainWidget->setEnabled(FALSE); 
    649574        } else { 
     
    791716void wificonfigwidgetbase::showInfo() 
    792717{ 
    793      tabMainWidget->showPage( tabMainWidget->page(3) ); 
     718     tabMainWidget->showPage( tabMainWidget->page(2) ); 
    794719} 
    795720 
     
    827752 
    828753 
    829         // Look for the SSID 
    830         if ( tmp.find(" ssid") != -1 ) { 
    831                 tmp2 = tmp; 
    832                 tmp2 = tmp2.remove(0, tmp.find(" ssid") + 5 ); 
    833  
    834                 tmp2.simplifyWhiteSpace(); 
    835                 if ( tmp2.find(" ") != -1 ) { 
    836                     tmp2 = tmp2.section( " " , 1, 1 ); 
    837                 } 
    838                 if ( tmp2.find("\"") != -1) 
    839                 { 
    840                   tmp2 = tmp2.remove(0, tmp2.find("\"") +1 ); 
    841                   tmp2.truncate(tmp2.findRev("\"") ); 
    842                       } 
    843                 lineSSID->setText(tmp2);         
    844         }  
    845          
    846          
    847          
    848            // Look for the BSSID 
    849         if ( tmp.find("bssid") != -1 ) { 
    850                 tmp2 = tmp; 
    851                 tmp2 = tmp2.remove(0, tmp.find("bssid") + 5 ); 
    852                 tmp2.simplifyWhiteSpace(); 
    853                 if ( tmp2.find(" ") != -1 ) { 
    854                     tmp2 = tmp2.section( " " , 1, 1 ); 
    855                 } 
    856                 lineBSSID->setText(tmp2);        
    857                 lineSSID->setText(""); 
    858                 checkBSSID->setChecked(TRUE); 
    859                 slotBSSIDChecked(); 
    860         }  
    861          
    862         // Look for the WEP Encryption 
    863         if ( tmp.find("wepkey") != -1 ) { 
    864                 tmp2 = tmp; 
    865                 tmp2 = tmp2.remove(0, tmp.find("wepkey") + 6 ); 
    866                 tmp2.simplifyWhiteSpace(); 
    867                 if ( tmp2.find(" ") != -1 ) { 
    868                     tmp2 = tmp2.section( " " , 1, 1 ); 
    869                 } 
    870  
    871                 // Check if we are using the hex key, or plain text 
    872                 if ( tmp2.indexOf("0x") == 0) 
     754   } else if ( tmp.find("inet") != -1 ) { 
     755        // Get the IP address first 
     756        tmp2 = tmp; 
     757        tmp2 = tmp2.remove(0, tmp.find("inet") + 5 ); 
     758        tmp2.truncate(tmp.find("netmask") -1 ); 
     759        lineIP->setText(tmp2); 
     760 
     761        // Look for the netmask 
     762        if ( tmp.find("netmask") != -1 ) { 
     763           tmp2 = tmp; 
     764           tmp2 = tmp2.remove(0, tmp.find("netmask") + 8 ); 
     765           if ( tmp.find("ether") != -1 ) { 
     766              tmp2.truncate(tmp.find("ether") ); 
     767           } 
     768 
     769           lineNetmask->setText(tmp2); 
     770 
     771        } else { 
     772           // No netmask specified, default it instead 
     773           lineNetmask->setText("255.255.255.0"); 
     774        } 
     775   } 
     776 
     777    
     778   // Look for the wpa_supplicant.conf file 
     779   QFile file( "/etc/wpa_supplicant.conf" ); 
     780   if ( file.open( IO_ReadOnly ) ) { 
     781      int curItem=0; 
     782      QTextStream stream( &file ); 
     783      QString line; 
     784      while ( !stream.atEnd() ) { 
     785 
     786            line = stream.readLine(); // line of text excluding '\n' 
     787 
     788            // Check if we are at the end of a network profile block 
     789            if ( line.find("}") == 0) 
     790            { 
     791                curItem++; 
     792            } 
     793 
     794            if ( line.find(" ssid=") != -1 ) 
     795            { 
     796                tmp2 = line.remove(0, line.find("\"") +1 ); 
     797                tmp2.truncate(tmp2.find("\"") ); 
     798                SSIDList[curItem] = tmp2; 
     799                BSSID[curItem] = false; 
     800                SSIDEncType[curItem]=NO_ENCRYPTION; 
     801            } 
     802 
     803            if ( line.find(" bssid=") != -1 ) 
     804            { 
     805                tmp2 = line.remove(0, line.find("=") +1 ); 
     806                SSIDList[curItem] = tmp2; 
     807                BSSID[curItem] = true; 
     808                SSIDEncType[curItem]=NO_ENCRYPTION; 
     809            } 
     810         
     811         
     812            // Check if we are using a WEP key for this network 
     813            if ( line.find("wep_key") != -1 ) 
     814            {                   
     815                if (line.find("\"") != -1 ) 
    873816                { 
    874                   WEPHex = true; 
    875                   // Remove the 0x 
    876                   tmp2.remove(0, 2); 
     817                   tmp2 = line.remove(0, line.find("\"") + 1 ); 
     818                   tmp2.truncate(tmp2.find("\"")); 
     819                   WEPHex[curItem]=false; 
    877820                } else { 
    878                   WEPHex = false; 
     821                   tmp2 = line.remove(0, line.find("=") + 1 ); 
     822                   WEPHex[curItem]=true; 
    879823                } 
    880  
    881                 // Check if we need to remove the "0x" 
    882                 WEPKey = tmp2; 
    883  
    884  
    885                 radioSecurityWEP->setChecked(TRUE);      
    886         } 
    887          
    888         // Look for the WEP  transmit key 
    889         if ( tmp.find("weptxkey") != -1 ) { 
    890                 tmp2 = tmp; 
    891                 tmp2 = tmp2.remove(0, tmp.find("weptxkey") + 8 ); 
    892                 tmp2.simplifyWhiteSpace(); 
    893                 if ( tmp2.find(" ") != -1 ) { 
    894                     tmp2 = tmp2.section( " " , 1, 1 ); 
    895                 } 
    896                  
     824                // Save the keycode 
     825                WEPKey[curItem] = tmp2; 
     826                SSIDEncType[curItem]=WEP_ENCRYPTION; 
     827            } 
     828 
     829           // Check for the WEP tx key id 
     830           if ( line.find("wep_tx_keyidx") != -1 ) 
     831           {                    
     832                tmp2 = line.remove(0, line.find("wep_tx_keyidx") +1 ); 
     833                // Save the keycode 
     834                tmp2.truncate(tmp2.find("=") ); 
    897835                ok = tmp2.toInt(&ok); 
    898836                if ( ok ) { 
    899                     WEPIndex = tmp2.toInt(&ok); 
     837                    WEPIndex[curItem] = tmp2.toInt(&ok); 
     838                    WEPIndex[curItem]++; 
    900839                } 
    901                 radioSecurityWEP->setChecked(TRUE);      
    902         } 
    903          
    904        
    905    } else { 
    906         
    907                // Look for the SSID 
    908         if ( tmp.find(" ssid") != -1 ) { 
    909                 tmp2 = tmp; 
    910                 tmp2 = tmp2.remove(0, tmp.find(" ssid") + 5 ); 
    911                 tmp2.simplifyWhiteSpace(); 
    912  
    913                 if ( tmp2.find(" ") != -1 ) { 
    914                     tmp2 = tmp2.section( " " , 1, 1 ); 
    915                 } 
    916                 if ( tmp2.find("\"") != -1) 
    917                 { 
    918                   tmp2 = tmp2.remove(0, tmp2.find("\"") +1 ); 
    919                   tmp2.truncate(tmp2.findRev("\"") ); 
    920                       } 
    921  
    922                 lineSSID->setText(tmp2);         
    923         }  
    924          
    925          // Look for the BSSID 
    926         if ( tmp.find("bssid") != -1 ) { 
    927                 tmp2 = tmp; 
    928                 tmp2 = tmp2.remove(0, tmp.find("bssid") + 5 ); 
    929                 tmp2.simplifyWhiteSpace(); 
    930                 if ( tmp2.find(" ") != -1 ) { 
    931                     tmp2 = tmp2.section( " " , 1, 1 ); 
    932                 } 
    933                 lineBSSID->setText(tmp2);        
    934                 lineSSID->setText(""); 
    935                 checkBSSID->setChecked(TRUE); 
    936                 slotBSSIDChecked(); 
    937         }  
    938         
    939                 // Get the IP address first 
    940                 tmp2 = tmp; 
    941                 tmp2 = tmp2.remove(0, tmp.find("inet") + 5 ); 
    942                 //tmp2 = tmp2.remove(0, tmp.find(" ") ); 
    943                 tmp2.truncate(tmp.find("netmask") -1 ); 
    944                 lineIP->setText(tmp2); 
    945  
    946                 // Look for the netmask 
    947                 if ( tmp.find("netmask") != -1 ) { 
    948                         tmp2 = tmp; 
    949                         tmp2 = tmp2.remove(0, tmp.find("netmask") + 8 ); 
    950                         if ( tmp.find("ether") != -1 ) { 
    951                         tmp2.truncate(tmp.find("ether") ); 
    952                         } 
    953                         lineNetmask->setText(tmp2); 
    954                 } else { 
    955                    lineNetmask->setText("255.255.255.0"); 
    956                 } 
    957                  
    958          // Look for the mac address change 
    959         if ( tmp.find("ether") != -1 ) { 
    960                 tmp2 = tmp; 
    961                 tmp2 = tmp2.remove(0, tmp.find("ether") + 6 ); 
    962                 //if ( tmp.find(" ") != -1 ) { 
    963                 //  tmp2.truncate(tmp.find(" ") ); 
    964                 //} 
    965                 lineMAC->setText(tmp2); 
    966                 checkMAC->setChecked(FALSE); 
    967                 groupMAC->setEnabled(TRUE); 
    968         }  
    969          
    970         // Look for the WEP Encryption 
    971         if ( tmp.find("wepkey") != -1 ) { 
    972                 tmp2 = tmp; 
    973                 tmp2 = tmp2.remove(0, tmp.find("wepkey") + 7 ); 
    974                 tmp2.simplifyWhiteSpace(); 
    975                 if ( tmp2.find(" ") != -1 ) { 
    976                     tmp2 = tmp2.section( " " , 1, 1 ); 
    977                 } 
    978                 tmp2.remove(0, 2); 
    979                 WEPKey = tmp2; 
    980                 radioSecurityWEP->setChecked(TRUE);      
    981         } 
    982          
    983         // Look for the WEP  transmit key 
    984         if ( tmp.find("weptxkey") != -1 ) { 
    985                 tmp2 = tmp; 
    986                 tmp2 = tmp2.remove(0, tmp.find("weptxkey") + 9 ); 
    987                 tmp2.simplifyWhiteSpace(); 
    988                 if ( tmp2.find(" ") != -1 ) { 
    989                     tmp2 = tmp2.section( " " , 1, 1 ); 
    990                 } 
    991                  
    992                 ok = tmp2.toInt(&ok); 
    993                 if ( ok ) { 
    994                     WEPIndex = tmp2.toInt(&ok); 
    995                 } 
    996                 radioSecurityWEP->setChecked(TRUE);      
    997         } 
    998    } 
    999  
    1000  
    1001    // Load the security information here 
    1002     
    1003      // Start check for wpa_supplicant tag 
    1004       if ( tmp.find("WPA") != -1 ) 
    1005       { 
    1006             // Look for the wpa_supplicant.conf file 
    1007             QFile file( "/etc/wpa_supplicant.conf" ); 
    1008             if ( file.open( IO_ReadOnly ) ) { 
    1009                 QTextStream stream( &file ); 
    1010                 QString line; 
    1011                 while ( !stream.atEnd() ) { 
    1012                 line = stream.readLine(); // line of text excluding '\n' 
    1013  
    1014                    if ( line.find(" ssid=") != -1 ) 
    1015                    { 
    1016                         tmp2 = line.remove(0, line.find("\"") +1 ); 
    1017                         tmp2.truncate(tmp2.find("\"") ); 
    1018                         lineSSID->setText(tmp2); 
    1019                    } 
    1020          
    1021                    // Check if we are using a WEP key for this network 
    1022                    if ( line.find("wep_key") != -1 ) 
    1023                    {                    
    1024                         tmp2 = line.remove(0, line.find("=") +1 ); 
    1025                         // Save the keycode 
    1026                         WEPKey = tmp2; 
    1027                         radioSecurityWEP->setChecked(TRUE);      
    1028                    } 
    1029  
    1030                    // Check for the WEP tx key id 
    1031                    if ( line.find("wep_tx_keyidx") != -1 ) 
    1032                    {                    
    1033                         tmp2 = line.remove(0, line.find("wep_tx_keyidx") +1 ); 
    1034                         // Save the keycode 
    1035                         tmp2.truncate(tmp2.find("=") ); 
    1036                         ok = tmp2.toInt(&ok); 
    1037                         if ( ok ) { 
    1038                             WEPIndex = tmp2.toInt(&ok); 
    1039                             WEPIndex++; 
    1040                         } 
    1041                         radioSecurityWEP->setChecked(TRUE);      
    1042                    } 
     840           } 
    1043841                   
    1044                     // Check if we are using WPA-Personal 
    1045                     if ( line.find("psk=") != -1 ) 
    1046                    {                    
    1047                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1048                         tmp2.truncate( tmp2.find("\"") ); 
     842           // Check if we are using WPA-Personal 
     843           if ( line.find("psk=") != -1 ) 
     844           {                    
     845                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     846                tmp2.truncate( tmp2.find("\"") ); 
    1049847                          
    1050848                         
    1051                         // Save the keycode 
    1052                         WPAPersonalKey = tmp2; 
    1053                         radioSecurityWPAPersonal->setChecked(TRUE);      
    1054                    } 
     849                // Save the keycode 
     850                WPAPersonalKey[curItem] = tmp2; 
     851                SSIDEncType[curItem]=WPA_ENCRYPTION; 
     852           } 
    1055853                     
    1056                      // Check if we are using WPA-Enterprise 
    1057                     if ( line.find("eap=") != -1 ) 
    1058                    {                    
    1059                         tmp2 = line.remove(0, line.find("=") + 1 ); 
    1060  
    1061                         //Check to see whic type of WPA-Ent we are using 
    1062                         if ( tmp2 == "TLS") { 
    1063                             WPAEType = 1; 
    1064                         } else if (tmp2 == "TTLS" ) { 
    1065                             WPAEType = 2; 
    1066                         } else if (tmp2 == "PEAP" ) { 
    1067                             WPAEType = 3; 
    1068                         } 
     854           // Check if we are using WPA-Enterprise 
     855           if ( line.find("eap=") != -1 ) 
     856           {                    
     857                tmp2 = line.remove(0, line.find("=") + 1 ); 
     858 
     859                //Check to see whic type of WPA-Ent we are using 
     860                if ( tmp2 == "TLS") { 
     861                    WPAEType[curItem] = 1; 
     862                } else if (tmp2 == "TTLS" ) { 
     863                    WPAEType[curItem] = 2; 
     864                } else if (tmp2 == "PEAP" ) { 
     865                    WPAEType[curItem] = 3; 
     866                } 
    1069867                         
    1070                         radioSecurityWPAEnt->setChecked(TRUE);   
    1071                    } 
     868                SSIDEncType[curItem]=WPAE_ENCRYPTION; 
     869           } 
    1072870                     
    1073                      // Check for a identity= line 
    1074                     if ( line.find("identity=") != -1 ) 
    1075                    {                    
    1076                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1077                         tmp2.truncate( tmp2.find("\"") ); 
    1078  
    1079                         // Save the keycode 
    1080                         WPAEIdent = tmp2; 
    1081                    } 
     871           // Check for a identity= line 
     872           if ( line.find("identity=") != -1 ) 
     873           {                    
     874                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     875                tmp2.truncate( tmp2.find("\"") ); 
     876 
     877                // Save the keycode 
     878                WPAEIdent[curItem] = tmp2; 
     879           } 
    1082880                     
    1083                      // Check for a ca_cert= line 
    1084                     if ( line.find("ca_cert=") != -1 ) 
    1085                    {                    
    1086                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1087                         tmp2.truncate( tmp2.find("\"") ); 
    1088  
    1089                         // Save the keycode 
    1090                         WPAECACert = tmp2; 
    1091                    } 
    1092          
    1093                      // Check for a client_cert= line 
    1094                     if ( line.find("client_cert=") != -1 ) 
    1095                    {                    
    1096                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1097                         tmp2.truncate( tmp2.find("\"") ); 
    1098  
    1099                         // Save the keycode 
    1100                         WPAEClientCert = tmp2; 
    1101                    } 
     881           // Check for a ca_cert= line 
     882           if ( line.find("ca_cert=") != -1 ) 
     883           {                    
     884                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     885                tmp2.truncate( tmp2.find("\"") ); 
     886 
     887                // Save the keycode 
     888                WPAECACert[curItem] = tmp2; 
     889           } 
     890         
     891           // Check for a client_cert= line 
     892           if ( line.find("client_cert=") != -1 ) 
     893           {                    
     894                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     895                tmp2.truncate( tmp2.find("\"") ); 
     896 
     897                // Save the keycode 
     898                WPAEClientCert[curItem] = tmp2; 
     899           } 
    1102900                     
    1103                      // Check for a private_key= line 
    1104                     if ( line.find("private_key=") != -1 ) 
    1105                    {                    
    1106                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1107                         tmp2.truncate( tmp2.find("\"") ); 
    1108  
    1109                         // Save the keycode 
    1110                         WPAEPrivKeyFile = tmp2; 
    1111                    } 
    1112                      
    1113                     // Check for a private_key_passwd= line 
    1114                     if ( line.find("private_key_passwd=") != -1 ) 
    1115                    {                    
    1116                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1117                         tmp2.truncate( tmp2.find("\"") ); 
    1118  
    1119                         // Save the keycode 
    1120                         WPAEPassword = tmp2; 
    1121                    } 
    1122                  
    1123                      // Check for a private_key_passwd= line 
    1124                     if ( line.find("password=") != -1 ) 
    1125                    {                    
    1126                         tmp2 = line.remove(0, line.find("\"") + 1 ); 
    1127                         tmp2.truncate( tmp2.find("\"") ); 
    1128  
    1129                         // Save the keycode 
    1130                         WPAEPassword = tmp2; 
    1131                    } 
    1132  
    1133                 } 
    1134  
    1135         } 
     901          // Check for a private_key= line 
     902           if ( line.find("private_key=") != -1 ) 
     903           {                    
     904                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     905                tmp2.truncate( tmp2.find("\"") ); 
     906 
     907                // Save the keycode 
     908                WPAEPrivKeyFile[curItem] = tmp2; 
     909           } 
     910             
     911          // Check for a private_key_passwd= line 
     912          if ( line.find("private_key_passwd=") != -1 ) 
     913          {                     
     914                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     915                tmp2.truncate( tmp2.find("\"") ); 
     916 
     917                // Save the keycode 
     918                WPAEPassword[curItem] = tmp2; 
     919          } 
     920         
     921         // Check for a private_key_passwd= line 
     922         if ( line.find("password=") != -1 ) 
     923         {                      
     924                tmp2 = line.remove(0, line.find("\"") + 1 ); 
     925                tmp2.truncate( tmp2.find("\"") ); 
     926 
     927                // Save the keycode 
     928                WPAEPassword[curItem] = tmp2; 
     929         } 
     930 
    1136931      } 
    1137932 
    1138   } 
    1139     
    1140    slotCheckSecurityRadio(); 
    1141     
     933   } 
     934 
     935 
     936   // Refresh the ssid profile list 
     937   slotRefreshSSIDList();   
    1142938    
    1143939   // Start loading the info tab 
     
    1145941 
    1146942   pushApply->setEnabled(FALSE); 
     943   } 
     944} 
     945 
     946 
     947// Slot which reads the arrays and displays the list of WIFI profiles 
     948void wificonfigwidgetbase::slotRefreshSSIDList() 
     949{ 
     950 
     951  listWifi->clear(); 
     952 
     953  int curItem=0; 
     954 
     955  while( ! SSIDList[curItem].isEmpty() ) 
     956  { 
     957     if ( SSIDEncType[curItem] == NO_ENCRYPTION ) 
     958     { 
     959       listWifi->addItem(new QListWidgetItem(QIcon(":object-unlocked.png"), SSIDList[curItem] ) ); 
     960     } else { 
     961 
     962       listWifi->addItem(new QListWidgetItem(QIcon(":object-locked.png"), SSIDList[curItem] ) ); 
     963     } 
     964 
     965     curItem++; 
     966 
     967     // We only need 150 wireless networks 
     968     if ( curItem > 149 ) 
     969     { 
     970        break; 
     971     } 
     972  } 
     973 
    1147974} 
    1148975 
     
    12031030} 
    12041031 
    1205  
    1206  
    1207  
    1208 void wificonfigwidgetbase::slotBSSIDChecked() 
    1209 { 
    1210    if ( checkBSSID->isChecked() ) 
    1211    { 
    1212        groupBSSID->setEnabled(TRUE); 
    1213        lineBSSID->setEnabled(TRUE); 
    1214    } else {  
    1215        groupBSSID->setEnabled(FALSE); 
    1216        lineBSSID->setEnabled(FALSE); 
    1217    } 
    1218    pushApply->setEnabled(TRUE); 
    1219 } 
  • pcbsd/branches/7.0/wificonfig/wificonfigwidgetbase.h

    r2446 r2904  
    1414#include "ui_wificonfigwidgetbase.h" 
    1515#include <Q3Process> 
     16 
     17 
     18// Setup our encryption type defines 
     19#define NO_ENCRYPTION 0 
     20#define WEP_ENCRYPTION 1 
     21#define WPA_ENCRYPTION 2 
     22#define WPAE_ENCRYPTION 3 
    1623 
    1724class wificonfigwidgetbase : public QWidget, private Ui::wificonfigwidgetbase 
     
    3441    void slotApply(); 
    3542    void slotCheckDHCPBox(); 
    36     void slotConfig(); 
    37     void slotSSIDChanged( QString newSSID ); 
    38     void slotConfigWEP(); 
    39     void slotWEPChanged( QString newKey, int newIndex, bool hexkey ); 
    40     void slotCheckSecurityRadio(); 
    41     void slotCheckWhichSecurity(); 
    42     void slotConfigWPAP(); 
    43     void slotConfigWPAE(); 
    44     void slotWPAPChanged( QString newKey ); 
    45     void slotWPAEChanged( int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass ); 
     43    void slotAddNewProfile(); 
     44    void slotRemoveProfile(); 
     45    void slotAddNewProfileOpen( QString SSID, bool isBSSID ); 
     46    void slotAddNewProfileWEP( QString SSID, bool isBSSID, QString newKey, int newIndex, bool hexkey ); 
     47    void slotAddNewProfileWPA( QString SSID, bool isBSSID, QString newKey ); 
     48    void slotAddNewProfileWPAE( QString SSID, bool isBSSID, int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass ); 
    4649    void slotCheckDisabled(); 
    4750    void slotOK(); 
     
    5053    void slotFinishLoading(); 
    5154    void slotCheckGlobalText(); 
    52     void slotBSSIDChecked(); 
     55    void slotRefreshSSIDList(); 
    5356 
    5457 
     
    7376    QString DeviceName; 
    7477    wifiselectiondialog *wifiselect; 
    75     wepConfig *dialogWEP; 
    76     QString WEPKey; 
    77     int WEPIndex; 
    78     bool WEPHex; 
    79     dialogWPAPersonal *dialogWPAP; 
    80     QString WPAPersonalKey; 
    81     dialogWPAEnterprise *dialogWPAE; 
    82     int WPAEType; 
    83     QString WPAEIdent; 
    84     QString WPAECACert; 
    85     QString WPAEClientCert; 
    86     QString WPAEPrivKeyFile; 
    87     QString WPAEPassword; 
    8878    Q3Process *netifProc; 
    8979 
    90  
     80    // Lets define our arrays for the SSID profiles 
     81    QString SSIDList[150]; 
     82    int SSIDEncType[150]; 
     83    bool BSSID[150]; 
     84    QString WEPKey[150]; 
     85    int WEPIndex[150]; 
     86    bool WEPHex[150]; 
     87    QString WPAPersonalKey[150]; 
     88    QString WPAEIdent[150]; 
     89    QString WPAECACert[150]; 
     90    QString WPAEClientCert[150]; 
     91    QString WPAEPrivKeyFile[150]; 
     92    QString WPAEPassword[150]; 
     93    int WPAEType[150]; 
    9194 
    9295signals: 
  • pcbsd/branches/7.0/wificonfig/wificonfigwidgetbase.ui

    r2166 r2904  
    77    <y>0</y> 
    88    <width>348</width> 
    9     <height>463</height> 
     9    <height>450</height> 
    1010   </rect> 
    1111  </property> 
     
    1818  </property> 
    1919  <layout class="QGridLayout" > 
     20   <item row="2" column="3" > 
     21    <widget class="QPushButton" name="buttonCancel" > 
     22     <property name="text" > 
     23      <string>Close</string> 
     24     </property> 
     25     <property name="shortcut" > 
     26      <string/> 
     27     </property> 
     28    </widget> 
     29   </item> 
     30   <item row="1" column="0" colspan="4" > 
     31    <widget class="QCheckBox" name="checkDisableWireless" > 
     32     <property name="text" > 
     33      <string>Disable this wireless device</string> 
     34     </property> 
     35    </widget> 
     36   </item> 
     37   <item row="2" column="2" > 
     38    <widget class="QPushButton" name="pushApply" > 
     39     <property name="text" > 
     40      <string>&amp;Apply</string> 
     41     </property> 
     42     <property name="shortcut" > 
     43      <string>Alt+A</string> 
     44     </property> 
     45    </widget> 
     46   </item> 
     47   <item row="2" column="0" > 
     48    <spacer name="spacer1" > 
     49     <property name="orientation" > 
     50      <enum>Qt::Horizontal</enum> 
     51     </property> 
     52     <property name="sizeType" > 
     53      <enum>QSizePolicy::Expanding</enum> 
     54     </property> 
     55     <property name="sizeHint" stdset="0" > 
     56      <size> 
     57       <width>100</width> 
     58       <height>21</height> 
     59      </size> 
     60     </property> 
     61    </spacer> 
     62   </item> 
     63   <item row="2" column="1" > 
     64    <widget class="QPushButton" name="pushOK" > 
     65     <property name="text" > 
     66      <string>&amp;OK</string> 
     67     </property> 
     68     <property name="shortcut" > 
     69      <string>Alt+O</string> 
     70     </property> 
     71    </widget> 
     72   </item> 
    2073   <item row="0" column="0" colspan="4" > 
    2174    <widget class="QTabWidget" name="tabMainWidget" > 
     
    2477     </property> 
    2578     <widget class="QWidget" name="tab" > 
    26       <property name="geometry" > 
    27        <rect> 
    28         <x>0</x> 
    29         <y>0</y> 
    30         <width>328</width> 
    31         <height>356</height> 
    32        </rect> 
    33       </property> 
    3479      <attribute name="title" > 
    3580       <string>&amp;General</string> 
    3681      </attribute> 
    37       <layout class="QGridLayout" > 
    38        <item row="5" column="0" colspan="2" > 
     82      <layout class="QGridLayout" name="gridLayout_4" > 
     83       <item row="1" column="0" > 
     84        <layout class="QGridLayout" name="gridLayout_3" > 
     85         <item row="0" column="0" > 
     86          <widget class="QListWidget" name="listWifi" /> 
     87         </item> 
     88        </layout> 
     89       </item> 
     90       <item row="2" column="0" > 
     91        <layout class="QHBoxLayout" name="horizontalLayout" > 
     92         <item> 
     93          <widget class="QPushButton" name="pushAddWifi" > 
     94           <property name="text" > 
     95            <string>Add</string> 
     96           </property> 
     97           <property name="icon" > 
     98            <iconset resource="wificonfig.qrc" > 
     99             <normaloff>:/list-add.png</normaloff>:/list-add.png</iconset> 
     100           </property> 
     101           <property name="shortcut" > 
     102            <string>Alt+S</string> 
     103           </property> 
     104          </widget> 
     105         </item> 
     106         <item> 
     107          <widget class="QPushButton" name="pushRemoveWifi" > 
     108           <property name="text" > 
     109            <string>Remove</string> 
     110           </property> 
     111           <property name="icon" > 
     112            <iconset resource="wificonfig.qrc" > 
     113             <normaloff>:/edit-delete.png</normaloff>:/edit-delete.png</iconset> 
     114           </property> 
     115          </widget> 
     116         </item> 
     117         <item> 
     118          <spacer name="horizontalSpacer" > 
     119           <property name="orientation" > 
     120            <enum>Qt::Horizontal</enum> 
     121           </property> 
     122           <property name="sizeHint" stdset="0" > 
     123            <size> 
     124             <width>40</width> 
     125             <height>20</height> 
     126            </size> 
     127           </property> 
     128          </spacer> 
     129         </item> 
     130        </layout> 
     131       </item> 
     132       <item row="4" column="0" > 
    39133        <widget class="QCheckBox" name="checkDHCP" > 
    40134         <property name="text" > 
     
    46140        </widget> 
    47141       </item> 
    48        <item row="4" column="0" colspan="2" > 
    49         <widget class="QLabel" name="textLabel1" > 
    50          <property name="frameShape" > 
    51           <enum>QFrame::NoFrame</enum> 
    52          </property> 
    53          <property name="frameShadow" > 
    54           <enum>QFrame::Plain</enum> 
    55          </property> 
    56          <property name="text" > 
    57           <string>Network address configuration</string> 
    58          </property> 
    59          <property name="wordWrap" > 
    60           <bool>false</bool> 
    61          </property> 
    62         </widget> 
    63        </item> 
    64        <item row="3" column="0" colspan="2" > 
     142       <item row="3" column="0" > 
    65143        <widget class="Line" name="line1" > 
    66144         <property name="frameShape" > 
     
    72150        </widget> 
    73151       </item> 
    74        <item row="2" column="0" colspan="2" > 
    75         <spacer name="spacer2" > 
    76          <property name="orientation" > 
    77           <enum>Qt::Vertical</enum> 
    78          </property> 
    79          <property name="sizeType" > 
    80           <enum>QSizePolicy::Fixed</enum> 
    81          </property> 
    82          <property name="sizeHint" stdset="0" > 
    83           <size> 
    84            <width>270</width> 
    85            <height>20</height> 
    86           </size> 
    87          </property> 
    88         </spacer> 
    89        </item> 
    90        <item row="1" column="1" > 
    91         <widget class="QPushButton" name="pushChangeWifi" > 
    92          <property name="text" > 
    93           <string>&amp;Scan</string> 
    94          </property> 
    95          <property name="shortcut" > 
    96           <string>Alt+S</string> 
    97          </property> 
    98         </widget> 
    99        </item> 
    100        <item row="0" column="0" colspan="2" > 
     152       <item row="0" column="0" > 
    101153        <widget class="QLabel" name="textLabel2" > 
    102154         <property name="text" > 
    103           <string>Currently selected wireless network:</string> 
     155          <string>Wireless network profiles</string> 
    104156         </property> 
    105157         <property name="wordWrap" > 
     
    108160        </widget> 
    109161       </item> 
    110        <item row="1" column="0" > 
    111         <widget class="QLineEdit" name="lineSSID" > 
    112          <property name="readOnly" > 
    113           <bool>false</bool> 
    114          </property> 
    115         </widget> 
    116        </item> 
    117        <item row="6" column="0" colspan="2" > 
     162       <item row="5" column="0" > 
    118163        <widget class="Q3GroupBox" name="groupBoxIP" > 
    119164         <property name="title" > 
     
    170215        </widget> 
    171216       </item> 
    172        <item row="7" column="0" colspan="2" > 
    173         <spacer name="spacer3_2" > 
    174          <property name="orientation" > 
    175           <enum>Qt::Vertical</enum> 
    176          </property> 
    177          <property name="sizeType" > 
    178           <enum>QSizePolicy::Preferred</enum> 
    179          </property> 
    180          <property name="sizeHint" stdset="0" > 
    181           <size> 
    182            <width>290</width> 
    183            <height>16</height> 
    184           </size> 
    185          </property> 
    186         </spacer> 
    187        </item> 
    188       </layout> 
    189      </widget> 
    190      <widget class="QWidget" name="tab" > 
    191       <property name="geometry" > 
    192        <rect> 
    193         <x>0</x> 
    194         <y>0</y> 
    195         <width>328</width> 
    196         <height>356</height> 
    197        </rect> 
    198       </property> 
    199       <attribute name="title" > 
    200        <string>Securit&amp;y</string> 
    201       </attribute> 
    202       <layout class="QGridLayout" > 
    203        <item row="3" column="0" > 
    204         <spacer name="spacer4" > 
    205          <property name="orientation" > 
    206           <enum>Qt::Vertical</enum> 
    207          </property> 
    208          <property name="sizeType" > 
    209           <enum>QSizePolicy::Expanding</enum> 
    210          </property> 
    211          <property name="sizeHint" stdset="0" > 
    212           <size> 
    213            <width>270</width> 
    214            <height>20</height> 
    215           </size> 
    216          </property> 
    217         </spacer> 
    218        </item> 
    219        <item row="0" column="0" > 
    220         <widget class="QLabel" name="textLabel4" > 
    221          <property name="text" > 
    222           <string>Wireless security setup</string> 
    223          </property> 
    224          <property name="wordWrap" > 
    225           <bool>false</bool> 
    226          </property> 
    227         </widget> 
    228        </item> 
    229        <item row="1" column="0" > 
    230         <spacer name="spacer4_2" > 
    231          <property name="orientation" > 
    232           <enum>Qt::Vertical</enum> 
    233          </property> 
    234          <property name="sizeType" > 
    235           <enum>QSizePolicy::Fixed</enum> 
    236          </property> 
    237          <property name="sizeHint" stdset="0" > 
    238           <size> 
    239            <width>270</width> 
    240            <height>16</height> 
    241           </size> 
    242          </property> 
    243         </spacer> 
    244        </item> 
    245        <item row="2" column="0" > 
    246         <widget class="Q3ButtonGroup" name="buttonGroupSecurity" > 
    247          <property name="title" > 
    248           <string>Security Mode</string> 
    249          </property> 
    250          <layout class="QGridLayout" > 
    251           <item row="4" column="0" > 
    252            <spacer name="spacer6" > 
    253             <property name="orientation" > 
    254              <enum>Qt::Horizontal</enum> 
    255             </property> 
    256             <property name="sizeType" > 
    257              <enum>QSizePolicy::Expanding</enum> 
    258             </property> 
    259             <property name="sizeHint" stdset="0" > 
    260              <size> 
    261               <width>130</width> 
    262               <height>20</height> 
    263              </size> 
    264             </property> 
    265            </spacer> 
    266           </item> 
    267           <item row="3" column="0" colspan="2" > 
    268            <widget class="QRadioButton" name="radioSecurityWPAEnt" > 
    269             <property name="text" > 
    270              <string>WPA Enterprise</string> 
    271             </property> 
    272             <property name="shortcut" > 
    273              <string/> 
    274             </property> 
    275            </widget> 
    276           </item> 
    277           <item row="1" column="0" colspan="2" > 
    278            <widget class="QRadioButton" name="radioSecurityWEP" > 
    279             <property name="text" > 
    280              <string>WEP</string> 
    281             </property> 
    282            </widget> 
    283           </item> 
    284           <item row="2" column="0" colspan="2" > 
    285            <widget class="QRadioButton" name="radioSecurityWPAPersonal" > 
    286             <property name="text" > 
    287              <string>WPA Personal</string> 
    288             </property> 
    289             <property name="shortcut" > 
    290              <string/> 
    291             </property> 
    292            </widget> 
    293           </item> 
    294           <item row="4" column="1" > 
    295            <widget class="QPushButton" name="pushSecurity" > 
    296             <property name="text" > 
    297              <string>Configure</string> 
    298             </property> 
    299             <property name="shortcut" > 
    300              <string/> 
    301             </property> 
    302            </widget> 
    303           </item> 
    304           <item row="0" column="0" colspan="2" > 
    305            <widget class="QRadioButton" name="radioSecurityDisabled" > 
    306             <property name="text" > 
    307              <string>Disa&amp;bled</string> 
    308             </property> 
    309             <property name="shortcut" > 
    310              <string>Alt+B</string> 
    311             </property> 
    312             <property name="checked" > 
    313              <bool>true</bool> 
    314             </property> 
    315            </widget> 
    316           </item> 
    317          </layout> 
    318         </widget> 
    319        </item> 
    320217      </layout> 
    321218     </widget> 
    322219     <widget class="QWidget" name="TabPage" > 
    323       <property name="geometry" > 
    324        <rect> 
    325         <x>0</x> 
    326         <y>0</y> 
    327         <width>328</width> 
    328         <height>356</height> 
    329        </rect> 
    330       </property> 
    331220      <attribute name="title" > 
    332221       <string>Advanced</string> 
    333222      </attribute> 
    334       <layout class="QGridLayout" > 
     223      <layout class="QGridLayout" name="gridLayout" > 
    335224       <item row="0" column="0" > 
    336225        <widget class="QCheckBox" name="checkMAC" > 
     
    362251       </item> 
    363252       <item row="2" column="0" > 
    364         <widget class="QCheckBox" name="checkBSSID" > 
    365          <property name="text" > 
    366           <string>Specify custom BSSID</string> 
    367          </property> 
    368          <property name="shortcut" > 
    369           <string/> 
    370          </property> 
    371          <property name="checked" > 
    372           <bool>false</bool> 
    373          </property> 
    374         </widget> 
    375        </item> 
    376        <item row="3" column="0" > 
    377         <widget class="Q3GroupBox" name="groupBSSID" > 
    378          <property name="enabled" > 
    379           <bool>false</bool> 
    380          </property> 
    381          <property name="title" > 
    382           <string>Custom wireless BSSID</string> 
    383          </property> 
    384          <layout class="QGridLayout" > 
    385           <item row="0" column="0" > 
    386            <widget class="QLineEdit" name="lineBSSID" /> 
    387           </item> 
    388          </layout> 
    389         </widget> 
    390        </item> 
    391        <item row="4" column="0" > 
    392253        <spacer name="spacer7" > 
    393254         <property name="orientation" > 
     
    408269     </widget> 
    409270     <widget class="QWidget" name="TabPage" > 
    410       <property name="geometry" > 
    411        <rect> 
    412         <x>0</x> 
    413         <y>0</y> 
    414         <width>328</width> 
    415         <height>356</height> 
    416        </rect> 
    417       </property> 
    418271      <attribute name="title" > 
    419272       <string>Info</string> 
     
    795648      </layout> 
    796649     </widget> 
    797     </widget> 
    798    </item> 
    799    <item row="2" column="3" > 
    800     <widget class="QPushButton" name="buttonCancel" > 
    801      <property name="text" > 
    802       <string>Close</string> 
    803      </property> 
    804      <property name="shortcut" > 
    805       <string/> 
    806      </property> 
    807     </widget> 
    808    </item> 
    809    <item row="1" column="0" colspan="4" > 
    810     <widget class="QCheckBox" name="checkDisableWireless" > 
    811      <property name="text" > 
    812       <string>Disable this wireless device</string> 
    813      </property> 
    814     </widget> 
    815    </item> 
    816    <item row="2" column="2" > 
    817     <widget class="QPushButton" name="pushApply" > 
    818      <property name="text" > 
    819       <string>&amp;Apply</string> 
    820      </property> 
    821      <property name="shortcut" > 
    822       <string>Alt+A</string> 
    823      </property> 
    824     </widget> 
    825    </item> 
    826    <item row="2" column="0" > 
    827     <spacer name="spacer1" > 
    828      <property name="orientation" > 
    829       <enum>Qt::Horizontal</enum> 
    830      </property> 
    831      <property name="sizeType" > 
    832       <enum>QSizePolicy::Expanding</enum> 
    833      </property> 
    834      <property name="sizeHint" stdset="0" > 
    835       <size> 
    836        <width>100</width> 
    837        <height>21</height> 
    838       </size> 
    839      </property> 
    840     </spacer> 
    841    </item> 
    842    <item row="2" column="1" > 
    843     <widget class="QPushButton" name="pushOK" > 
    844      <property name="text" > 
    845       <string>&amp;OK</string> 
    846      </property> 
    847      <property name="shortcut" > 
    848       <string>Alt+O</string> 
    849      </property> 
    850650    </widget> 
    851651   </item> 
     
    860660   <container>1</container> 
    861661  </customwidget> 
    862   <customwidget> 
    863    <class>Q3ButtonGroup</class> 
    864    <extends>Q3GroupBox</extends> 
    865    <header>Qt3Support/Q3ButtonGroup</header> 
    866    <container>1</container> 
    867   </customwidget> 
    868662 </customwidgets> 
    869663 <tabstops> 
    870664  <tabstop>tabMainWidget</tabstop> 
    871   <tabstop>lineSSID</tabstop> 
    872   <tabstop>pushChangeWifi</tabstop> 
     665  <tabstop>pushAddWifi</tabstop> 
    873666  <tabstop>checkDHCP</tabstop> 
    874667  <tabstop>lineIP</tabstop> 
     
    877670  <tabstop>pushApply</tabstop> 
    878671  <tabstop>buttonCancel</tabstop> 
    879   <tabstop>radioSecurityDisabled</tabstop> 
    880   <tabstop>pushSecurity</tabstop> 
    881672  <tabstop>checkDisableWireless</tabstop> 
    882673  <tabstop>checkMAC</tabstop> 
     
    918709  </connection> 
    919710  <connection> 
    920    <sender>checkDHCP</sender> 
    921    <signal>clicked()</signal> 
    922    <receiver>wificonfigwidgetbase</receiver> 
    923    <slot>slotCheckDHCPBox()</slot> 
    924    <hints> 
    925     <hint type="sourcelabel" > 
    926      <x>20</x> 
    927      <y>20</y> 
    928     </hint> 
    929     <hint type="destinationlabel" > 
    930      <x>20</x> 
    931      <y>20</y> 
    932     </hint> 
    933    </hints> 
    934   </connection> 
    935   <connection> 
    936711   <sender>pushApply</sender> 
    937712   <signal>clicked()</signal> 
    938713   <receiver>wificonfigwidgetbase</receiver> 
    939714   <slot>slotApply()</slot> 
    940    <hints> 
    941     <hint type="sourcelabel" > 
    942      <x>20</x> 
    943      <y>20</y> 
    944     </hint> 
    945     <hint type="destinationlabel" > 
    946      <x>20</x> 
    947      <y>20</y> 
    948     </hint> 
    949    </hints> 
    950   </connection> 
    951   <connection> 
    952    <sender>pushChangeWifi</sender> 
    953    <signal>clicked()</signal> 
    954    <receiver>wificonfigwidgetbase</receiver> 
    955    <slot>slotConfig()</slot> 
    956    <hints> 
    957     <hint type="sourcelabel" > 
    958      <x>20</x> 
    959      <y>20</y> 
    960     </hint> 
    961     <hint type="destinationlabel" > 
    962      <x>20</x> 
    963      <y>20</y> 
    964     </hint> 
    965    </hints> 
    966   </connection> 
    967   <connection> 
    968    <sender>pushSecurity</sender> 
    969    <signal>clicked()</signal> 
    970    <receiver>wificonfigwidgetbase</receiver> 
    971    <slot>slotCheckWhichSecurity()</slot> 
    972    <hints> 
    973     <hint type="sourcelabel" > 
    974      <x>20</x> 
    975      <y>20</y> 
    976     </hint> 
    977     <hint type="destinationlabel" > 
    978      <x>20</x> 
    979      <y>20</y> 
    980     </hint> 
    981    </hints> 
    982   </connection> 
    983   <connection> 
    984    <sender>radioSecurityDisabled</sender> 
    985    <signal>clicked()</signal> 
    986    <receiver>wificonfigwidgetbase</receiver> 
    987    <slot>slotCheckSecurityRadio()</slot> 
    988    <hints> 
    989     <hint type="sourcelabel" > 
    990      <x>20</x> 
    991      <y>20</y> 
    992     </hint> 
    993     <hint type="destinationlabel" > 
    994      <x>20</x> 
    995      <y>20</y> 
    996     </hint> 
    997    </hints> 
    998   </connection> 
    999   <connection> 
    1000    <sender>radioSecurityWEP</sender> 
    1001    <signal>clicked()</signal> 
    1002    <receiver>wificonfigwidgetbase</receiver> 
    1003    <slot>slotCheckSecurityRadio()</slot> 
    1004    <hints> 
    1005     <hint type="sourcelabel" > 
    1006      <x>20</x> 
    1007      <y>20</y> 
    1008     </hint> 
    1009     <hint type="destinationlabel" > 
    1010      <x>20</x> 
    1011      <y>20</y> 
    1012     </hint> 
    1013    </hints> 
    1014   </connection> 
    1015   <connection> 
    1016    <sender>radioSecurityWPAEnt</sender> 
    1017    <signal>clicked()</signal> 
    1018    <receiver>wificonfigwidgetbase</receiver> 
    1019    <slot>slotCheckSecurityRadio()</slot> 
    1020    <hints> 
    1021     <hint type="sourcelabel" > 
    1022      <x>20</x> 
    1023      <y>20</y> 
    1024     </hint> 
    1025     <hint type="destinationlabel" > 
    1026      <x>20</x> 
    1027      <y>20</y> 
    1028     </hint> 
    1029    </hints> 
    1030   </connection> 
    1031   <connection> 
    1032    <sender>radioSecurityWPAPersonal</sender> 
    1033    <signal>clicked()</signal> 
    1034    <receiver>wificonfigwidgetbase</receiver> 
    1035    <slot>slotCheckSecurityRadio()</slot> 
    1036715   <hints> 
    1037716    <hint type="sourcelabel" > 
     
    1078757  </connection> 
    1079758  <connection> 
     759   <sender>checkDHCP</sender> 
     760   <signal>clicked()</signal> 
     761   <receiver>wificonfigwidgetbase</receiver> 
     762   <slot>slotCheckDHCPBox()</slot> 
     763   <hints> 
     764    <hint type="sourcelabel" > 
     765     <x>20</x> 
     766     <y>20</y> 
     767    </hint> 
     768    <hint type="destinationlabel" > 
     769     <x>20</x> 
     770     <y>20</y> 
     771    </hint> 
     772   </hints> 
     773  </connection> 
     774  <connection> 
    1080775   <sender>checkMAC</sender> 
    1081776   <signal>clicked()</signal> 
     
    1141836   </hints> 
    1142837  </connection> 
    1143   <connection> 
    1144    <sender>lineSSID</sender> 
    1145    <signal>textChanged(QString)</signal> 
    1146    <receiver>wificonfigwidgetbase</receiver> 
    1147    <slot>slotCheckGlobalText()</slot> 
    1148    <hints> 
    1149     <hint type="sourcelabel" > 
    1150      <x>20</x> 
    1151      <y>20</y> 
    1152     </hint> 
    1153     <hint type="destinationlabel" > 
    1154      <x>20</x> 
    1155      <y>20</y> 
    1156     </hint> 
    1157    </hints> 
    1158   </connection> 
    1159   <connection> 
    1160    <sender>checkBSSID</sender> 
    1161    <signal>clicked()</signal> 
    1162    <receiver>wificonfigwidgetbase</receiver> 
    1163    <slot>slotBSSIDChecked()</slot> 
    1164    <hints> 
    1165     <hint type="sourcelabel" > 
    1166      <x>20</x> 
    1167      <y>20</y> 
    1168     </hint> 
    1169     <hint type="destinationlabel" > 
    1170      <x>20</x> 
    1171      <y>20</y> 
    1172     </hint> 
    1173    </hints> 
    1174   </connection> 
    1175   <connection> 
    1176    <sender>lineBSSID</sender> 
    1177    <signal>textChanged(QString)</signal> 
    1178    <receiver>wificonfigwidgetbase</receiver> 
    1179    <slot>slotCheckGlobalText()</slot> 
    1180    <hints> 
    1181     <hint type="sourcelabel" > 
    1182      <x>20</x> 
    1183      <y>20</y> 
    1184     </hint> 
    1185     <hint type="destinationlabel" > 
    1186      <x>20</x> 
    1187      <y>20</y> 
    1188     </hint> 
    1189    </hints> 
    1190   </connection> 
    1191838 </connections> 
    1192839</ui> 
  • pcbsd/branches/7.0/wificonfig/wifiselectiondialog.cpp

    r2895 r2904  
    1 /**************************************************************************** 
    2 ** ui.h extension file, included from the uic-generated form implementation. 
    3 ** 
    4 ** If you want to add, delete, or rename functions or slots, use 
    5 ** Qt Designer to update this file, preserving your code. 
    6 ** 
    7 ** You should not define a constructor or destructor in this file. 
    8 ** Instead, write your code in functions called init() and destroy(). 
    9 ** These will automatically be called by the form's constructor and 
    10 ** destructor. 
    11 *****************************************************************************/ 
    121#include "wifiselectiondialog.h" 
    132#include "ui_wifiselectiondialog.h" 
    143#include <qtextstream.h> 
    154 
    16  
    17  
    18  
    19 void wifiselectiondialog::init( QString Device, QString oldSSID ) 
    20 { 
    21     DeviceName = Device; 
    22     SSID = oldSSID; 
    23     pushConnect->setEnabled(FALSE); 
    24      
    25    QTimer::singleShot(500,  this,  SLOT(startScan())); 
    26     //scanWifi(); 
    27 } 
    28     
    29 void wifiselectiondialog::scanWifi() 
    30 { 
    31     QString tmp; 
    32     QString strength; 
    33     QString ssid; 
    34     int newStrength; 
    35     bool ok; 
    36     int foundItem = 0; 
    37     QString FileLoad; 
    38     QString line; 
    39      
    40     // Clear the list box 
    41     listWifi->clear(); 
    42     textTop->setText(tr("Scanning for wireless networks...") ); 
    43              
    44     // Take the interface down before starting the scan 
    45     //runCommand("ifconfig " + DeviceName + " down"); 
    46      
    47     // Start the scan and get the output 
    48     line = getLineFromCommandOutput("ifconfig -v " + DeviceName + " up list scan >/tmp/.wifilist 2>/tmp/.wifilist"); 
    49  
    50     // Now read the output file 
    51     QFile file( "/tmp/.wifilist" ); 
    52     if ( file.open( IO_ReadOnly ) ) { 
    53         QTextStream stream( &file ); 
    54         while ( !stream.atEnd() ) { 
    55                  line = stream.readLine(); // line of text excluding '\n' 
    56              // exclude the header line 
    57              if ( line.indexOf("BSSID") == -1) { 
    58                       
    59                  // Get the ssid of the network 
    60                  tmp = line; 
    61                  tmp = tmp.simplified(); 
    62                  tmp.remove(0, tmp.indexOf("SSID<") + 5); 
    63                  tmp.truncate(tmp.indexOf(">")); 
    64                  ssid = tmp; 
    65  
    66                  // Get the signal strength of this device 
    67                  tmp = line; 
    68                  tmp = tmp.simplified(); 
    69  
    70                  // First remove the SSID which may have spaces in it 
    71                  tmp.remove(0, tmp.find(":")); 
    72                    
    73                  // Now find the strength section 
    74                  tmp.truncate(tmp.findRev("SSID<")); 
    75                  tmp.truncate(tmp.findRev(":")); 
    76                  tmp.remove(0, tmp.findRev(" ")); 
    77                  strength = tmp; 
    78                                  
    79                  //QMessageBox::warning( this, "Testing", "SSID:" + ssid + " STR:" + strength ); 
    80                  // Add the device to the list box 
    81                  strength.toInt(&ok); 
    82                  if ( ok && !ssid.isEmpty() && ssid != " " ) { 
    83                      newStrength = tmp.toInt(&ok); 
    84                      if ( newStrength < 25 ) 
    85                      {   
    86                          FileLoad="/PCBSD/networkmanager/pics/tray_wifi.png"; 
    87                      } else if ( newStrength < 50 ) { 
    88                          FileLoad="/PCBSD/networkmanager/pics/tray_wifi30.png"; 
    89                      }  else if ( newStrength < 75 ) { 
    90                          FileLoad="/PCBSD/networkmanager/pics/tray_wifi60.png"; 
    91                      } else {; 
    92                          FileLoad="/PCBSD/networkmanager/pics/tray_wifi85.png"; 
    93                      } 
    94                   
    95                   
    96                        QImage *Icon = new QImage(FileLoad); 
    97                        QPixmap PixmapIcon; 
    98                              PixmapIcon.convertFromImage(Icon->scaled(22,22)); 
    99                        listWifi->insertItem(PixmapIcon, ssid + " (signal strength: " +strength + "%)" ); 
    100                         
    101                        foundItem = 1; 
    102                   
    103              } else { 
    104                   if ( ! ssid.isEmpty() && ssid != " " ) { 
    105                        // If we didn't get the signal strength, still display the SSID 
    106                        FileLoad="/PCBSD/networkmanager/pics/tray_wifi.png"; 
    107                        QImage *Icon = new QImage(FileLoad); 
    108                        QPixmap PixmapIcon; 
    109                              PixmapIcon.convertFromImage(Icon->scaled(22,22)); 
    110                        listWifi->insertItem(PixmapIcon, ssid + " (signal strength: unknown)" ); 
    111                         
    112                        foundItem = 1; 
    113                   } 
    114              } 
    115              
     5void wifiselectiondialog::init(QString device) 
     6{ 
     7   DeviceName = device; 
     8     
     9   connect( pushScan, SIGNAL( clicked() ), this, SLOT(slotOpenWifiScan()) ); 
     10   connect( pushConnect, SIGNAL( clicked() ), this, SLOT(slotConnect()) ); 
     11   connect( pushCancel, SIGNAL( clicked() ), this, SLOT(slotCancel()) ); 
     12   connect( pushSecurity, SIGNAL( clicked() ), this, SLOT(slotCheckWhichSecurity()) ); 
     13} 
     14 
     15 
     16void wifiselectiondialog::slotOpenWifiScan() 
     17{ 
     18   dialogWifiscanssid = new wifiscanssid(); 
     19   dialogWifiscanssid->init(DeviceName); 
     20   connect( dialogWifiscanssid, SIGNAL( saved(QString) ), this, SLOT( slotSSIDChanged(QString) ) ); 
     21   dialogWifiscanssid->exec(); 
     22} 
     23 
     24 
     25void wifiselectiondialog::slotSSIDChanged( QString newSSID ) 
     26{ 
     27       lineSSID->setText(newSSID); 
     28} 
     29 
     30    
     31void wifiselectiondialog::slotCancel() 
     32{ 
     33    close(); 
     34} 
     35 
     36void wifiselectiondialog::slotConnect() 
     37{ 
     38    QString selectedSSID; 
     39     
     40    // Make sure a device was selected 
     41    if (lineSSID->text().isEmpty()) 
     42    { 
     43        QMessageBox::warning( this, tr("No SSID!"), tr("Error: You must select a wireless network to connect!\n") ); 
     44        return; 
     45    } 
     46 
     47    if ( (checkBSSID->isChecked() && lineSSID->text().length() != 17) || (checkBSSID->isChecked() && lineSSID->text().count(":") != 5) ) 
     48    { 
     49        QMessageBox::warning( this, tr("Invalid BSSID!"), tr("Error: The specified BSSID appears invalid. It must be in the format xx:xx:xx:xx:xx:xx\n") ); 
     50        return; 
     51    } 
     52 
     53    // Check that we even have a WEP Key yet 
     54    if (radioSecurityWEP->isChecked() && WEPKey.isEmpty() ) { 
     55       QMessageBox::warning( this, tr("Warning"), tr("WEP is selected, but not configured!\nPlease configure your WEP key before saving!") ); 
     56       return; 
     57    } 
     58 
     59    // Check that we even have a WPA-Personal Key yet 
     60    if (radioSecurityWPAPersonal->isChecked() && WPAPersonalKey.isEmpty() ) { 
     61       QMessageBox::warning( this, tr("Warning"), tr("WPA-Personal is selected, but not configured!\nPlease configure your WPA key before saving!") ); 
     62       return; 
     63    } 
     64 
     65    // Check all the WPAEnt settings 
     66    if (radioSecurityWPAEnt->isChecked() ) { 
     67 
     68       // Check if the key is setup for WPA EAP-TLS 
     69       if ( WPAEType == 1 && ( WPAEIdent.isEmpty() || WPAECACert.isEmpty() || WPAEClientCert.isEmpty() || WPAEPrivKeyFile.isEmpty() || WPAEPassword.isEmpty() )) 
     70       { 
     71          QMessageBox::warning( this, tr("Warning"), tr("WPA-Enterprise is selected, but not configured!\nPlease configure your WPA settings before saving!") ); 
     72          return; 
     73       } 
     74 
     75       // Check if the key is setup for WPA EAP-TTLS && EAP-PEAP 
     76       if ( (WPAEType == 2 || WPAEType == 3) && ( WPAEIdent.isEmpty() || WPAECACert.isEmpty()  || WPAEPassword.isEmpty() ) )  
     77       { 
     78          QMessageBox::warning( this, tr("Warning"), tr("WPA-Enterprise is selected, but not configured!\nPlease configure your WPA settings before saving!") ); 
     79          return; 
     80       } 
     81 
     82    } // End of WPAEnt setting check 
     83     
     84     
     85    selectedSSID = lineSSID->text(); 
     86    bool usingBSSID = checkBSSID->isChecked() ; 
     87     
     88    // Emit the new network SSID the user selected 
     89    if ( radioSecurityDisabled->isChecked() ) 
     90    { 
     91        emit signalSavedOpen(selectedSSID, usingBSSID);  
     92    } 
     93 
     94    if ( radioSecurityWEP->isChecked() ) 
     95    { 
     96        emit signalSavedWEP(selectedSSID, usingBSSID, WEPKey, WEPIndex, WEPHex );  
     97    } 
     98 
     99    if ( radioSecurityWPAPersonal->isChecked() ) 
     100    { 
     101        emit signalSavedWPA(selectedSSID, usingBSSID, WPAPersonalKey );  
     102    } 
     103     
     104    if ( radioSecurityWPAEnt->isChecked() ) 
     105    { 
     106        emit signalSavedWPAE(selectedSSID, usingBSSID, WPAEType, WPAEIdent, WPAECACert, WPAEClientCert, WPAEPrivKeyFile, WPAEPassword );  
     107    } 
     108 
     109    close(); 
     110} 
     111 
     112void wifiselectiondialog::slotConfigWEP() 
     113{ 
     114   dialogWEP = new wepConfig(); 
     115    
     116   if ( ! WEPKey.isEmpty() ) 
     117   { 
     118       dialogWEP->setKey(WEPKey, WEPIndex, WEPHex); 
     119   } 
     120    
     121   connect( dialogWEP, SIGNAL( saved(QString, int, bool) ), this, SLOT( slotWEPChanged(QString, int, bool) ) );  
     122   dialogWEP->exec(); 
     123} 
     124 
     125 
     126void wifiselectiondialog::slotWEPChanged( QString newKey, int newIndex, bool hexkey ) 
     127{ 
     128    WEPKey = newKey; 
     129    WEPIndex = newIndex; 
     130    WEPHex = hexkey; 
     131    // Check the status of the radio buttons 
     132    slotCheckSecurityRadio(); 
     133     
     134} 
     135 
     136 
     137void wifiselectiondialog::slotCheckSecurityRadio() 
     138{ 
     139    // Check to see which radio button is checked and take approiate actions 
     140     
     141    if ( radioSecurityDisabled->isChecked() ) 
     142    { 
     143        pushSecurity->setEnabled(FALSE); 
     144    } else if ( radioSecurityWEP->isChecked() ) { 
     145        pushSecurity->setEnabled(TRUE); 
     146        // Check if the key is setup 
     147        if ( ! WEPKey.isEmpty() ) 
     148        { 
     149            radioSecurityWEP->setText( tr("WEP (Configured)") ); 
     150        } else { 
     151            radioSecurityWEP->setText( tr("WEP") ); 
     152        } 
     153    } else if ( radioSecurityWPAPersonal->isChecked() ) { 
     154        pushSecurity->setEnabled(TRUE); 
     155        // Check if the key is setup 
     156        if ( ! WPAPersonalKey.isEmpty() ) 
     157        { 
     158            radioSecurityWPAPersonal->setText( tr("WPA Personal (Configured)") ); 
     159        } else { 
     160            radioSecurityWPAPersonal->setText( tr("WPA Personal") ); 
    116161        } 
    117162         
    118     } 
     163    } else if ( radioSecurityWPAEnt->isChecked() ) { 
     164        pushSecurity->setEnabled(TRUE); 
    119165         
    120          
    121         if ( foundItem == 1 ) 
    122         { 
    123             textTop->setText(tr("Select a wireless network to connect.") ); 
    124             listWifi->setSelected(0, TRUE); 
    125             pushConnect->setEnabled(TRUE); 
    126               } else { 
    127                   textTop->setText(tr("No wireless networks found!") ); 
    128             pushConnect->setEnabled(FALSE); 
     166        // Check if the key is setup 
     167        if ( ! WPAEIdent.isEmpty() && ! WPAECACert.isEmpty() && ! WPAEPassword.isEmpty() ) { 
     168            radioSecurityWPAEnt->setText(tr("WPA Enterprise (Configured)") ); 
     169        } else { 
     170            radioSecurityWPAEnt->setText(tr("WPA Enterprise") ); 
    129171        } 
    130     } 
    131      
    132 } 
    133  
    134  
    135 QString wifiselectiondialog::getLineFromCommandOutput( QString command ) 
    136 { 
    137               FILE *file = popen(command,"r");  
    138          
    139         char buffer[100]; 
    140          
    141         QString line = "";  
    142         char firstChar; 
    143          
    144         if ((firstChar = fgetc(file)) != -1){ 
    145                 line += firstChar; 
    146                 line += fgets(buffer,100,file); 
    147         } 
    148          
    149          
    150         pclose(file); 
    151          
    152          
    153         return line; 
    154 } 
    155  
    156  
    157 void wifiselectiondialog::slotCancel() 
    158 { 
    159     close(); 
    160 } 
    161  
    162  
    163 void wifiselectiondialog::slotConnect() 
    164 { 
    165     QString selectedSSID; 
    166      
    167     // Make sure a device was selected 
    168     int    sel = listWifi->currentItem(); 
    169     if ( sel == -1 ) 
    170     { 
    171         QMessageBox::warning( this, tr("No selection"), 
    172                             tr("Error: You must select a network to connect!\n") ); 
    173         return; 
    174     } 
    175      
    176      
    177     selectedSSID = listWifi->text(sel); 
    178     selectedSSID.truncate( selectedSSID.find("(") - 1 ); 
    179      
    180     // Emit the new network SSID the user selected 
    181     emit saved(selectedSSID); 
    182     close(); 
    183 } 
    184  
    185  
    186  
    187  
    188 void wifiselectiondialog::slotRescan() 
    189 { 
    190     pushConnect->setEnabled(FALSE); 
    191     scanWifi(); 
    192 } 
    193  
    194  
    195 void wifiselectiondialog::runCommand( QString Command ) 
    196 { 
    197               FILE *file = popen(Command,"r");  
    198         fclose(file); 
    199 } 
    200  
    201  
    202  
    203  
    204 void wifiselectiondialog::startScan() 
    205 { 
    206     scanWifi(); 
    207 } 
    208  
    209  
     172 
     173    } 
     174 
     175} 
     176 
     177 
     178void wifiselectiondialog::slotCheckWhichSecurity() 
     179{ 
     180        if ( radioSecurityDisabled->isChecked() ) 
     181    { 
     182            return; 
     183    } else if ( radioSecurityWEP->isChecked() ) { 
     184        // Run the WEP config dialog 
     185        slotConfigWEP(); 
     186    } else if ( radioSecurityWPAPersonal->isChecked() ) { 
     187        slotConfigWPAP(); 
     188    } else if ( radioSecurityWPAEnt->isChecked() ) { 
     189        slotConfigWPAE(); 
     190    } 
     191 
     192} 
     193 
     194 
     195void wifiselectiondialog::slotConfigWPAP() 
     196{ 
     197    // Bring up the WPA-Personal config dialog 
     198     
     199   dialogWPAP = new dialogWPAPersonal(); 
     200    
     201   if ( ! WPAPersonalKey.isEmpty() ) 
     202   { 
     203       dialogWPAP->setKey(WPAPersonalKey); 
     204   } 
     205    
     206   connect( dialogWPAP, SIGNAL( saved(QString) ), this, SLOT( slotWPAPChanged(QString) ) );  
     207   dialogWPAP->exec(); 
     208 
     209} 
     210 
     211 
     212void wifiselectiondialog::slotConfigWPAE() 
     213{ 
     214   // Bring up the WPA-Enterprise config dialog 
     215     
     216   dialogWPAE = new dialogWPAEnterprise(); 
     217    
     218   if ( ! WPAEIdent.isEmpty() ) 
     219   { 
     220       dialogWPAE->setVariables(WPAEType, WPAEIdent, WPAECACert, WPAEClientCert, WPAEPrivKeyFile, WPAEPassword); 
     221   } 
     222    
     223   connect( dialogWPAE, SIGNAL( saved(int, QString, QString, QString, QString, QString) ), this, SLOT( slotWPAEChanged(int, QString, QString, QString, QString, QString) ) );  
     224   dialogWPAE->exec(); 
     225} 
     226 
     227 
     228void wifiselectiondialog::slotWPAPChanged( QString newKey ) 
     229{ 
     230    WPAPersonalKey = newKey; 
     231    slotCheckSecurityRadio(); 
     232} 
     233 
     234 
     235void wifiselectiondialog::slotWPAEChanged( int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass ) 
     236{ 
     237WPAEType = type; 
     238WPAEIdent=EAPIdent; 
     239WPAECACert=CACert; 
     240WPAEClientCert=ClientCert; 
     241WPAEPrivKeyFile=PrivKeyFile; 
     242WPAEPassword=PrivKeyPass; 
     243 
     244slotCheckSecurityRadio(); 
     245 
     246} 
     247 
  • pcbsd/branches/7.0/wificonfig/wifiselectiondialog.h

    r2166 r2904  
    55#include <qmessagebox.h> 
    66#include <qdialog.h> 
     7#include "wepconfig.h" 
     8#include "dialogwpapersonal.h" 
     9#include "dialogwpaenterprise.h" 
     10#include "wifiscanssid.h" 
    711#include "ui_wifiselectiondialog.h" 
    812 
     
    1721        } 
    1822 
    19    void init( QString Device, QString oldSSID ); 
     23   void init(QString device); 
    2024   void scanWifi(); 
    2125 
     
    2630    void slotCancel(); 
    2731    void slotConnect(); 
    28     void slotRescan(); 
    29     void startScan(); 
     32    void slotOpenWifiScan(); 
     33    void slotSSIDChanged(QString newSSID); 
     34    void slotConfigWEP(); 
     35    void slotWEPChanged( QString newKey, int newIndex, bool hexkey ); 
     36    void slotCheckSecurityRadio(); 
     37    void slotCheckWhichSecurity(); 
     38    void slotConfigWPAP(); 
     39    void slotConfigWPAE(); 
     40    void slotWPAPChanged( QString newKey ); 
     41    void slotWPAEChanged( int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass ); 
    3042 
    3143private: 
    3244    QString DeviceName; 
    3345    QString SSID; 
    34     QString getLineFromCommandOutput( QString command ); 
    35     void runCommand( QString Command ); 
    3646 
     47    // Setup our dialogs 
     48    wifiscanssid *dialogWifiscanssid; 
     49    wepConfig *dialogWEP; 
     50    dialogWPAPersonal *dialogWPAP; 
     51    dialogWPAEnterprise *dialogWPAE; 
    3752 
     53    // WEP variables 
     54    QString WEPKey; 
     55    int WEPIndex; 
     56    bool WEPHex; 
     57 
     58    // WPA Personal Key variable 
     59    QString WPAPersonalKey; 
     60 
     61    // WPAE Variables 
     62    int WPAEType; 
     63    QString WPAEIdent; 
     64    QString WPAECACert; 
     65    QString WPAEClientCert; 
     66    QString WPAEPrivKeyFile; 
     67    QString WPAEPassword; 
    3868 
    3969signals: 
    40    void saved(QString); 
     70   void signalSavedOpen(QString, bool); 
     71   void signalSavedWEP(QString, bool, QString, int, bool ); 
     72   void signalSavedWPA(QString, bool, QString); 
     73   void signalSavedWPAE(QString, bool, int, QString, QString, QString, QString, QString); 
    4174 
    4275} ; 
  • pcbsd/branches/7.0/wificonfig/wifiselectiondialog.ui

    r2895 r2904  
    66    <x>0</x> 
    77    <y>0</y> 
    8     <width>420</width> 
    9     <height>314</height> 
     8    <width>410</width> 
     9    <height>355</height> 
    1010   </rect> 
    1111  </property> 
     
    1717    <normaloff>:/tray_wifi85.png</normaloff>:/tray_wifi85.png</iconset> 
    1818  </property> 
    19   <layout class="QGridLayout" > 
    20    <item row="0" column="0" colspan="3" > 
    21     <widget class="QLabel" name="textTop" > 
    22      <property name="frameShape" > 
    23       <enum>QFrame::NoFrame</enum> 
    24      </property> 
    25      <property name="frameShadow" > 
    26       <enum>QFrame::Plain</enum> 
    27      </property> 
    28      <property name="text" > 
    29       <string>Select a wireless network to connect.</string> 
    30      </property> 
    31      <property name="wordWrap" > 
    32       <bool>false</bool> 
    33      </property> 
     19  <layout class="QGridLayout" name="gridLayout_3" > 
     20   <item row="0" column="0" > 
     21    <widget class="Q3GroupBox" name="groupBSSID" > 
     22     <property name="enabled" > 
     23      <bool>true</bool> 
     24     </property> 
     25     <property name="title" > 
     26      <string>Selected Wireless Network</string> 
     27     </property> 
     28     <layout class="QGridLayout" name="gridLayout_2" > 
     29      <item row="0" column="0" > 
     30       <layout class="QHBoxLayout" name="horizontalLayout_2" > 
     31        <item> 
     32         <widget class="QLineEdit" name="lineSSID" /> 
     33        </item> 
     34        <item> 
     35         <widget class="QPushButton" name="pushScan" > 
     36          <property name="text" > 
     37           <string>Scan</string> 
     38          </property> 
     39         </widget> 
     40        </item> 
     41       </layout> 
     42      </item> 
     43      <item row="1" column="0" > 
     44       <widget class="QCheckBox" name="checkBSSID" > 
     45        <property name="enabled" > 
     46         <bool>true</bool> 
     47        </property> 
     48        <property name="text" > 
     49         <string>Using BSSID</string> 
     50        </property> 
     51        <property name="shortcut" > 
     52         <string/> 
     53        </property> 
     54        <property name="checked" > 
     55         <bool>false</bool> 
     56        </property> 
     57       </widget> 
     58      </item> 
     59     </layout> 
    3460    </widget> 
    3561   </item> 
    36    <item row="3" column="1" > 
    37     <widget class="QPushButton" name="pushConnect" > 
    38      <property name="text" > 
    39       <string>&amp;Connect</string> 
    40      </property> 
    41      <property name="shortcut" > 
    42       <string>Alt+C</string> 
    43      </property> 
     62   <item row="1" column="0" > 
     63    <widget class="Q3ButtonGroup" name="buttonGroupSecurity" > 
     64     <property name="title" > 
     65      <string>Security Mode</string> 
     66     </property> 
     67     <layout class="QGridLayout" name="gridLayout" > 
     68      <item row="0" column="0" > 
     69       <layout class="QVBoxLayout" name="verticalLayout" > 
     70        <item> 
     71         <widget class="QRadioButton" name="radioSecurityDisabled" > 
     72          <property name="text" > 
     73           <string>Disabled</string> 
     74          </property> 
     75          <property name="checked" > 
     76           <bool>true</bool> 
     77          </property> 
     78         </widget> 
     79        </item> 
     80        <item> 
     81         <widget class="QRadioButton" name="radioSecurityWEP" > 
     82          <property name="enabled" > 
     83           <bool>true</bool> 
     84          </property> 
     85          <property name="text" > 
     86           <string>WEP</string> 
     87          </property> 
     88          <property name="checked" > 
     89           <bool>false</bool> 
     90          </property> 
     91         </widget> 
     92        </item> 
     93        <item> 
     94         <widget class="QRadioButton" name="radioSecurityWPAPersonal" > 
     95          <property name="text" > 
     96           <string>WPA Personal</string> 
     97          </property> 
     98          <property name="shortcut" > 
     99           <string/> 
     100          </property> 
     101         </widget> 
     102        </item> 
     103        <item> 
     104         <widget class="QRadioButton" name="radioSecurityWPAEnt" > 
     105          <property name="text" > 
     106           <string>WPA Enterprise</string> 
     107          </property> 
     108          <property name="shortcut" > 
     109           <string/> 
     110          </property> 
     111         </widget> 
     112        </item> 
     113       </layout> 
     114      </item> 
     115      <item row="1" column="0" > 
     116       <spacer name="spacer6" > 
     117        <property name="orientation" > 
     118         <enum>Qt::Horizontal</enum> 
     119        </property> 
     120        <property name="sizeType" > 
     121         <enum>QSizePolicy::Expanding</enum> 
     122        </property> 
     123        <property name="sizeHint" stdset="0" > 
     124         <size> 
     125          <width>130</width> 
     126          <height>20</height> 
     127         </size> 
     128        </property> 
     129       </spacer> 
     130      </item> 
     131      <item row="1" column="1" > 
     132       <widget class="QPushButton" name="pushSecurity" > 
     133        <property name="text" > 
     134         <string>Configure</string> 
     135        </property> 
     136        <property name="shortcut" > 
     137         <string/> 
     138        </property> 
     139       </widget> 
     140      </item> 
     141     </layout> 
    44142    </widget> 
    45143   </item> 
    46    <item row="3" column="0" > 
    47     <spacer name="spacer8" > 
    48      <property name="orientation" > 
    49       <enum>Qt::Horizontal</enum> 
    50      </property> 
    51      <property name="sizeType" > 
    52       <enum>QSizePolicy::Expanding</enum> 
    53      </property> 
    54      <property name="sizeHint" stdset="0" > 
    55       <size> 
    56        <width>70</width> 
    57        <height>21</height> 
    58       </size> 
    59      </property> 
    60     </spacer> 
    61    </item> 
    62    <item row="3" column="2" > 
    63     <widget class="QPushButton" name="pushCancel" > 
    64      <property name="text" > 
    65       <string>Cancel</string> 
    66      </property> 
    67     </widget> 
    68    </item> 
    69    <item row="2" column="0" colspan="3" > 
     144   <item row="2" column="0" > 
    70145    <spacer name="spacer9" > 
    71146     <property name="orientation" > 
     
    83158    </spacer> 
    84159   </item> 
    85    <item row="1" column="0" colspan="3" > 
    86     <widget class="Q3GroupBox" name="groupBox2" > 
    87      <property name="title" > 
    88       <string>Available wireless networks</string> 
    89      </property> 
    90      <layout class="QGridLayout" > 
    91       <item row="0" column="0" colspan="2" > 
    92        <widget class="Q3ListBox" name="listWifi" /> 
    93       </item> 
    94       <item row="1" column="0" > 
    95        <spacer name="spacer10" > 
    96         <property name="orientation" > 
    97          <enum>Qt::Horizontal</enum> 
    98         </property> 
    99         <property name="sizeType" > 
    100          <enum>QSizePolicy::Expanding</enum> 
    101         </property> 
    102         <property name="sizeHint" stdset="0" > 
    103          <size> 
    104           <width>131</width> 
    105           <height>20</height> 
    106          </size> 
    107         </property> 
    108        </spacer> 
    109       </item> 
    110       <item row="1" column="1" > 
    111        <widget class="QPushButton" name="pushRescan" > 
    112         <property name="text" > 
    113          <string>&amp;Rescan</string> 
    114         </property> 
    115         <property name="shortcut" > 
    116          <string>Alt+R</string> 
    117         </property> 
    118        </widget> 
    119       </item> 
    120      </layout> 
    121     </widget> 
     160   <item row="3" column="0" > 
     161    <layout class="QHBoxLayout" name="horizontalLayout" > 
     162     <item> 
     163      <spacer name="spacer8" > 
     164       <property name="orientation" > 
     165        <enum>Qt::Horizontal</enum> 
     166       </property> 
     167       <property name="sizeType" > 
     168        <enum>QSizePolicy::Expanding</enum> 
     169       </property> 
     170       <property name="sizeHint" stdset="0" > 
     171        <size> 
     172         <width>70</width> 
     173         <height>21</height> 
     174        </size> 
     175       </property> 
     176      </spacer> 
     177     </item> 
     178     <item> 
     179      <widget class="QPushButton" name="pushConnect" > 
     180       <property name="text" > 
     181        <string>Add</string> 
     182       </property> 
     183       <property name="shortcut" > 
     184        <string>Alt+C</string> 
     185       </property> 
     186      </widget> 
     187     </item> 
     188     <item> 
     189      <widget class="QPushButton" name="pushCancel" > 
     190       <property name="text" > 
     191        <string>Cancel</string> 
     192       </property> 
     193      </widget> 
     194     </item> 
     195    </layout> 
    122196   </item> 
    123197  </layout> 
     
    133207  </customwidget> 
    134208  <customwidget> 
    135    <class>Q3ListBox</class> 
    136    <extends>Q3Frame</extends> 
    137    <header>q3listbox.h</header> 
     209   <class>Q3ButtonGroup</class> 
     210   <extends>Q3GroupBox</extends> 
     211   <header>Qt3Support/Q3ButtonGroup</header> 
     212   <container>1</container> 
    138213  </customwidget> 
    139214 </customwidgets> 
     
    147222  <include location="wificonfig.qrc" /> 
    148223 </resources> 
    149  <connections> 
    150   <connection> 
    151    <sender>pushCancel</sender> 
    152    <signal>clicked()</signal> 
    153    <receiver>wifiselectiondialog</receiver> 
    154    <slot>slotCancel()</slot> 
    155    <hints> 
    156     <hint type="sourcelabel" > 
    157      <x>20</x> 
    158      <y>20</y> 
    159     </hint> 
    160     <hint type="destinationlabel" > 
    161      <x>20</x> 
    162      <y>20</y> 
    163     </hint> 
    164    </hints> 
    165   </connection> 
    166   <connection> 
    167    <sender>pushConnect</sender> 
    168    <signal>clicked()</signal> 
    169    <receiver>wifiselectiondialog</receiver> 
    170    <slot>slotConnect()</slot> 
    171    <hints> 
    172     <hint type="sourcelabel" > 
    173      <x>20</x> 
    174      <y>20</y> 
    175     </hint> 
    176     <hint type="destinationlabel" > 
    177      <x>20</x> 
    178      <y>20</y> 
    179     </hint> 
    180    </hints> 
    181   </connection> 
    182   <connection> 
    183    <sender>pushRescan</sender> 
    184    <signal>clicked()</signal> 
    185    <receiver>wifiselectiondialog</receiver> 
    186    <slot>slotRescan()</slot> 
    187    <hints> 
    188     <hint type="sourcelabel" > 
    189      <x>20</x> 
    190      <y>20</y> 
    191     </hint> 
    192     <hint type="destinationlabel" > 
    193      <x>20</x> 
    194      <y>20</y> 
    195     </hint> 
    196    </hints> 
    197   </connection> 
    198  </connections> 
     224 <connections/> 
    199225</ui> 
  • pcbsd/trunk/wificonfig/dialogwpapersonal.cpp

    r2166 r2904  
    2424{ 
    2525  if ( lineKey->text() != lineKey2->text() ) 
    26     { 
    27         QMessageBox::warning( this, "Network Key Error", "Error: The entered network keys do not match!\n" ); 
    28     } else { 
    29         emit saved(lineKey->text()); 
    30         close(); 
    31     } 
     26  { 
     27     QMessageBox::warning( this, "Network Key Error", "Error: The entered network keys do not match!\n" ); 
     28     return; 
     29  }  
     30   
     31  if ( lineKey->text().length() < 8 || lineKey->text().length() > 63 ) 
     32  { 
     33     QMessageBox::warning( this, "Network Key Error", "Error: The network key must be between 8-63 characters in length!\n" ); 
     34     return; 
     35  }  
     36 
     37  emit saved(lineKey->text()); 
     38  close(); 
    3239} 
  • pcbsd/trunk/wificonfig/wificonfig.pro

    r2669 r2904  
    1212           wepconfig.h \ 
    1313           wificonfigwidgetbase.h \ 
     14           wifiscanssid.h \ 
    1415           wifiselectiondialog.h 
    1516<