[PATCH]: Add id_str input support to wpa_gui (QT4)

Kel Modderman kel
Thu Dec 27 04:50:03 PST 2007


This adds a "Network ID" field to the wpa_gui QT4 variant to support
configuration of the id_str network parameter.

It also makes similar changes to the patch that adds id_str support to
the QT3 variant.

Please note I have not tested this patch, only the one for QT3 wpa_gui, but
it looks similar enough...

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
@@ -162,6 +162,10 @@
 
 	setNetworkParam(id, "ssid", ssidEdit->text().ascii(), true);
 
+	if (idstrEdit->isEnabled())
+		setNetworkParam(id, "id_str", idstrEdit->text().ascii(),
+				true);
+
 	const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
 	switch (auth) {
 	case AUTH_NONE:
@@ -355,6 +359,17 @@
 		ssidEdit->setText(reply + 1);
 	}
 
+	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d id_str", network_id);
+	reply_len = sizeof(reply) - 1;
+	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 &&
+	    reply_len >= 2 && reply[0] == '"') {
+		reply[reply_len] = '\0';
+		pos = strchr(reply + 1, '"');
+		if (pos)
+			*pos = '\0';
+		idstrEdit->setText(reply + 1);
+	}
+
 	snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id);
 	reply_len = sizeof(reply) - 1;
 	int wpa = 0;
--- a/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
+++ b/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
@@ -9,7 +9,7 @@
         <x>0</x>
         <y>0</y>
         <width>380</width>
-        <height>413</height>
+        <height>430</height>
       </rect>
     </property>
     <property name="windowTitle" >
@@ -33,7 +33,7 @@
           </property>
           <layout class="QGridLayout" >
             <item row="0" column="0" >
-              <widget class="QLabel" name="textLabel1" >
+              <widget class="QLabel" name="textLabel0" >
                 <property name="text" >
                   <string>SSID</string>
                 </property>
@@ -50,13 +50,30 @@
               </widget>
             </item>
             <item row="1" column="0" >
+              <widget class="QLabel" name="textLabel1" >
+                <property name="text" >
+                  <string>Network ID</string>
+                </property>
+              </widget>
+            </item>
+            <item row="1" column="1" >
+              <widget class="QLineEdit" name="idstrEdit" >
+                <property name="text" >
+                  <string/>
+                </property>
+                <property name="toolTip" stdset="0" >
+                  <string>Network Identification String</string>
+                </property>
+              </widget>
+            </item>
+            <item row="2" column="0" >
               <widget class="QLabel" name="textLabel2" >
                 <property name="text" >
                   <string>Authentication</string>
                 </property>
               </widget>
             </item>
-            <item row="1" column="1" >
+            <item row="2" column="1" >
               <widget class="QComboBox" name="authSelect" >
                 <item>
                   <property name="text" >
@@ -90,14 +107,14 @@
                 </item>
               </widget>
             </item>
-            <item row="2" column="0" >
+            <item row="3" column="0" >
               <widget class="QLabel" name="textLabel3" >
                 <property name="text" >
                   <string>Encryption</string>
                 </property>
               </widget>
             </item>
-            <item row="2" column="1" >
+            <item row="3" column="1" >
               <widget class="QComboBox" name="encrSelect" >
                 <item>
                   <property name="text" >
@@ -121,14 +138,14 @@
                 </item>
               </widget>
             </item>
-            <item row="3" column="0" >
+            <item row="4" column="0" >
               <widget class="QLabel" name="textLabel4" >
                 <property name="text" >
                   <string>PSK</string>
                 </property>
               </widget>
             </item>
-            <item row="3" column="1" >
+            <item row="4" column="1" >
               <widget class="QLineEdit" name="pskEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
@@ -144,28 +161,28 @@
                 </property>
               </widget>
             </item>
-            <item row="4" column="0" >
+            <item row="5" column="0" >
               <widget class="QLabel" name="textLabel5" >
                 <property name="text" >
                   <string>EAP method</string>
                 </property>
               </widget>
             </item>
-            <item row="4" column="1" >
+            <item row="5" column="1" >
               <widget class="QComboBox" name="eapSelect" >
                 <property name="enabled" >
                   <bool>false</bool>
                 </property>
               </widget>
             </item>
-            <item row="5" column="0" >
+            <item row="6" column="0" >
               <widget class="QLabel" name="textLabel6" >
                 <property name="text" >
                   <string>Identity</string>
                 </property>
               </widget>
             </item>
-            <item row="5" column="1" >
+            <item row="6" column="1" >
               <widget class="QLineEdit" name="identityEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
@@ -175,14 +192,14 @@
                 </property>
               </widget>
             </item>
-            <item row="6" column="0" >
+            <item row="7" column="0" >
               <widget class="QLabel" name="textLabel7" >
                 <property name="text" >
                   <string>Password</string>
                 </property>
               </widget>
             </item>
-            <item row="6" column="1" >
+            <item row="7" column="1" >
               <widget class="QLineEdit" name="passwordEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
@@ -195,21 +212,21 @@
                 </property>
               </widget>
             </item>
-            <item row="7" column="0" >
+            <item row="8" column="0" >
               <widget class="QLabel" name="textLabel1_2" >
                 <property name="text" >
                   <string>CA certificate</string>
                 </property>
               </widget>
             </item>
-            <item row="7" column="1" >
+            <item row="8" column="1" >
               <widget class="QLineEdit" name="cacertEdit" >
                 <property name="enabled" >
                   <bool>false</bool>
                 </property>
               </widget>
             </item>
-            <item rowspan="1" row="8" column="0" colspan="2" >
+            <item rowspan="1" row="9" column="0" colspan="2" >
               <widget class="QGroupBox" name="buttonGroup1" >
                 <property name="enabled" >
                   <bool>true</bool>
@@ -331,6 +348,7 @@
   <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
   <tabstops>
     <tabstop>ssidEdit</tabstop>
+    <tabstop>idstrEdit</tabstop>
     <tabstop>authSelect</tabstop>
     <tabstop>encrSelect</tabstop>
     <tabstop>pskEdit</tabstop>
---




More information about the Hostap mailing list