[PATCH 11/14]: wpa_gui-qt4: allow {enable, disable, remove}Network() to accept special string "all"
Kel Modderman
kel
Mon Jan 28 23:20:54 PST 2008
Allow {enable,disable,remove}Network() to accept special string "all".
Use this ability in {enable,disable,remove}AllNetworks() functions.
Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
@@ -767,13 +767,16 @@
QString cmd(sel);
char reply[10];
size_t reply_len = sizeof(reply);
- int pos = cmd.indexOf(':');
- if (pos < 0) {
- printf("Invalid enableNetwork '%s'\n",
- cmd.toAscii().constData());
- return;
+
+ if (!cmd.startsWith("all")) {
+ int pos = cmd.indexOf(':');
+ if (pos < 0) {
+ printf("Invalid enableNetwork '%s'\n",
+ cmd.toAscii().constData());
+ return;
+ }
+ cmd.truncate(pos);
}
- cmd.truncate(pos);
cmd.prepend("ENABLE_NETWORK ");
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
}
@@ -784,13 +787,16 @@
QString cmd(sel);
char reply[10];
size_t reply_len = sizeof(reply);
- int pos = cmd.indexOf(':');
- if (pos < 0) {
- printf("Invalid disableNetwork '%s'\n",
- cmd.toAscii().constData());
- return;
+
+ if (!cmd.startsWith("all")) {
+ int pos = cmd.indexOf(':');
+ if (pos < 0) {
+ printf("Invalid disableNetwork '%s'\n",
+ cmd.toAscii().constData());
+ return;
+ }
+ cmd.truncate(pos);
}
- cmd.truncate(pos);
cmd.prepend("DISABLE_NETWORK ");
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
}
@@ -876,13 +882,15 @@
if (cmd.startsWith("Select any"))
return;
- int pos = cmd.indexOf(':');
- if (pos < 0) {
- printf("Invalid removeNetwork '%s'\n",
- cmd.toAscii().constData());
- return;
+ if (!cmd.startsWith("all")) {
+ int pos = cmd.indexOf(':');
+ if (pos < 0) {
+ printf("Invalid removeNetwork '%s'\n",
+ cmd.toAscii().constData());
+ return;
+ }
+ cmd.truncate(pos);
}
- cmd.truncate(pos);
cmd.prepend("REMOVE_NETWORK ");
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
triggerUpdate();
@@ -911,25 +919,22 @@
void WpaGui::enableAllNetworks()
{
- char reply[10];
- size_t reply_len = sizeof(reply);
- ctrlRequest("ENABLE_NETWORK all", reply, &reply_len);
+ QString sel("all");
+ enableNetwork(sel);
}
void WpaGui::disableAllNetworks()
{
- char reply[10];
- size_t reply_len = sizeof(reply);
- ctrlRequest("DISABLE_NETWORK all", reply, &reply_len);
+ QString sel("all");
+ disableNetwork(sel);
}
void WpaGui::removeAllNetworks()
{
- char reply[10];
- size_t reply_len = sizeof(reply);
- ctrlRequest("REMOVE_NETWORK all", reply, &reply_len);
+ QString sel("all");
+ removeNetwork(sel);
}
---
More information about the Hostap
mailing list