[PATCH 10/14]: wpa_gui-qt4: add Remove and Remove All menu entries to Network menu

Kel Modderman kel
Mon Jan 28 23:20:12 PST 2008


Add Remove and Remove All menu entries to Network menu and connect them
to signal/slot pairs.

This adds removeSelectedNetwork() and removeAllNetworks() public slot
functions. Also modify removeNetwork() to be no-op if current combobox
selection is the special "Select Any Network" string.

Signed-off-by: Kel Modderman <kel at otaku42.de>
---
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.ui
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.ui
@@ -313,9 +313,11 @@
     </property>
     <addaction name="networkAddAction" />
     <addaction name="networkEditAction" />
+    <addaction name="networkRemoveAction" />
     <addaction name="separator" />
     <addaction name="networkEnableAllAction" />
     <addaction name="networkDisableAllAction" />
+    <addaction name="networkRemoveAllAction" />
    </widget>
    <widget class="QMenu" name="helpMenu" >
     <property name="title" >
@@ -361,6 +363,11 @@
     <string>&Edit</string>
    </property>
   </action>
+  <action name="networkRemoveAction" >
+   <property name="text" >
+    <string>&Remove</string>
+   </property>
+  </action>
   <action name="networkEnableAllAction" >
    <property name="text" >
     <string>E&nable All</string>
@@ -371,6 +378,11 @@
     <string>&Disable All</string>
    </property>
   </action>
+  <action name="networkRemoveAllAction" >
+   <property name="text" >
+    <string>Re&move All</string>
+   </property>
+  </action>
   <action name="helpContentsAction" >
    <property name="enabled" >
     <bool>false</bool>
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
@@ -42,10 +42,14 @@
 		SLOT(addNetwork()));
 	connect(networkEditAction, SIGNAL(triggered()), this,
 		SLOT(editSelectedNetwork()));
+	connect(networkRemoveAction, SIGNAL(triggered()), this,
+		SLOT(removeSelectedNetwork()));
 	connect(networkEnableAllAction, SIGNAL(triggered()), this,
 		SLOT(enableAllNetworks()));
 	connect(networkDisableAllAction, SIGNAL(triggered()), this,
 		SLOT(disableAllNetworks()));
+	connect(networkRemoveAllAction, SIGNAL(triggered()), this,
+		SLOT(removeAllNetworks()));
 	connect(helpIndexAction, SIGNAL(triggered()), this, SLOT(helpIndex()));
 	connect(helpContentsAction, SIGNAL(triggered()), this,
 		SLOT(helpContents()));
@@ -868,6 +872,10 @@
 	QString cmd(sel);
 	char reply[10];
 	size_t reply_len = sizeof(reply);
+
+	if (cmd.startsWith("Select any"))
+		return;
+
 	int pos = cmd.indexOf(':');
 	if (pos < 0) {
 		printf("Invalid removeNetwork '%s'\n",
@@ -881,6 +889,13 @@
 }
 
 
+void WpaGui::removeSelectedNetwork()
+{
+	QString sel(networkSelect->currentText());
+	removeNetwork(sel);
+}
+
+
 void WpaGui::removeListedNetwork()
 {
 	if (networkList->currentRow() < 0) {
@@ -910,6 +925,14 @@
 }
 
 
+void WpaGui::removeAllNetworks()
+{
+	char reply[10];
+	size_t reply_len = sizeof(reply);
+	ctrlRequest("REMOVE_NETWORK all", reply, &reply_len);
+}
+
+
 int WpaGui::getNetworkDisabled(const QString &sel)
 {
 	QString cmd(sel);
--- a/wpa_supplicant/wpa_gui-qt4/wpagui.h
+++ b/wpa_supplicant/wpa_gui-qt4/wpagui.h
@@ -56,10 +56,12 @@
 	virtual void selectNetwork(const QString &sel);
 	virtual void editSelectedNetwork();
 	virtual void editListedNetwork();
+	virtual void removeSelectedNetwork();
 	virtual void removeListedNetwork();
 	virtual void addNetwork();
 	virtual void enableAllNetworks();
 	virtual void disableAllNetworks();
+	virtual void removeAllNetworks();
 	virtual void saveConfig();
 	virtual void selectAdapter(const QString &sel);
 	virtual void updateNetworkDisabledStatus();
---



More information about the Hostap mailing list