[PC-BSD Commits] r3870 - in pcbsd: trunk/wificonfig trunk-current/wificonfig

svn at pcbsd.org svn at pcbsd.org
Tue May 5 16:21:36 PDT 2009


Author: kris
Date: 2009-05-05 16:21:36 -0700 (Tue, 05 May 2009)
New Revision: 3870

Added:
   pcbsd/trunk-current/wificonfig/configure.png
   pcbsd/trunk/wificonfig/configure.png
Modified:
   pcbsd/trunk-current/wificonfig/wificonfig.qrc
   pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.cpp
   pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.h
   pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.ui
   pcbsd/trunk-current/wificonfig/wifiselectiondialog.cpp
   pcbsd/trunk-current/wificonfig/wifiselectiondialog.h
   pcbsd/trunk/wificonfig/wificonfig.qrc
   pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp
   pcbsd/trunk/wificonfig/wificonfigwidgetbase.h
   pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui
   pcbsd/trunk/wificonfig/wifiselectiondialog.cpp
   pcbsd/trunk/wificonfig/wifiselectiondialog.h
Log:

Updated our WiFi setup tool. Now you can "edit" a saved profile / key, and also you can set priority to which network you want to connect to first. 




Property changes on: pcbsd/trunk/wificonfig/configure.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: pcbsd/trunk/wificonfig/wificonfig.qrc
===================================================================
--- pcbsd/trunk/wificonfig/wificonfig.qrc	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk/wificonfig/wificonfig.qrc	2009-05-05 23:21:36 UTC (rev 3870)
@@ -1,5 +1,6 @@
 <RCC>
   <qresource>
+    <file>configure.png</file>
     <file>object-locked.png</file>
     <file>object-unlocked.png</file>
     <file>edit-delete.png</file>

Modified: pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp
===================================================================
--- pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk/wificonfig/wificonfigwidgetbase.cpp	2009-05-05 23:21:36 UTC (rev 3870)
@@ -81,7 +81,7 @@
        QTextStream streamout( &fileout );
 
        // Loop through all the devices we have now
-       for(int curItem=0; curItem < 149; curItem++)
+       for(int curItem=0; curItem < 145; curItem++)
        {
          if ( ! SSIDList[curItem].isEmpty() )
          {
@@ -95,6 +95,7 @@
          streamout << "network={\n ssid=\"" + SSIDList[curItem] + "\"\n";
        }
 
+       streamout << " priority=" << 145 - curItem << "\n";
        streamout << " scan_ssid=1\n";
 
        if ( SSIDEncType[curItem] == NO_ENCRYPTION )
@@ -185,7 +186,10 @@
 { 
     
   // Connect our add / remove buttons for wifi
+  connect( pushDown, SIGNAL( clicked() ), this, SLOT( slotMoveDown() ) ); 
+  connect( pushUp, SIGNAL( clicked() ), this, SLOT( slotMoveUp() ) ); 
   connect( pushAddWifi, SIGNAL( clicked() ), this, SLOT( slotAddNewProfile() ) ); 
+  connect( pushEditWifi, SIGNAL( clicked() ), this, SLOT( slotEditProfile() ) ); 
   connect( pushRemoveWifi, SIGNAL( clicked() ), this, SLOT( slotRemoveProfile() ) ); 
 
 
@@ -392,26 +396,237 @@
     return "";
 }
 
-void wificonfigwidgetbase::slotRemoveProfile()
+// Slot which moves a SSID higher in the connection priority
+void wificonfigwidgetbase::slotMoveUp()
 {
+    QString tmpString;
+    int tmpInt;
+    bool tmpBool;
+
     // Check if we have a selection to work with
     if ( listWifi->currentRow() != -1 )
     {
       // Locate the SSID we want to remove
-      QString removeSSID = listWifi->item(listWifi->currentRow())->text();
-      for ( int curItem = 0; curItem < 149; curItem++)
+      QString editSSID = listWifi->item(listWifi->currentRow())->text();
+      for ( int i = 0; i < 145; i++)
       {
-          if ( SSIDList[curItem] == removeSSID )
+          if ( SSIDList[i] == editSSID && i != 0 )
           {
-             SSIDList[curItem] = "";
+            // We found the ssid we need to move up
+            tmpString = SSIDList[i-1];
+            SSIDList[i-1] = SSIDList[i] ; 
+            SSIDList[i] = tmpString; 
+            
+            tmpInt = SSIDEncType[i-1];
+            SSIDEncType[i-1] = SSIDEncType[i];
+            SSIDEncType[i] = tmpInt;
+
+            tmpBool = BSSID[i-1];
+            BSSID[i-1] = BSSID[i];
+            BSSID[i] = tmpBool;
+
+            tmpString = WEPKey[i-1];
+            WEPKey[i-1] = WEPKey[i];
+            WEPKey[i] = tmpString;
+
+            tmpInt = WEPIndex[i-1];
+            WEPIndex[i-1] = WEPIndex[i];
+            WEPIndex[i] = tmpInt;
+
+            tmpBool = WEPHex[i-1];
+            WEPHex[i-1] = WEPHex[i];
+            WEPHex[i] = tmpBool;
+
+            tmpString = WPAPersonalKey[i-1];
+            WPAPersonalKey[i-1] = WPAPersonalKey[i];
+            WPAPersonalKey[i] = tmpString;
+
+            tmpString = WPAEIdent[i-1];
+            WPAEIdent[i-1] = WPAEIdent[i];
+            WPAEIdent[i] = tmpString;
+
+            tmpString = WPAECACert[i-1];
+            WPAECACert[i-1] = WPAECACert[i];
+            WPAECACert[i] = tmpString;
+
+            tmpString = WPAEClientCert[i-1];
+            WPAEClientCert[i-1] = WPAEClientCert[i];
+            WPAEClientCert[i] = tmpString;
+
+            tmpString = WPAEPrivKeyFile[i-1];
+            WPAEPrivKeyFile[i-1] = WPAEPrivKeyFile[i];
+            WPAEPrivKeyFile[i] = tmpString;
+
+            tmpString = WPAEPassword[i-1];
+            WPAEPassword[i-1] = WPAEPassword[i];
+            WPAEPassword[i] = tmpString;
+
+            tmpInt = WPAEType[i-1];
+            WPAEType[i-1] = WPAEType[i];
+            WPAEType[i] = tmpInt;
+            break;
           }
       }
 
       // Refresh the SSID list and enable the apply button
       slotRefreshSSIDList();
       pushApply->setEnabled(TRUE);
+    }
+}
 
+
+// Slot which moves a SSID lower in the connection priority
+void wificonfigwidgetbase::slotMoveDown()
+{
+    QString tmpString;
+    int tmpInt;
+    bool tmpBool;
+
+    // Check if we have a selection to work with
+    if ( listWifi->currentRow() != -1 )
+    {
+      // Locate the SSID we want to remove
+      QString editSSID = listWifi->item(listWifi->currentRow())->text();
+      for ( int i = 0; i < 145; i++)
+      {
+          if ( SSIDList[i] == editSSID && ! SSIDList[i+1].isEmpty())
+          {
+            // We found the ssid we need to move down
+            tmpString = SSIDList[i+1];
+            SSIDList[i+1] = SSIDList[i] ; 
+            SSIDList[i] = tmpString; 
+            
+            tmpInt = SSIDEncType[i+1];
+            SSIDEncType[i+1] = SSIDEncType[i];
+            SSIDEncType[i] = tmpInt;
+
+            tmpBool = BSSID[i+1];
+            BSSID[i+1] = BSSID[i];
+            BSSID[i] = tmpBool;
+
+            tmpString = WEPKey[i+1];
+            WEPKey[i+1] = WEPKey[i];
+            WEPKey[i] = tmpString;
+
+            tmpInt = WEPIndex[i+1];
+            WEPIndex[i+1] = WEPIndex[i];
+            WEPIndex[i] = tmpInt;
+
+            tmpBool = WEPHex[i+1];
+            WEPHex[i+1] = WEPHex[i];
+            WEPHex[i] = tmpBool;
+
+            tmpString = WPAPersonalKey[i+1];
+            WPAPersonalKey[i+1] = WPAPersonalKey[i];
+            WPAPersonalKey[i] = tmpString;
+
+            tmpString = WPAEIdent[i+1];
+            WPAEIdent[i+1] = WPAEIdent[i];
+            WPAEIdent[i] = tmpString;
+
+            tmpString = WPAECACert[i+1];
+            WPAECACert[i+1] = WPAECACert[i];
+            WPAECACert[i] = tmpString;
+
+            tmpString = WPAEClientCert[i+1];
+            WPAEClientCert[i+1] = WPAEClientCert[i];
+            WPAEClientCert[i] = tmpString;
+
+            tmpString = WPAEPrivKeyFile[i+1];
+            WPAEPrivKeyFile[i+1] = WPAEPrivKeyFile[i];
+            WPAEPrivKeyFile[i] = tmpString;
+
+            tmpString = WPAEPassword[i+1];
+            WPAEPassword[i+1] = WPAEPassword[i];
+            WPAEPassword[i] = tmpString;
+
+            tmpInt = WPAEType[i+1];
+            WPAEType[i+1] = WPAEType[i];
+            WPAEType[i] = tmpInt;
+            break;
+          }
+      }
+
+      // Refresh the SSID list and enable the apply button
+      slotRefreshSSIDList();
+      pushApply->setEnabled(TRUE);
     }
+}
+
+void wificonfigwidgetbase::slotEditProfile()
+{
+    bool foundSSID=false;
+    int curItem=0;
+
+    // Check if we have a selection to work with
+    if ( listWifi->currentRow() != -1 )
+    {
+      // Locate the SSID we want to remove
+      QString editSSID = listWifi->item(listWifi->currentRow())->text();
+      for ( int i = 0; i < 145; i++)
+      {
+          if ( SSIDList[i] == editSSID )
+          {
+            // We found the ssid we need to edit
+            foundSSID=true; 
+            curItem=i;
+            break;
+          }
+      }
+
+      // Lets go ahead and open the edit dialog on this SSID
+      if (foundSSID)
+      {
+          // Set our internal flag that this is an edit on an existing device
+          wifiselect = new wifiselectiondialog();
+          wifiselect->init(DeviceName);
+
+          // Check the type of SSID this is, and issue appropriate edit 
+          if ( SSIDEncType[curItem] == NO_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem]);
+          }
+          if ( SSIDEncType[curItem] == WEP_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem], WEPKey[curItem], WEPIndex[curItem], WEPHex[curItem]);
+          }
+          if ( SSIDEncType[curItem] == WPA_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem], WPAPersonalKey[curItem]);
+          }
+          if ( SSIDEncType[curItem] == WPAE_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem], WPAEType[curItem], WPAEIdent[curItem], WPAECACert[curItem], WPAEClientCert[curItem], WPAEPrivKeyFile[curItem], WPAEPassword[curItem]);
+          }
+
+
+          // Connect our delete signal, which runs before we add a new SSID
+          connect( wifiselect, SIGNAL( signalDeleteSSID(QString) ), this, SLOT( slotRemoveProfileSSID(QString) ) ); 
+
+          // Connect our save signals
+          connect( wifiselect, SIGNAL( signalSavedOpen(QString, bool) ), this, SLOT( slotAddNewProfileOpen(QString, bool) ) );
+          connect( wifiselect, SIGNAL( signalSavedWEP( QString, bool, QString, int, bool ) ), this, SLOT( slotAddNewProfileWEP( QString, bool, QString, int, bool) ) );
+   connect( wifiselect, SIGNAL( signalSavedWPA(QString, bool, QString) ), this, SLOT( slotAddNewProfileWPA(QString, bool, QString) ) );
+   	  connect( wifiselect, SIGNAL( signalSavedWPAE(QString, bool, int, QString, QString, QString, QString, QString) ), this, SLOT ( slotAddNewProfileWPAE(QString, bool, int, QString, QString, QString, QString, QString) ) );
+
+          wifiselect->exec();
+      }
+
+
+    }
+}
+
+
+void wificonfigwidgetbase::slotRemoveProfile()
+{
+    // Check if we have a selection to work with
+    if ( listWifi->currentRow() != -1 )
+    {
+      // Locate the SSID we want to remove
+      QString removeSSID = listWifi->item(listWifi->currentRow())->text();
+      slotRemoveProfileSSID(removeSSID);
+
+      // Refresh the SSID list and enable the apply button
+      slotRefreshSSIDList();
+      pushApply->setEnabled(TRUE);
+
+    }
   
 }
 
@@ -420,11 +635,10 @@
    wifiselect = new wifiselectiondialog();
    wifiselect->init(DeviceName);
 
+   // Connect our save slots
    connect( wifiselect, SIGNAL( signalSavedOpen(QString, bool) ), this, SLOT( slotAddNewProfileOpen(QString, bool) ) ); 
-
    connect( wifiselect, SIGNAL( signalSavedWEP( QString, bool, QString, int, bool ) ), this, SLOT( slotAddNewProfileWEP( QString, bool, QString, int, bool) ) ); 
    connect( wifiselect, SIGNAL( signalSavedWPA(QString, bool, QString) ), this, SLOT( slotAddNewProfileWPA(QString, bool, QString) ) ); 
-
    connect( wifiselect, SIGNAL( signalSavedWPAE(QString, bool, int, QString, QString, QString, QString, QString) ), this, SLOT( slotAddNewProfileWPAE(QString, bool, int, QString, QString, QString, QString, QString) ) ); 
 
    wifiselect->exec();
@@ -437,21 +651,59 @@
 	fclose(file);
 }
 
-void wificonfigwidgetbase::slotAddNewProfileOpen(QString SSID, bool isBSSID)
+void wificonfigwidgetbase::slotRemoveProfileSSID(QString RemoveSSID)
 {
+   bool foundSSID=false;
 
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   // Loop through, remove selected SSID, and move any entries after it up
+   for (int remItem = 0; remItem < 145; remItem++)
    {
+
+     if ( RemoveSSID == SSIDList[remItem] ) {
+       foundSSID=true;
+     }
+
+     if(foundSSID) 
+     {
+       SSIDList[remItem] = SSIDList[remItem+1] ; 
+       SSIDEncType[remItem] = SSIDEncType[remItem+1];
+       BSSID[remItem] = BSSID[remItem+1];
+       WEPKey[remItem] = WEPKey[remItem+1];
+       WEPIndex[remItem] = WEPIndex[remItem+1];
+       WEPHex[remItem] = WEPHex[remItem+1];
+       WPAPersonalKey[remItem] = WPAPersonalKey[remItem+1];
+       WPAEIdent[remItem] = WPAEIdent[remItem+1];
+       WPAECACert[remItem] = WPAECACert[remItem+1];
+       WPAEClientCert[remItem] = WPAEClientCert[remItem+1];
+       WPAEPrivKeyFile[remItem] = WPAEPrivKeyFile[remItem+1];
+       WPAEPassword[remItem] = WPAEPassword[remItem+1];
+       WPAEType[remItem] = WPAEType[remItem+1];
+     }
+
+     if ( SSIDList[remItem+1].isEmpty() )
+     {
+       break;
+     }
+
+   }
+
+   
+}
+
+void wificonfigwidgetbase::slotAddNewProfileOpen(QString SSID, bool isBSSID)
+{
+   for (int dupItem = 0; dupItem < 145; dupItem++)
+   {
       if ( SSID == SSIDList[dupItem] ) {
-        QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
-        return;
+          QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
+          return;
       }
    }
 
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -468,7 +720,7 @@
 
 void wificonfigwidgetbase::slotAddNewProfileWEP( QString SSID, bool isBSSID, QString newKey, int newIndex, bool hexkey )
 {
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   for (int dupItem = 0; dupItem < 145; dupItem++)
    {
       if ( SSID == SSIDList[dupItem] ) {
         QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
@@ -479,7 +731,7 @@
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -503,7 +755,7 @@
 
 void wificonfigwidgetbase::slotAddNewProfileWPA( QString SSID, bool isBSSID, QString newKey )
 {
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   for (int dupItem = 0; dupItem < 145; dupItem++)
    {
       if ( SSID == SSIDList[dupItem] ) {
         QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
@@ -513,7 +765,7 @@
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -533,7 +785,7 @@
 void wificonfigwidgetbase::slotAddNewProfileWPAE( QString SSID, bool isBSSID, int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass )
 {
 
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   for (int dupItem = 0; dupItem < 145; dupItem++)
    {
       if ( SSID == SSIDList[dupItem] ) {
         QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
@@ -543,7 +795,7 @@
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -964,8 +1216,8 @@
 
      curItem++;
 
-     // We only need 150 wireless networks
-     if ( curItem > 149 )
+     // We only need 145 wireless networks
+     if ( curItem > 145 )
      {
 	break;
      }

Modified: pcbsd/trunk/wificonfig/wificonfigwidgetbase.h
===================================================================
--- pcbsd/trunk/wificonfig/wificonfigwidgetbase.h	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk/wificonfig/wificonfigwidgetbase.h	2009-05-05 23:21:36 UTC (rev 3870)
@@ -41,7 +41,9 @@
     void slotApply();
     void slotCheckDHCPBox();
     void slotAddNewProfile();
+    void slotEditProfile();
     void slotRemoveProfile();
+    void slotRemoveProfileSSID(QString RemoveSSID);
     void slotAddNewProfileOpen( QString SSID, bool isBSSID );
     void slotAddNewProfileWEP( QString SSID, bool isBSSID, QString newKey, int newIndex, bool hexkey );
     void slotAddNewProfileWPA( QString SSID, bool isBSSID, QString newKey );
@@ -53,8 +55,9 @@
     void slotFinishLoading();
     void slotCheckGlobalText();
     void slotRefreshSSIDList();
+    void slotMoveUp();
+    void slotMoveDown();
 
-
 private:
     bool checkRange( QString IP );
     void saveValue( QString File, QString oldKey, QString newKey, int occur );

Modified: pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui
===================================================================
--- pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk/wificonfig/wificonfigwidgetbase.ui	2009-05-05 23:21:36 UTC (rev 3870)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>348</width>
-    <height>450</height>
+    <width>320</width>
+    <height>463</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -79,12 +79,89 @@
       <attribute name="title" >
        <string>&amp;General</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_4" >
+      <layout class="QGridLayout" name="gridLayout_3" >
+       <item row="0" column="0" >
+        <widget class="QLabel" name="textLabel2" >
+         <property name="text" >
+          <string>Wireless network profiles</string>
+         </property>
+         <property name="wordWrap" >
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
        <item row="1" column="0" >
-        <layout class="QGridLayout" name="gridLayout_3" >
+        <layout class="QGridLayout" name="gridLayout_2" >
          <item row="0" column="0" >
           <widget class="QListWidget" name="listWifi" />
          </item>
+         <item row="0" column="1" >
+          <layout class="QVBoxLayout" name="verticalLayout" >
+           <property name="sizeConstraint" >
+            <enum>QLayout::SetDefaultConstraint</enum>
+           </property>
+           <item>
+            <spacer name="verticalSpacer_2" >
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" stdset="0" >
+              <size>
+               <width>28</width>
+               <height>18</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QPushButton" name="pushUp" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text" >
+              <string/>
+             </property>
+             <property name="icon" >
+              <iconset resource="wificonfig.qrc" >
+               <normaloff>:/arrow-up.png</normaloff>:/arrow-up.png</iconset>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QPushButton" name="pushDown" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text" >
+              <string/>
+             </property>
+             <property name="icon" >
+              <iconset resource="wificonfig.qrc" >
+               <normaloff>:/arrow-down.png</normaloff>:/arrow-down.png</iconset>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="verticalSpacer" >
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" stdset="0" >
+              <size>
+               <width>20</width>
+               <height>40</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
         </layout>
        </item>
        <item row="2" column="0" >
@@ -104,6 +181,17 @@
           </widget>
          </item>
          <item>
+          <widget class="QPushButton" name="pushEditWifi" >
+           <property name="text" >
+            <string>Edit</string>
+           </property>
+           <property name="icon" >
+            <iconset resource="wificonfig.qrc" >
+             <normaloff>:/configure.png</normaloff>:/configure.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
           <widget class="QPushButton" name="pushRemoveWifi" >
            <property name="text" >
             <string>Remove</string>
@@ -129,16 +217,6 @@
          </item>
         </layout>
        </item>
-       <item row="4" column="0" >
-        <widget class="QCheckBox" name="checkDHCP" >
-         <property name="text" >
-          <string>O&amp;btain IP automatically (DHCP)</string>
-         </property>
-         <property name="shortcut" >
-          <string>Alt+B</string>
-         </property>
-        </widget>
-       </item>
        <item row="3" column="0" >
         <widget class="Line" name="line1" >
          <property name="frameShape" >
@@ -149,13 +227,13 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="0" >
-        <widget class="QLabel" name="textLabel2" >
+       <item row="4" column="0" >
+        <widget class="QCheckBox" name="checkDHCP" >
          <property name="text" >
-          <string>Wireless network profiles</string>
+          <string>O&amp;btain IP automatically (DHCP)</string>
          </property>
-         <property name="wordWrap" >
-          <bool>false</bool>
+         <property name="shortcut" >
+          <string>Alt+B</string>
          </property>
         </widget>
        </item>
@@ -662,16 +740,21 @@
  </customwidgets>
  <tabstops>
   <tabstop>tabMainWidget</tabstop>
+  <tabstop>listWifi</tabstop>
+  <tabstop>pushUp</tabstop>
+  <tabstop>pushDown</tabstop>
   <tabstop>pushAddWifi</tabstop>
+  <tabstop>pushEditWifi</tabstop>
+  <tabstop>pushRemoveWifi</tabstop>
   <tabstop>checkDHCP</tabstop>
   <tabstop>lineIP</tabstop>
   <tabstop>lineNetmask</tabstop>
+  <tabstop>checkDisableWireless</tabstop>
   <tabstop>pushOK</tabstop>
   <tabstop>pushApply</tabstop>
   <tabstop>buttonCancel</tabstop>
-  <tabstop>checkDisableWireless</tabstop>
+  <tabstop>lineMAC</tabstop>
   <tabstop>checkMAC</tabstop>
-  <tabstop>lineMAC</tabstop>
  </tabstops>
  <includes>
   <include location="local" >qmessagebox.h</include>

Modified: pcbsd/trunk/wificonfig/wifiselectiondialog.cpp
===================================================================
--- pcbsd/trunk/wificonfig/wifiselectiondialog.cpp	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk/wificonfig/wifiselectiondialog.cpp	2009-05-05 23:21:36 UTC (rev 3870)
@@ -81,6 +81,12 @@
 
     } // End of WPAEnt setting check
     
+
+    if( ! EditingSSID.isEmpty() )
+    {
+      // We are editing an existing SSID, issue delete command before adding new one
+      emit signalDeleteSSID(EditingSSID);
+    }
     
     selectedSSID = lineSSID->text();
     bool usingBSSID = checkBSSID->isChecked() ;
@@ -109,6 +115,60 @@
     close();
 }
 
+// Overloaded function which lets us set editing variables using WPA-Ent
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID, int editWPAEType, QString editWPAEIdent, QString editWPAECACert, QString editWPAEClientCert, QString editWPAEPrivKeyFile, QString editWPAEPassword)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityWPAEnt->setChecked(true);
+   WPAEType=editWPAEType; 
+   WPAEIdent=editWPAEIdent; 
+   WPAECACert=editWPAECACert; 
+   WPAEClientCert=editWPAEClientCert; 
+   WPAEPrivKeyFile=editWPAEPrivKeyFile; 
+   WPAEPassword=editWPAEPassword; 
+}
+
+// Overloaded function which lets us set editing variables using WPA-Personal
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID, QString editWPAPersonalKey)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityWPAPersonal->setChecked(true);
+   WPAPersonalKey=editWPAPersonalKey;
+}
+
+// Overloaded function which lets us set editing variables using WEP
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID, QString editWEPKey, int editWEPIndex, bool editWEPHex)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityWEP->setChecked(true);
+   WEPKey=editWEPKey;
+   WEPIndex=editWEPIndex;
+   WEPHex=editWEPHex;
+}
+
+// Overloaded function which lets us set what we are editing with no encryption
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityDisabled->setChecked(true);
+}
+
 void wifiselectiondialog::slotConfigWEP()
 {
    dialogWEP = new wepConfig();

Modified: pcbsd/trunk/wificonfig/wifiselectiondialog.h
===================================================================
--- pcbsd/trunk/wificonfig/wifiselectiondialog.h	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk/wificonfig/wifiselectiondialog.h	2009-05-05 23:21:36 UTC (rev 3870)
@@ -22,6 +22,10 @@
 
    void init(QString device);
    void scanWifi();
+   void initEdit(QString selectedSSID, bool usingBSSID);
+   void initEdit(QString selectedSSID, bool usingBSSID, QString editWEPKey, int editWEPIndex, bool editWEPHex);
+   void initEdit(QString selectedSSID, bool usingBSSID, QString editWPAPersonalKey);
+   void initEdit(QString selectedSSID, bool usingBSSID, int editWPAEType, QString editWPAEIdent, QString editWPAECACert, QString editWPAEClientCert, QString editWPAEPrivKeyFile, QString editWPAEPassword);
 
 
 public slots:
@@ -43,6 +47,7 @@
 private:
     QString DeviceName;
     QString SSID;
+    QString EditingSSID;
 
     // Setup our dialogs
     wifiscanssid *dialogWifiscanssid;
@@ -67,6 +72,7 @@
     QString WPAEPassword;
 
 signals:
+   void signalDeleteSSID(QString);
    void signalSavedOpen(QString, bool);
    void signalSavedWEP(QString, bool, QString, int, bool );
    void signalSavedWPA(QString, bool, QString);


Property changes on: pcbsd/trunk-current/wificonfig/configure.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: pcbsd/trunk-current/wificonfig/wificonfig.qrc
===================================================================
--- pcbsd/trunk-current/wificonfig/wificonfig.qrc	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk-current/wificonfig/wificonfig.qrc	2009-05-05 23:21:36 UTC (rev 3870)
@@ -1,5 +1,6 @@
 <RCC>
   <qresource>
+    <file>configure.png</file>
     <file>object-locked.png</file>
     <file>object-unlocked.png</file>
     <file>edit-delete.png</file>

Modified: pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.cpp
===================================================================
--- pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.cpp	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.cpp	2009-05-05 23:21:36 UTC (rev 3870)
@@ -81,7 +81,7 @@
        QTextStream streamout( &fileout );
 
        // Loop through all the devices we have now
-       for(int curItem=0; curItem < 149; curItem++)
+       for(int curItem=0; curItem < 145; curItem++)
        {
          if ( ! SSIDList[curItem].isEmpty() )
          {
@@ -95,6 +95,7 @@
          streamout << "network={\n ssid=\"" + SSIDList[curItem] + "\"\n";
        }
 
+       streamout << " priority=" << 145 - curItem << "\n";
        streamout << " scan_ssid=1\n";
 
        if ( SSIDEncType[curItem] == NO_ENCRYPTION )
@@ -185,7 +186,10 @@
 { 
     
   // Connect our add / remove buttons for wifi
+  connect( pushDown, SIGNAL( clicked() ), this, SLOT( slotMoveDown() ) ); 
+  connect( pushUp, SIGNAL( clicked() ), this, SLOT( slotMoveUp() ) ); 
   connect( pushAddWifi, SIGNAL( clicked() ), this, SLOT( slotAddNewProfile() ) ); 
+  connect( pushEditWifi, SIGNAL( clicked() ), this, SLOT( slotEditProfile() ) ); 
   connect( pushRemoveWifi, SIGNAL( clicked() ), this, SLOT( slotRemoveProfile() ) ); 
 
 
@@ -392,26 +396,237 @@
     return "";
 }
 
-void wificonfigwidgetbase::slotRemoveProfile()
+// Slot which moves a SSID higher in the connection priority
+void wificonfigwidgetbase::slotMoveUp()
 {
+    QString tmpString;
+    int tmpInt;
+    bool tmpBool;
+
     // Check if we have a selection to work with
     if ( listWifi->currentRow() != -1 )
     {
       // Locate the SSID we want to remove
-      QString removeSSID = listWifi->item(listWifi->currentRow())->text();
-      for ( int curItem = 0; curItem < 149; curItem++)
+      QString editSSID = listWifi->item(listWifi->currentRow())->text();
+      for ( int i = 0; i < 145; i++)
       {
-          if ( SSIDList[curItem] == removeSSID )
+          if ( SSIDList[i] == editSSID && i != 0 )
           {
-             SSIDList[curItem] = "";
+            // We found the ssid we need to move up
+            tmpString = SSIDList[i-1];
+            SSIDList[i-1] = SSIDList[i] ; 
+            SSIDList[i] = tmpString; 
+            
+            tmpInt = SSIDEncType[i-1];
+            SSIDEncType[i-1] = SSIDEncType[i];
+            SSIDEncType[i] = tmpInt;
+
+            tmpBool = BSSID[i-1];
+            BSSID[i-1] = BSSID[i];
+            BSSID[i] = tmpBool;
+
+            tmpString = WEPKey[i-1];
+            WEPKey[i-1] = WEPKey[i];
+            WEPKey[i] = tmpString;
+
+            tmpInt = WEPIndex[i-1];
+            WEPIndex[i-1] = WEPIndex[i];
+            WEPIndex[i] = tmpInt;
+
+            tmpBool = WEPHex[i-1];
+            WEPHex[i-1] = WEPHex[i];
+            WEPHex[i] = tmpBool;
+
+            tmpString = WPAPersonalKey[i-1];
+            WPAPersonalKey[i-1] = WPAPersonalKey[i];
+            WPAPersonalKey[i] = tmpString;
+
+            tmpString = WPAEIdent[i-1];
+            WPAEIdent[i-1] = WPAEIdent[i];
+            WPAEIdent[i] = tmpString;
+
+            tmpString = WPAECACert[i-1];
+            WPAECACert[i-1] = WPAECACert[i];
+            WPAECACert[i] = tmpString;
+
+            tmpString = WPAEClientCert[i-1];
+            WPAEClientCert[i-1] = WPAEClientCert[i];
+            WPAEClientCert[i] = tmpString;
+
+            tmpString = WPAEPrivKeyFile[i-1];
+            WPAEPrivKeyFile[i-1] = WPAEPrivKeyFile[i];
+            WPAEPrivKeyFile[i] = tmpString;
+
+            tmpString = WPAEPassword[i-1];
+            WPAEPassword[i-1] = WPAEPassword[i];
+            WPAEPassword[i] = tmpString;
+
+            tmpInt = WPAEType[i-1];
+            WPAEType[i-1] = WPAEType[i];
+            WPAEType[i] = tmpInt;
+            break;
           }
       }
 
       // Refresh the SSID list and enable the apply button
       slotRefreshSSIDList();
       pushApply->setEnabled(TRUE);
+    }
+}
 
+
+// Slot which moves a SSID lower in the connection priority
+void wificonfigwidgetbase::slotMoveDown()
+{
+    QString tmpString;
+    int tmpInt;
+    bool tmpBool;
+
+    // Check if we have a selection to work with
+    if ( listWifi->currentRow() != -1 )
+    {
+      // Locate the SSID we want to remove
+      QString editSSID = listWifi->item(listWifi->currentRow())->text();
+      for ( int i = 0; i < 145; i++)
+      {
+          if ( SSIDList[i] == editSSID && ! SSIDList[i+1].isEmpty())
+          {
+            // We found the ssid we need to move down
+            tmpString = SSIDList[i+1];
+            SSIDList[i+1] = SSIDList[i] ; 
+            SSIDList[i] = tmpString; 
+            
+            tmpInt = SSIDEncType[i+1];
+            SSIDEncType[i+1] = SSIDEncType[i];
+            SSIDEncType[i] = tmpInt;
+
+            tmpBool = BSSID[i+1];
+            BSSID[i+1] = BSSID[i];
+            BSSID[i] = tmpBool;
+
+            tmpString = WEPKey[i+1];
+            WEPKey[i+1] = WEPKey[i];
+            WEPKey[i] = tmpString;
+
+            tmpInt = WEPIndex[i+1];
+            WEPIndex[i+1] = WEPIndex[i];
+            WEPIndex[i] = tmpInt;
+
+            tmpBool = WEPHex[i+1];
+            WEPHex[i+1] = WEPHex[i];
+            WEPHex[i] = tmpBool;
+
+            tmpString = WPAPersonalKey[i+1];
+            WPAPersonalKey[i+1] = WPAPersonalKey[i];
+            WPAPersonalKey[i] = tmpString;
+
+            tmpString = WPAEIdent[i+1];
+            WPAEIdent[i+1] = WPAEIdent[i];
+            WPAEIdent[i] = tmpString;
+
+            tmpString = WPAECACert[i+1];
+            WPAECACert[i+1] = WPAECACert[i];
+            WPAECACert[i] = tmpString;
+
+            tmpString = WPAEClientCert[i+1];
+            WPAEClientCert[i+1] = WPAEClientCert[i];
+            WPAEClientCert[i] = tmpString;
+
+            tmpString = WPAEPrivKeyFile[i+1];
+            WPAEPrivKeyFile[i+1] = WPAEPrivKeyFile[i];
+            WPAEPrivKeyFile[i] = tmpString;
+
+            tmpString = WPAEPassword[i+1];
+            WPAEPassword[i+1] = WPAEPassword[i];
+            WPAEPassword[i] = tmpString;
+
+            tmpInt = WPAEType[i+1];
+            WPAEType[i+1] = WPAEType[i];
+            WPAEType[i] = tmpInt;
+            break;
+          }
+      }
+
+      // Refresh the SSID list and enable the apply button
+      slotRefreshSSIDList();
+      pushApply->setEnabled(TRUE);
     }
+}
+
+void wificonfigwidgetbase::slotEditProfile()
+{
+    bool foundSSID=false;
+    int curItem=0;
+
+    // Check if we have a selection to work with
+    if ( listWifi->currentRow() != -1 )
+    {
+      // Locate the SSID we want to remove
+      QString editSSID = listWifi->item(listWifi->currentRow())->text();
+      for ( int i = 0; i < 145; i++)
+      {
+          if ( SSIDList[i] == editSSID )
+          {
+            // We found the ssid we need to edit
+            foundSSID=true; 
+            curItem=i;
+            break;
+          }
+      }
+
+      // Lets go ahead and open the edit dialog on this SSID
+      if (foundSSID)
+      {
+          // Set our internal flag that this is an edit on an existing device
+          wifiselect = new wifiselectiondialog();
+          wifiselect->init(DeviceName);
+
+          // Check the type of SSID this is, and issue appropriate edit 
+          if ( SSIDEncType[curItem] == NO_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem]);
+          }
+          if ( SSIDEncType[curItem] == WEP_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem], WEPKey[curItem], WEPIndex[curItem], WEPHex[curItem]);
+          }
+          if ( SSIDEncType[curItem] == WPA_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem], WPAPersonalKey[curItem]);
+          }
+          if ( SSIDEncType[curItem] == WPAE_ENCRYPTION) {
+             wifiselect->initEdit(SSIDList[curItem], BSSID[curItem], WPAEType[curItem], WPAEIdent[curItem], WPAECACert[curItem], WPAEClientCert[curItem], WPAEPrivKeyFile[curItem], WPAEPassword[curItem]);
+          }
+
+
+          // Connect our delete signal, which runs before we add a new SSID
+          connect( wifiselect, SIGNAL( signalDeleteSSID(QString) ), this, SLOT( slotRemoveProfileSSID(QString) ) ); 
+
+          // Connect our save signals
+          connect( wifiselect, SIGNAL( signalSavedOpen(QString, bool) ), this, SLOT( slotAddNewProfileOpen(QString, bool) ) );
+          connect( wifiselect, SIGNAL( signalSavedWEP( QString, bool, QString, int, bool ) ), this, SLOT( slotAddNewProfileWEP( QString, bool, QString, int, bool) ) );
+   connect( wifiselect, SIGNAL( signalSavedWPA(QString, bool, QString) ), this, SLOT( slotAddNewProfileWPA(QString, bool, QString) ) );
+   	  connect( wifiselect, SIGNAL( signalSavedWPAE(QString, bool, int, QString, QString, QString, QString, QString) ), this, SLOT ( slotAddNewProfileWPAE(QString, bool, int, QString, QString, QString, QString, QString) ) );
+
+          wifiselect->exec();
+      }
+
+
+    }
+}
+
+
+void wificonfigwidgetbase::slotRemoveProfile()
+{
+    // Check if we have a selection to work with
+    if ( listWifi->currentRow() != -1 )
+    {
+      // Locate the SSID we want to remove
+      QString removeSSID = listWifi->item(listWifi->currentRow())->text();
+      slotRemoveProfileSSID(removeSSID);
+
+      // Refresh the SSID list and enable the apply button
+      slotRefreshSSIDList();
+      pushApply->setEnabled(TRUE);
+
+    }
   
 }
 
@@ -420,11 +635,10 @@
    wifiselect = new wifiselectiondialog();
    wifiselect->init(DeviceName);
 
+   // Connect our save slots
    connect( wifiselect, SIGNAL( signalSavedOpen(QString, bool) ), this, SLOT( slotAddNewProfileOpen(QString, bool) ) ); 
-
    connect( wifiselect, SIGNAL( signalSavedWEP( QString, bool, QString, int, bool ) ), this, SLOT( slotAddNewProfileWEP( QString, bool, QString, int, bool) ) ); 
    connect( wifiselect, SIGNAL( signalSavedWPA(QString, bool, QString) ), this, SLOT( slotAddNewProfileWPA(QString, bool, QString) ) ); 
-
    connect( wifiselect, SIGNAL( signalSavedWPAE(QString, bool, int, QString, QString, QString, QString, QString) ), this, SLOT( slotAddNewProfileWPAE(QString, bool, int, QString, QString, QString, QString, QString) ) ); 
 
    wifiselect->exec();
@@ -437,21 +651,59 @@
 	fclose(file);
 }
 
-void wificonfigwidgetbase::slotAddNewProfileOpen(QString SSID, bool isBSSID)
+void wificonfigwidgetbase::slotRemoveProfileSSID(QString RemoveSSID)
 {
+   bool foundSSID=false;
 
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   // Loop through, remove selected SSID, and move any entries after it up
+   for (int remItem = 0; remItem < 145; remItem++)
    {
+
+     if ( RemoveSSID == SSIDList[remItem] ) {
+       foundSSID=true;
+     }
+
+     if(foundSSID) 
+     {
+       SSIDList[remItem] = SSIDList[remItem+1] ; 
+       SSIDEncType[remItem] = SSIDEncType[remItem+1];
+       BSSID[remItem] = BSSID[remItem+1];
+       WEPKey[remItem] = WEPKey[remItem+1];
+       WEPIndex[remItem] = WEPIndex[remItem+1];
+       WEPHex[remItem] = WEPHex[remItem+1];
+       WPAPersonalKey[remItem] = WPAPersonalKey[remItem+1];
+       WPAEIdent[remItem] = WPAEIdent[remItem+1];
+       WPAECACert[remItem] = WPAECACert[remItem+1];
+       WPAEClientCert[remItem] = WPAEClientCert[remItem+1];
+       WPAEPrivKeyFile[remItem] = WPAEPrivKeyFile[remItem+1];
+       WPAEPassword[remItem] = WPAEPassword[remItem+1];
+       WPAEType[remItem] = WPAEType[remItem+1];
+     }
+
+     if ( SSIDList[remItem+1].isEmpty() )
+     {
+       break;
+     }
+
+   }
+
+   
+}
+
+void wificonfigwidgetbase::slotAddNewProfileOpen(QString SSID, bool isBSSID)
+{
+   for (int dupItem = 0; dupItem < 145; dupItem++)
+   {
       if ( SSID == SSIDList[dupItem] ) {
-        QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
-        return;
+          QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
+          return;
       }
    }
 
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -468,7 +720,7 @@
 
 void wificonfigwidgetbase::slotAddNewProfileWEP( QString SSID, bool isBSSID, QString newKey, int newIndex, bool hexkey )
 {
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   for (int dupItem = 0; dupItem < 145; dupItem++)
    {
       if ( SSID == SSIDList[dupItem] ) {
         QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
@@ -479,7 +731,7 @@
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -503,7 +755,7 @@
 
 void wificonfigwidgetbase::slotAddNewProfileWPA( QString SSID, bool isBSSID, QString newKey )
 {
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   for (int dupItem = 0; dupItem < 145; dupItem++)
    {
       if ( SSID == SSIDList[dupItem] ) {
         QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
@@ -513,7 +765,7 @@
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -533,7 +785,7 @@
 void wificonfigwidgetbase::slotAddNewProfileWPAE( QString SSID, bool isBSSID, int type, QString EAPIdent, QString CACert, QString ClientCert, QString PrivKeyFile, QString PrivKeyPass )
 {
 
-   for (int dupItem = 0; dupItem < 149; dupItem++)
+   for (int dupItem = 0; dupItem < 145; dupItem++)
    {
       if ( SSID == SSIDList[dupItem] ) {
         QMessageBox::warning( this, tr("Error"), tr("You already have a wireless network with this SSID! Please remove it first.\n") );
@@ -543,7 +795,7 @@
 
    int curItem=0;
 
-   while( ! SSIDList[curItem].isEmpty() && curItem < 149 )
+   while( ! SSIDList[curItem].isEmpty() && curItem < 145 )
    {
      curItem++;
    }
@@ -964,8 +1216,8 @@
 
      curItem++;
 
-     // We only need 150 wireless networks
-     if ( curItem > 149 )
+     // We only need 145 wireless networks
+     if ( curItem > 145 )
      {
 	break;
      }

Modified: pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.h
===================================================================
--- pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.h	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.h	2009-05-05 23:21:36 UTC (rev 3870)
@@ -41,7 +41,9 @@
     void slotApply();
     void slotCheckDHCPBox();
     void slotAddNewProfile();
+    void slotEditProfile();
     void slotRemoveProfile();
+    void slotRemoveProfileSSID(QString RemoveSSID);
     void slotAddNewProfileOpen( QString SSID, bool isBSSID );
     void slotAddNewProfileWEP( QString SSID, bool isBSSID, QString newKey, int newIndex, bool hexkey );
     void slotAddNewProfileWPA( QString SSID, bool isBSSID, QString newKey );
@@ -53,8 +55,9 @@
     void slotFinishLoading();
     void slotCheckGlobalText();
     void slotRefreshSSIDList();
+    void slotMoveUp();
+    void slotMoveDown();
 
-
 private:
     bool checkRange( QString IP );
     void saveValue( QString File, QString oldKey, QString newKey, int occur );

Modified: pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.ui
===================================================================
--- pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.ui	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk-current/wificonfig/wificonfigwidgetbase.ui	2009-05-05 23:21:36 UTC (rev 3870)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>348</width>
-    <height>450</height>
+    <width>320</width>
+    <height>463</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -79,12 +79,89 @@
       <attribute name="title" >
        <string>&amp;General</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_4" >
+      <layout class="QGridLayout" name="gridLayout_3" >
+       <item row="0" column="0" >
+        <widget class="QLabel" name="textLabel2" >
+         <property name="text" >
+          <string>Wireless network profiles</string>
+         </property>
+         <property name="wordWrap" >
+          <bool>false</bool>
+         </property>
+        </widget>
+       </item>
        <item row="1" column="0" >
-        <layout class="QGridLayout" name="gridLayout_3" >
+        <layout class="QGridLayout" name="gridLayout_2" >
          <item row="0" column="0" >
           <widget class="QListWidget" name="listWifi" />
          </item>
+         <item row="0" column="1" >
+          <layout class="QVBoxLayout" name="verticalLayout" >
+           <property name="sizeConstraint" >
+            <enum>QLayout::SetDefaultConstraint</enum>
+           </property>
+           <item>
+            <spacer name="verticalSpacer_2" >
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" stdset="0" >
+              <size>
+               <width>28</width>
+               <height>18</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+           <item>
+            <widget class="QPushButton" name="pushUp" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text" >
+              <string/>
+             </property>
+             <property name="icon" >
+              <iconset resource="wificonfig.qrc" >
+               <normaloff>:/arrow-up.png</normaloff>:/arrow-up.png</iconset>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <widget class="QPushButton" name="pushDown" >
+             <property name="sizePolicy" >
+              <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="text" >
+              <string/>
+             </property>
+             <property name="icon" >
+              <iconset resource="wificonfig.qrc" >
+               <normaloff>:/arrow-down.png</normaloff>:/arrow-down.png</iconset>
+             </property>
+            </widget>
+           </item>
+           <item>
+            <spacer name="verticalSpacer" >
+             <property name="orientation" >
+              <enum>Qt::Vertical</enum>
+             </property>
+             <property name="sizeHint" stdset="0" >
+              <size>
+               <width>20</width>
+               <height>40</height>
+              </size>
+             </property>
+            </spacer>
+           </item>
+          </layout>
+         </item>
         </layout>
        </item>
        <item row="2" column="0" >
@@ -104,6 +181,17 @@
           </widget>
          </item>
          <item>
+          <widget class="QPushButton" name="pushEditWifi" >
+           <property name="text" >
+            <string>Edit</string>
+           </property>
+           <property name="icon" >
+            <iconset resource="wificonfig.qrc" >
+             <normaloff>:/configure.png</normaloff>:/configure.png</iconset>
+           </property>
+          </widget>
+         </item>
+         <item>
           <widget class="QPushButton" name="pushRemoveWifi" >
            <property name="text" >
             <string>Remove</string>
@@ -129,16 +217,6 @@
          </item>
         </layout>
        </item>
-       <item row="4" column="0" >
-        <widget class="QCheckBox" name="checkDHCP" >
-         <property name="text" >
-          <string>O&amp;btain IP automatically (DHCP)</string>
-         </property>
-         <property name="shortcut" >
-          <string>Alt+B</string>
-         </property>
-        </widget>
-       </item>
        <item row="3" column="0" >
         <widget class="Line" name="line1" >
          <property name="frameShape" >
@@ -149,13 +227,13 @@
          </property>
         </widget>
        </item>
-       <item row="0" column="0" >
-        <widget class="QLabel" name="textLabel2" >
+       <item row="4" column="0" >
+        <widget class="QCheckBox" name="checkDHCP" >
          <property name="text" >
-          <string>Wireless network profiles</string>
+          <string>O&amp;btain IP automatically (DHCP)</string>
          </property>
-         <property name="wordWrap" >
-          <bool>false</bool>
+         <property name="shortcut" >
+          <string>Alt+B</string>
          </property>
         </widget>
        </item>
@@ -662,16 +740,21 @@
  </customwidgets>
  <tabstops>
   <tabstop>tabMainWidget</tabstop>
+  <tabstop>listWifi</tabstop>
+  <tabstop>pushUp</tabstop>
+  <tabstop>pushDown</tabstop>
   <tabstop>pushAddWifi</tabstop>
+  <tabstop>pushEditWifi</tabstop>
+  <tabstop>pushRemoveWifi</tabstop>
   <tabstop>checkDHCP</tabstop>
   <tabstop>lineIP</tabstop>
   <tabstop>lineNetmask</tabstop>
+  <tabstop>checkDisableWireless</tabstop>
   <tabstop>pushOK</tabstop>
   <tabstop>pushApply</tabstop>
   <tabstop>buttonCancel</tabstop>
-  <tabstop>checkDisableWireless</tabstop>
+  <tabstop>lineMAC</tabstop>
   <tabstop>checkMAC</tabstop>
-  <tabstop>lineMAC</tabstop>
  </tabstops>
  <includes>
   <include location="local" >qmessagebox.h</include>

Modified: pcbsd/trunk-current/wificonfig/wifiselectiondialog.cpp
===================================================================
--- pcbsd/trunk-current/wificonfig/wifiselectiondialog.cpp	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk-current/wificonfig/wifiselectiondialog.cpp	2009-05-05 23:21:36 UTC (rev 3870)
@@ -81,6 +81,12 @@
 
     } // End of WPAEnt setting check
     
+
+    if( ! EditingSSID.isEmpty() )
+    {
+      // We are editing an existing SSID, issue delete command before adding new one
+      emit signalDeleteSSID(EditingSSID);
+    }
     
     selectedSSID = lineSSID->text();
     bool usingBSSID = checkBSSID->isChecked() ;
@@ -109,6 +115,60 @@
     close();
 }
 
+// Overloaded function which lets us set editing variables using WPA-Ent
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID, int editWPAEType, QString editWPAEIdent, QString editWPAECACert, QString editWPAEClientCert, QString editWPAEPrivKeyFile, QString editWPAEPassword)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityWPAEnt->setChecked(true);
+   WPAEType=editWPAEType; 
+   WPAEIdent=editWPAEIdent; 
+   WPAECACert=editWPAECACert; 
+   WPAEClientCert=editWPAEClientCert; 
+   WPAEPrivKeyFile=editWPAEPrivKeyFile; 
+   WPAEPassword=editWPAEPassword; 
+}
+
+// Overloaded function which lets us set editing variables using WPA-Personal
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID, QString editWPAPersonalKey)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityWPAPersonal->setChecked(true);
+   WPAPersonalKey=editWPAPersonalKey;
+}
+
+// Overloaded function which lets us set editing variables using WEP
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID, QString editWEPKey, int editWEPIndex, bool editWEPHex)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityWEP->setChecked(true);
+   WEPKey=editWEPKey;
+   WEPIndex=editWEPIndex;
+   WEPHex=editWEPHex;
+}
+
+// Overloaded function which lets us set what we are editing with no encryption
+void wifiselectiondialog::initEdit(QString selectedSSID, bool usingBSSID)
+{
+   pushConnect->setText(tr("Save"));
+   EditingSSID=selectedSSID;
+   SSID=selectedSSID;
+   lineSSID->setText(selectedSSID);
+   checkBSSID->setChecked(usingBSSID);
+   radioSecurityDisabled->setChecked(true);
+}
+
 void wifiselectiondialog::slotConfigWEP()
 {
    dialogWEP = new wepConfig();

Modified: pcbsd/trunk-current/wificonfig/wifiselectiondialog.h
===================================================================
--- pcbsd/trunk-current/wificonfig/wifiselectiondialog.h	2009-05-05 13:46:16 UTC (rev 3869)
+++ pcbsd/trunk-current/wificonfig/wifiselectiondialog.h	2009-05-05 23:21:36 UTC (rev 3870)
@@ -22,6 +22,10 @@
 
    void init(QString device);
    void scanWifi();
+   void initEdit(QString selectedSSID, bool usingBSSID);
+   void initEdit(QString selectedSSID, bool usingBSSID, QString editWEPKey, int editWEPIndex, bool editWEPHex);
+   void initEdit(QString selectedSSID, bool usingBSSID, QString editWPAPersonalKey);
+   void initEdit(QString selectedSSID, bool usingBSSID, int editWPAEType, QString editWPAEIdent, QString editWPAECACert, QString editWPAEClientCert, QString editWPAEPrivKeyFile, QString editWPAEPassword);
 
 
 public slots:
@@ -43,6 +47,7 @@
 private:
     QString DeviceName;
     QString SSID;
+    QString EditingSSID;
 
     // Setup our dialogs
     wifiscanssid *dialogWifiscanssid;
@@ -67,6 +72,7 @@
     QString WPAEPassword;
 
 signals:
+   void signalDeleteSSID(QString);
    void signalSavedOpen(QString, bool);
    void signalSavedWEP(QString, bool, QString, int, bool );
    void signalSavedWPA(QString, bool, QString);



More information about the Commits mailing list