[PATCH 5/8]: wpa_gui-qt4: move id_str handling and add support for get/set priority

Kel Modderman kel
Wed Jan 23 04:12:12 PST 2008


Use the new priority spin box provided by the networkconfig form. Also move
the id_str handling down the bottom of add network function, to loosely
represent its position in the form itself.

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
@@ -163,11 +163,6 @@
 	setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(),
 			true);
 
-	if (idstrEdit->isEnabled())
-		setNetworkParam(id, "id_str",
-				idstrEdit->text().toAscii().constData(),
-				true);
-
 	const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
 	switch (auth) {
 	case AUTH_NONE:
@@ -249,6 +244,18 @@
 	else if (wep3Radio->isEnabled() && wep3Radio->isChecked())
 		setNetworkParam(id, "wep_tx_keyidx", "3", false);
 
+	if (idstrEdit->isEnabled())
+		setNetworkParam(id, "id_str",
+				idstrEdit->text().toAscii().constData(),
+				true);
+
+	if (prioritySpinBox->isEnabled()) {
+		QString prio;
+		prio = prio.setNum(prioritySpinBox->value());
+		setNetworkParam(id, "priority", prio.toAscii().constData(),
+				false);
+	}
+
 	snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id);
 	reply_len = sizeof(reply);
 	wpagui->ctrlRequest(cmd, reply, &reply_len);
@@ -368,17 +375,6 @@
 		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;
@@ -538,6 +534,25 @@
 		}
 	}
 
+	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 priority", network_id);
+	reply_len = sizeof(reply) - 1;
+	if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1)
+	{
+		reply[reply_len] = '\0';
+		prioritySpinBox->setValue(atoi(reply));
+	}
+
 	authSelect->setCurrentIndex(auth);
 	authChanged(auth);
 	encrSelect->setCurrentIndex(encr);
---



More information about the Hostap mailing list