summaryrefslogtreecommitdiffstats
path: root/contrib/wpa_supplicant/wpa_gui-qt4
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2007-07-11 15:48:36 +0000
committersam <sam@FreeBSD.org>2007-07-11 15:48:36 +0000
commit35aef052ff21baa52c4cec68b512986c21f70a48 (patch)
treec3da7f33886a852f7dceb74373fbdeec49a48f77 /contrib/wpa_supplicant/wpa_gui-qt4
parent840099f34d8de1ca769f02fae379c4d8e5d6688a (diff)
downloadFreeBSD-src-35aef052ff21baa52c4cec68b512986c21f70a48.zip
FreeBSD-src-35aef052ff21baa52c4cec68b512986c21f70a48.tar.gz
Import of WPA supplicant 0.5.8
Diffstat (limited to 'contrib/wpa_supplicant/wpa_gui-qt4')
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp122
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.h63
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.ui200
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/main.cpp44
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp582
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.h58
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.ui747
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/scanresults.cpp124
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/scanresults.h47
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/scanresults.ui290
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp100
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.h46
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.ui264
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro31
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/wpagui.cpp779
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/wpagui.h76
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/wpagui.ui712
-rw-r--r--contrib/wpa_supplicant/wpa_gui-qt4/wpamsg.h42
18 files changed, 2988 insertions, 1339 deletions
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp b/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp
new file mode 100644
index 0000000..ebf3c97
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp
@@ -0,0 +1,122 @@
+/*
+ * wpa_gui - EventHistory class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include <QHeaderView>
+
+#include "eventhistory.h"
+
+
+int EventListModel::rowCount(const QModelIndex &) const
+{
+ return msgList.count();
+}
+
+
+int EventListModel::columnCount(const QModelIndex &) const
+{
+ return 2;
+}
+
+
+QVariant EventListModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (role == Qt::DisplayRole)
+ if (index.column() == 0) {
+ if (index.row() >= timeList.size())
+ return QVariant();
+ return timeList.at(index.row());
+ } else {
+ if (index.row() >= msgList.size())
+ return QVariant();
+ return msgList.at(index.row());
+ }
+ else
+ return QVariant();
+}
+
+
+QVariant EventListModel::headerData(int section, Qt::Orientation orientation,
+ int role) const
+{
+ if (role != Qt::DisplayRole)
+ return QVariant();
+
+ if (orientation == Qt::Horizontal) {
+ switch (section) {
+ case 0:
+ return QString("Timestamp");
+ case 1:
+ return QString("Message");
+ default:
+ return QVariant();
+ }
+ } else
+ return QString("%1").arg(section);
+}
+
+
+void EventListModel::addEvent(QString time, QString msg)
+{
+ beginInsertRows(QModelIndex(), msgList.size(), msgList.size() + 1);
+ timeList << time;
+ msgList << msg;
+ endInsertRows();
+}
+
+
+EventHistory::EventHistory(QWidget *parent, const char *, bool, Qt::WFlags)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+
+ elm = new EventListModel(parent);
+ eventListView->setModel(elm);
+}
+
+
+EventHistory::~EventHistory()
+{
+ destroy();
+ delete elm;
+}
+
+
+void EventHistory::languageChange()
+{
+ retranslateUi(this);
+}
+
+
+void EventHistory::addEvents(WpaMsgList msgs)
+{
+ WpaMsgList::iterator it;
+ for (it = msgs.begin(); it != msgs.end(); it++)
+ addEvent(*it);
+}
+
+
+void EventHistory::addEvent(WpaMsg msg)
+{
+ elm->addEvent(msg.getTimestamp().toString("yyyy-MM-dd hh:mm:ss.zzz"),
+ msg.getMsg());
+#if QT_VERSION >= 0x040100
+ eventListView->resizeColumnsToContents();
+ eventListView->resizeRowsToContents();
+#endif
+}
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.h b/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.h
new file mode 100644
index 0000000..40dff6d
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.h
@@ -0,0 +1,63 @@
+/*
+ * wpa_gui - EventHistory class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef EVENTHISTORY_H
+#define EVENTHISTORY_H
+
+#include <QObject>
+#include "ui_eventhistory.h"
+
+
+class EventListModel : public QAbstractTableModel
+{
+ Q_OBJECT
+
+public:
+ EventListModel(QObject *parent = 0)
+ : QAbstractTableModel(parent) {}
+
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+ int columnCount(const QModelIndex &parent = QModelIndex()) const;
+ QVariant data(const QModelIndex &index, int role) const;
+ QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const;
+ void addEvent(QString time, QString msg);
+
+private:
+ QStringList timeList;
+ QStringList msgList;
+};
+
+
+class EventHistory : public QDialog, public Ui::EventHistory
+{
+ Q_OBJECT
+
+public:
+ EventHistory(QWidget *parent = 0, const char *name = 0,
+ bool modal = false, Qt::WFlags fl = 0);
+ ~EventHistory();
+
+public slots:
+ virtual void addEvents(WpaMsgList msgs);
+ virtual void addEvent(WpaMsg msg);
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ EventListModel *elm;
+};
+
+#endif /* EVENTHISTORY_H */
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.ui b/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.ui
index 3735fb7..d47f461 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.ui
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/eventhistory.ui
@@ -1,125 +1,93 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>EventHistory</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>EventHistory</cstring>
+<ui version="4.0" stdsetdef="1" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>EventHistory</class>
+ <widget class="QDialog" name="EventHistory" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>533</width>
+ <height>285</height>
+ </rect>
</property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>533</width>
- <height>285</height>
- </rect>
+ <property name="windowTitle" >
+ <string>Event history</string>
</property>
- <property name="caption">
- <string>Event history</string>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView">
- <column>
- <property name="text">
- <string>Timestamp</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>Message</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>eventListView</cstring>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QTableView" name="eventListView" >
+ <property name="sizePolicy" >
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>7</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="selectionMode" >
+ <enum>QAbstractItemView::NoSelection</enum>
+ </property>
+ <column>
+ <property name="text" >
+ <string>Timestamp</string>
</property>
- <property name="sizePolicy">
- <sizepolicy>
- <hsizetype>7</hsizetype>
- <vsizetype>7</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <property name="clickable" >
+ <bool>true</bool>
</property>
- <property name="resizePolicy">
- <enum>Manual</enum>
+ <property name="resizable" >
+ <bool>true</bool>
</property>
- <property name="selectionMode">
- <enum>NoSelection</enum>
+ </column>
+ <column>
+ <property name="text" >
+ <string>Message</string>
</property>
- <property name="resizeMode">
- <enum>LastColumn</enum>
+ <property name="clickable" >
+ <bool>true</bool>
</property>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout30</cstring>
+ <property name="resizable" >
+ <bool>true</bool>
</property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>spacer3</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>closeButton</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- </hbox>
+ </column>
</widget>
- </vbox>
-</widget>
-<connections>
- <connection>
- <sender>closeButton</sender>
- <signal>clicked()</signal>
- <receiver>EventHistory</receiver>
- <slot>close()</slot>
- </connection>
-</connections>
-<includes>
- <include location="local" impldecl="in declaration">wpamsg.h</include>
- <include location="local" impldecl="in implementation">eventhistory.ui.h</include>
-</includes>
-<slots>
- <slot>addEvents( WpaMsgList msgs )</slot>
- <slot>addEvent( WpaMsg msg )</slot>
-</slots>
-<functions>
- <function access="private" specifier="non virtual">init()</function>
- <function access="private" specifier="non virtual">destroy()</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="spacer3" >
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType" >
+ <enum>Expanding</enum>
+ </property>
+ <property name="orientation" >
+ <enum>Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <includes>
+ <include location="local" >wpamsg.h</include>
+ </includes>
+</ui>
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/main.cpp b/contrib/wpa_supplicant/wpa_gui-qt4/main.cpp
index a78473a..eeeda39 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/main.cpp
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/main.cpp
@@ -1,30 +1,44 @@
+/*
+ * wpa_gui - Application startup
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
#ifdef CONFIG_NATIVE_WINDOWS
#include <winsock.h>
#endif /* CONFIG_NATIVE_WINDOWS */
-#include <qapplication.h>
+#include <QApplication>
#include "wpagui.h"
-int main( int argc, char ** argv )
+int main(int argc, char *argv[])
{
- QApplication a( argc, argv );
- WpaGui w;
- int ret;
+ QApplication app(argc, argv);
+ WpaGui w;
+ int ret;
#ifdef CONFIG_NATIVE_WINDOWS
- WSADATA wsaData;
- if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
- printf("Could not find a usable WinSock.dll\n");
- return -1;
- }
+ WSADATA wsaData;
+ if (WSAStartup(MAKEWORD(2, 0), &wsaData)) {
+ printf("Could not find a usable WinSock.dll\n");
+ return -1;
+ }
#endif /* CONFIG_NATIVE_WINDOWS */
- w.show();
- a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
- ret = a.exec();
+ w.show();
+ app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
+ ret = app.exec();
#ifdef CONFIG_NATIVE_WINDOWS
- WSACleanup();
+ WSACleanup();
#endif /* CONFIG_NATIVE_WINDOWS */
- return ret;
+ return ret;
}
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp b/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
new file mode 100644
index 0000000..ca86265
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp
@@ -0,0 +1,582 @@
+/*
+ * wpa_gui - NetworkConfig class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include <QMessageBox>
+
+#include "networkconfig.h"
+#include "wpagui.h"
+
+enum {
+ AUTH_NONE = 0,
+ AUTH_IEEE8021X = 1,
+ AUTH_WPA_PSK = 2,
+ AUTH_WPA_EAP = 3,
+ AUTH_WPA2_PSK = 4,
+ AUTH_WPA2_EAP = 5
+};
+
+#define WPA_GUI_KEY_DATA "[key is configured]"
+
+
+NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool, Qt::WFlags)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ connect(authSelect, SIGNAL(activated(int)), this,
+ SLOT(authChanged(int)));
+ connect(cancelButton, SIGNAL(clicked()), this, SLOT(close()));
+ connect(addButton, SIGNAL(clicked()), this, SLOT(addNetwork()));
+ connect(encrSelect, SIGNAL(activated(const QString &)), this,
+ SLOT(encrChanged(const QString &)));
+ connect(removeButton, SIGNAL(clicked()), this, SLOT(removeNetwork()));
+
+ wpagui = NULL;
+ new_network = false;
+}
+
+
+NetworkConfig::~NetworkConfig()
+{
+}
+
+
+void NetworkConfig::languageChange()
+{
+ retranslateUi(this);
+}
+
+
+void NetworkConfig::paramsFromScanResults(Q3ListViewItem *sel)
+{
+ new_network = true;
+
+ /* SSID BSSID frequency signal flags */
+ setCaption(sel->text(0));
+ ssidEdit->setText(sel->text(0));
+
+ QString flags = sel->text(4);
+ int auth, encr = 0;
+ if (flags.find("[WPA2-EAP") >= 0)
+ auth = AUTH_WPA2_EAP;
+ else if (flags.find("[WPA-EAP") >= 0)
+ auth = AUTH_WPA_EAP;
+ else if (flags.find("[WPA2-PSK") >= 0)
+ auth = AUTH_WPA2_PSK;
+ else if (flags.find("[WPA-PSK") >= 0)
+ auth = AUTH_WPA_PSK;
+ else
+ auth = AUTH_NONE;
+
+ if (flags.find("-CCMP") >= 0)
+ encr = 1;
+ else if (flags.find("-TKIP") >= 0)
+ encr = 0;
+ else if (flags.find("WEP") >= 0)
+ encr = 1;
+ else
+ encr = 0;
+
+ authSelect->setCurrentItem(auth);
+ authChanged(auth);
+ encrSelect->setCurrentItem(encr);
+
+ getEapCapa();
+}
+
+
+void NetworkConfig::authChanged(int sel)
+{
+ pskEdit->setEnabled(sel == AUTH_WPA_PSK || sel == AUTH_WPA2_PSK);
+ bool eap = sel == AUTH_IEEE8021X || sel == AUTH_WPA_EAP ||
+ sel == AUTH_WPA2_EAP;
+ eapSelect->setEnabled(eap);
+ identityEdit->setEnabled(eap);
+ passwordEdit->setEnabled(eap);
+ cacertEdit->setEnabled(eap);
+
+ while (encrSelect->count())
+ encrSelect->removeItem(0);
+
+ if (sel == AUTH_NONE || sel == AUTH_IEEE8021X) {
+ encrSelect->insertItem("None");
+ encrSelect->insertItem("WEP");
+ encrSelect->setCurrentItem(sel == AUTH_NONE ? 0 : 1);
+ } else {
+ encrSelect->insertItem("TKIP");
+ encrSelect->insertItem("CCMP");
+ encrSelect->setCurrentItem((sel == AUTH_WPA2_PSK ||
+ sel == AUTH_WPA2_EAP) ? 1 : 0);
+ }
+
+ wepEnabled(sel == AUTH_IEEE8021X);
+}
+
+
+void NetworkConfig::addNetwork()
+{
+ char reply[10], cmd[256];
+ size_t reply_len;
+ int id;
+ int psklen = pskEdit->text().length();
+ int auth = authSelect->currentItem();
+
+ if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
+ if (psklen < 8 || psklen > 64) {
+ QMessageBox::warning(this, "wpa_gui",
+ "WPA-PSK requires a passphrase "
+ "of 8 to 63 characters\n"
+ "or 64 hex digit PSK");
+ return;
+ }
+ }
+
+ if (wpagui == NULL)
+ return;
+
+ memset(reply, 0, sizeof(reply));
+ reply_len = sizeof(reply) - 1;
+
+ if (new_network) {
+ wpagui->ctrlRequest("ADD_NETWORK", reply, &reply_len);
+ if (reply[0] == 'F') {
+ QMessageBox::warning(this, "wpa_gui", "Failed to add "
+ "network to wpa_supplicant\n"
+ "configuration.");
+ return;
+ }
+ id = atoi(reply);
+ } else
+ id = edit_network_id;
+
+ setNetworkParam(id, "ssid", ssidEdit->text().ascii(), true);
+
+ char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
+ switch (auth) {
+ case AUTH_NONE:
+ key_mgmt = "NONE";
+ break;
+ case AUTH_IEEE8021X:
+ key_mgmt = "IEEE8021X";
+ break;
+ case AUTH_WPA_PSK:
+ key_mgmt = "WPA-PSK";
+ proto = "WPA";
+ break;
+ case AUTH_WPA_EAP:
+ key_mgmt = "WPA-EAP";
+ proto = "WPA";
+ break;
+ case AUTH_WPA2_PSK:
+ key_mgmt = "WPA-PSK";
+ proto = "WPA2";
+ break;
+ case AUTH_WPA2_EAP:
+ key_mgmt = "WPA-EAP";
+ proto = "WPA2";
+ break;
+ }
+
+ if (auth == AUTH_WPA_PSK || auth == AUTH_WPA_EAP ||
+ auth == AUTH_WPA2_PSK || auth == AUTH_WPA2_EAP) {
+ int encr = encrSelect->currentItem();
+ if (encr == 0)
+ pairwise = "TKIP";
+ else
+ pairwise = "CCMP";
+ }
+
+ if (proto)
+ setNetworkParam(id, "proto", proto, false);
+ if (key_mgmt)
+ setNetworkParam(id, "key_mgmt", key_mgmt, false);
+ if (pairwise) {
+ setNetworkParam(id, "pairwise", pairwise, false);
+ setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false);
+ }
+ if (pskEdit->isEnabled() &&
+ strcmp(passwordEdit->text().ascii(), WPA_GUI_KEY_DATA) != 0)
+ setNetworkParam(id, "psk", pskEdit->text().ascii(),
+ psklen != 64);
+ if (eapSelect->isEnabled())
+ setNetworkParam(id, "eap", eapSelect->currentText().ascii(),
+ false);
+ if (identityEdit->isEnabled())
+ setNetworkParam(id, "identity", identityEdit->text().ascii(),
+ true);
+ if (passwordEdit->isEnabled() &&
+ strcmp(passwordEdit->text().ascii(), WPA_GUI_KEY_DATA) != 0)
+ setNetworkParam(id, "password", passwordEdit->text().ascii(),
+ true);
+ if (cacertEdit->isEnabled())
+ setNetworkParam(id, "ca_cert", cacertEdit->text().ascii(),
+ true);
+ writeWepKey(id, wep0Edit, 0);
+ writeWepKey(id, wep1Edit, 1);
+ writeWepKey(id, wep2Edit, 2);
+ writeWepKey(id, wep3Edit, 3);
+
+ if (wep0Radio->isEnabled() && wep0Radio->isChecked())
+ setNetworkParam(id, "wep_tx_keyidx", "0", false);
+ else if (wep1Radio->isEnabled() && wep1Radio->isChecked())
+ setNetworkParam(id, "wep_tx_keyidx", "1", false);
+ else if (wep2Radio->isEnabled() && wep2Radio->isChecked())
+ setNetworkParam(id, "wep_tx_keyidx", "2", false);
+ else if (wep3Radio->isEnabled() && wep3Radio->isChecked())
+ setNetworkParam(id, "wep_tx_keyidx", "3", false);
+
+ snprintf(cmd, sizeof(cmd), "ENABLE_NETWORK %d", id);
+ reply_len = sizeof(reply);
+ wpagui->ctrlRequest(cmd, reply, &reply_len);
+ if (strncmp(reply, "OK", 2) != 0) {
+ QMessageBox::warning(this, "wpa_gui", "Failed to enable "
+ "network in wpa_supplicant\n"
+ "configuration.");
+ /* Network was added, so continue anyway */
+ }
+ wpagui->triggerUpdate();
+ wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);
+
+ close();
+}
+
+
+void NetworkConfig::setWpaGui(WpaGui *_wpagui)
+{
+ wpagui = _wpagui;
+}
+
+
+int NetworkConfig::setNetworkParam(int id, const char *field,
+ const char *value, bool quote)
+{
+ char reply[10], cmd[256];
+ size_t reply_len;
+ snprintf(cmd, sizeof(cmd), "SET_NETWORK %d %s %s%s%s",
+ id, field, quote ? "\"" : "", value, quote ? "\"" : "");
+ reply_len = sizeof(reply);
+ wpagui->ctrlRequest(cmd, reply, &reply_len);
+ return strncmp(reply, "OK", 2) == 0 ? 0 : -1;
+}
+
+
+void NetworkConfig::encrChanged(const QString &sel)
+{
+ wepEnabled(sel.find("WEP") == 0);
+}
+
+
+void NetworkConfig::wepEnabled(bool enabled)
+{
+ wep0Edit->setEnabled(enabled);
+ wep1Edit->setEnabled(enabled);
+ wep2Edit->setEnabled(enabled);
+ wep3Edit->setEnabled(enabled);
+ wep0Radio->setEnabled(enabled);
+ wep1Radio->setEnabled(enabled);
+ wep2Radio->setEnabled(enabled);
+ wep3Radio->setEnabled(enabled);
+}
+
+
+void NetworkConfig::writeWepKey(int network_id, QLineEdit *edit, int id)
+{
+ char buf[10];
+ bool hex;
+ const char *txt, *pos;
+ size_t len;
+
+ if (!edit->isEnabled() || edit->text().isEmpty())
+ return;
+
+ /*
+ * Assume hex key if only hex characters are present and length matches
+ * with 40, 104, or 128-bit key
+ */
+ txt = edit->text().ascii();
+ if (strcmp(txt, WPA_GUI_KEY_DATA) == 0)
+ return;
+ len = strlen(txt);
+ if (len == 0)
+ return;
+ pos = txt;
+ hex = true;
+ while (*pos) {
+ if (!((*pos >= '0' && *pos <= '9') ||
+ (*pos >= 'a' && *pos <= 'f') ||
+ (*pos >= 'A' && *pos <= 'F'))) {
+ hex = false;
+ break;
+ }
+ pos++;
+ }
+ if (hex && len != 10 && len != 26 && len != 32)
+ hex = false;
+ snprintf(buf, sizeof(buf), "wep_key%d", id);
+ setNetworkParam(network_id, buf, txt, !hex);
+}
+
+
+static int key_value_isset(const char *reply, size_t reply_len)
+{
+ return reply_len > 0 && (reply_len < 4 || memcmp(reply, "FAIL", 4) != 0);
+}
+
+
+void NetworkConfig::paramsFromConfig(int network_id)
+{
+ int i, res;
+
+ edit_network_id = network_id;
+ getEapCapa();
+
+ char reply[1024], cmd[256], *pos;
+ size_t reply_len;
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ssid", 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';
+ ssidEdit->setText(reply + 1);
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d proto", network_id);
+ reply_len = sizeof(reply) - 1;
+ int wpa = 0;
+ if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
+ reply[reply_len] = '\0';
+ if (strstr(reply, "RSN") || strstr(reply, "WPA2"))
+ wpa = 2;
+ else if (strstr(reply, "WPA"))
+ wpa = 1;
+ }
+
+ int auth = AUTH_NONE, encr = 0;
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d key_mgmt", network_id);
+ reply_len = sizeof(reply) - 1;
+ if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
+ reply[reply_len] = '\0';
+ if (strstr(reply, "WPA-EAP"))
+ auth = wpa & 2 ? AUTH_WPA2_EAP : AUTH_WPA_EAP;
+ else if (strstr(reply, "WPA-PSK"))
+ auth = wpa & 2 ? AUTH_WPA2_PSK : AUTH_WPA_PSK;
+ else if (strstr(reply, "IEEE8021X")) {
+ auth = AUTH_IEEE8021X;
+ encr = 1;
+ }
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d pairwise", network_id);
+ reply_len = sizeof(reply) - 1;
+ if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0) {
+ reply[reply_len] = '\0';
+ if (strstr(reply, "CCMP"))
+ encr = 1;
+ else if (strstr(reply, "TKIP"))
+ encr = 0;
+ else if (strstr(reply, "WEP"))
+ encr = 1;
+ else
+ encr = 0;
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d psk", network_id);
+ reply_len = sizeof(reply) - 1;
+ res = wpagui->ctrlRequest(cmd, reply, &reply_len);
+ if (res >= 0 && reply_len >= 2 && reply[0] == '"') {
+ reply[reply_len] = '\0';
+ pos = strchr(reply + 1, '"');
+ if (pos)
+ *pos = '\0';
+ pskEdit->setText(reply + 1);
+ } else if (res >= 0 && key_value_isset(reply, reply_len)) {
+ pskEdit->setText(WPA_GUI_KEY_DATA);
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d identity", 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';
+ identityEdit->setText(reply + 1);
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d password", network_id);
+ reply_len = sizeof(reply) - 1;
+ res = wpagui->ctrlRequest(cmd, reply, &reply_len);
+ if (res >= 0 && reply_len >= 2 && reply[0] == '"') {
+ reply[reply_len] = '\0';
+ pos = strchr(reply + 1, '"');
+ if (pos)
+ *pos = '\0';
+ passwordEdit->setText(reply + 1);
+ } else if (res >= 0 && key_value_isset(reply, reply_len)) {
+ passwordEdit->setText(WPA_GUI_KEY_DATA);
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d ca_cert", 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';
+ cacertEdit->setText(reply + 1);
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d eap", network_id);
+ reply_len = sizeof(reply) - 1;
+ if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 &&
+ reply_len >= 1) {
+ reply[reply_len] = '\0';
+ for (i = 0; i < eapSelect->count(); i++) {
+ if (eapSelect->text(i).compare(reply) == 0) {
+ eapSelect->setCurrentItem(i);
+ break;
+ }
+ }
+ }
+
+ for (i = 0; i < 4; i++) {
+ QLineEdit *wepEdit;
+ switch (i) {
+ default:
+ case 0:
+ wepEdit = wep0Edit;
+ break;
+ case 1:
+ wepEdit = wep1Edit;
+ break;
+ case 2:
+ wepEdit = wep2Edit;
+ break;
+ case 3:
+ wepEdit = wep3Edit;
+ break;
+ }
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_key%d",
+ network_id, i);
+ reply_len = sizeof(reply) - 1;
+ res = wpagui->ctrlRequest(cmd, reply, &reply_len);
+ if (res >= 0 && reply_len >= 2 && reply[0] == '"') {
+ reply[reply_len] = '\0';
+ pos = strchr(reply + 1, '"');
+ if (pos)
+ *pos = '\0';
+ if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
+ encr = 1;
+
+ wepEdit->setText(reply + 1);
+ } else if (res >= 0 && key_value_isset(reply, reply_len)) {
+ if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
+ encr = 1;
+ wepEdit->setText(WPA_GUI_KEY_DATA);
+ }
+ }
+
+ snprintf(cmd, sizeof(cmd), "GET_NETWORK %d wep_tx_keyidx", network_id);
+ reply_len = sizeof(reply) - 1;
+ if (wpagui->ctrlRequest(cmd, reply, &reply_len) >= 0 && reply_len >= 1)
+ {
+ reply[reply_len] = '\0';
+ switch (atoi(reply)) {
+ case 0:
+ wep0Radio->setChecked(true);
+ break;
+ case 1:
+ wep1Radio->setChecked(true);
+ break;
+ case 2:
+ wep2Radio->setChecked(true);
+ break;
+ case 3:
+ wep3Radio->setChecked(true);
+ break;
+ }
+ }
+
+ authSelect->setCurrentItem(auth);
+ authChanged(auth);
+ encrSelect->setCurrentItem(encr);
+ if (auth == AUTH_NONE || auth == AUTH_IEEE8021X)
+ wepEnabled(encr == 1);
+
+ removeButton->setEnabled(true);
+ addButton->setText("Save");
+}
+
+
+void NetworkConfig::removeNetwork()
+{
+ char reply[10], cmd[256];
+ size_t reply_len;
+
+ if (QMessageBox::information(this, "wpa_gui",
+ "This will permanently remove the "
+ "network\n"
+ "from the configuration. Do you really "
+ "want\n"
+ "to remove this network?", "Yes", "No")
+ != 0)
+ return;
+
+ snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id);
+ reply_len = sizeof(reply);
+ wpagui->ctrlRequest(cmd, reply, &reply_len);
+ if (strncmp(reply, "OK", 2) != 0) {
+ QMessageBox::warning(this, "wpa_gui",
+ "Failed to remove network from "
+ "wpa_supplicant\n"
+ "configuration.");
+ } else {
+ wpagui->triggerUpdate();
+ wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);
+ }
+
+ close();
+}
+
+
+void NetworkConfig::newNetwork()
+{
+ new_network = true;
+ getEapCapa();
+}
+
+
+void NetworkConfig::getEapCapa()
+{
+ char reply[256];
+ size_t reply_len;
+
+ if (wpagui == NULL)
+ return;
+
+ reply_len = sizeof(reply) - 1;
+ if (wpagui->ctrlRequest("GET_CAPABILITY eap", reply, &reply_len) < 0)
+ return;
+ reply[reply_len] = '\0';
+
+ QString res(reply);
+ QStringList types = QStringList::split(QChar(' '), res);
+ eapSelect->insertStringList(types);
+}
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.h b/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.h
new file mode 100644
index 0000000..5a12d70
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.h
@@ -0,0 +1,58 @@
+/*
+ * wpa_gui - NetworkConfig class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef NETWORKCONFIG_H
+#define NETWORKCONFIG_H
+
+#include <QObject>
+#include "ui_networkconfig.h"
+
+class WpaGui;
+
+class NetworkConfig : public QDialog, public Ui::NetworkConfig
+{
+ Q_OBJECT
+
+public:
+ NetworkConfig(QWidget *parent = 0, const char *name = 0,
+ bool modal = false, Qt::WFlags fl = 0);
+ ~NetworkConfig();
+
+ virtual void paramsFromScanResults(Q3ListViewItem *sel);
+ virtual void setWpaGui(WpaGui *_wpagui);
+ virtual int setNetworkParam(int id, const char *field,
+ const char *value, bool quote);
+ virtual void paramsFromConfig(int network_id);
+ virtual void newNetwork();
+
+public slots:
+ virtual void authChanged(int sel);
+ virtual void addNetwork();
+ virtual void encrChanged(const QString &sel);
+ virtual void writeWepKey(int network_id, QLineEdit *edit, int id);
+ virtual void removeNetwork();
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ WpaGui *wpagui;
+ int edit_network_id;
+ bool new_network;
+
+ virtual void wepEnabled(bool enabled);
+ virtual void getEapCapa();
+};
+
+#endif /* NETWORKCONFIG_H */
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.ui b/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
index 1f98372..6b15da4 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/networkconfig.ui
@@ -1,404 +1,335 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>NetworkConfig</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>NetworkConfig</cstring>
+<ui version="4.0" stdsetdef="1" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>NetworkConfig</class>
+ <widget class="QDialog" name="NetworkConfig" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>380</width>
+ <height>413</height>
+ </rect>
</property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>380</width>
- <height>413</height>
- </rect>
+ <property name="windowTitle" >
+ <string>NetworkConfig</string>
</property>
- <property name="caption">
- <string>NetworkConfig</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QPushButton" row="1" column="3">
- <property name="name">
- <cstring>cancelButton</cstring>
- </property>
- <property name="text">
- <string>Cancel</string>
- </property>
+ <layout class="QGridLayout" >
+ <item row="1" column="3" >
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
</widget>
- <widget class="QFrame" row="0" column="0" rowspan="1" colspan="4">
- <property name="name">
- <cstring>frame9</cstring>
- </property>
- <property name="frameShape">
- <enum>StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>Raised</enum>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
+ </item>
+ <item rowspan="1" row="0" column="0" colspan="4" >
+ <widget class="QFrame" name="frame9" >
+ <property name="frameShape" >
+ <enum>StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>Raised</enum>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="text" >
+ <string>SSID</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="ssidEdit" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="toolTip" stdset="0" >
+ <string>Network name (Service Set IDentifier)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="textLabel2" >
+ <property name="text" >
+ <string>Authentication</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QComboBox" name="authSelect" >
+ <item>
+ <property name="text" >
+ <string>Plaintext or static WEP</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>IEEE 802.1X</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>WPA-Personal (PSK)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>WPA-Enterprise (EAP)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>WPA2-Personal (PSK)</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>WPA2-Enterprise (EAP)</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="textLabel3" >
+ <property name="text" >
+ <string>Encryption</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QComboBox" name="encrSelect" >
+ <item>
+ <property name="text" >
+ <string>None</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>WEP</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>TKIP</string>
+ </property>
+ </item>
+ <item>
+ <property name="text" >
+ <string>CCMP</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="textLabel4" >
+ <property name="text" >
+ <string>PSK</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="pskEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="echoMode" >
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="toolTip" stdset="0" >
+ <string>WPA/WPA2 pre-shared key or passphrase</string>
+ </property>
+ <property name="whatsThis" stdset="0" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="textLabel5" >
+ <property name="text" >
+ <string>EAP method</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QComboBox" name="eapSelect" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="textLabel6" >
+ <property name="text" >
+ <string>Identity</string>
</property>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>SSID</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="0" column="1">
- <property name="name">
- <cstring>ssidEdit</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
- <property name="toolTip" stdset="0">
- <string>Network name (Service Set IDentifier)</string>
- </property>
- </widget>
- <widget class="QLabel" row="1" column="0">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Authentication</string>
- </property>
- </widget>
- <widget class="QComboBox" row="1" column="1">
- <item>
- <property name="text">
- <string>Plaintext or static WEP</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>IEEE 802.1X</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>WPA-Personal (PSK)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>WPA-Enterprise (EAP)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>WPA2-Personal (PSK)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>WPA2-Enterprise (EAP)</string>
- </property>
- </item>
- <property name="name">
- <cstring>authSelect</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="2" column="0">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>Encryption</string>
- </property>
- </widget>
- <widget class="QComboBox" row="2" column="1">
- <item>
- <property name="text">
- <string>None</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>WEP</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>TKIP</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>CCMP</string>
- </property>
- </item>
- <property name="name">
- <cstring>encrSelect</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="3" column="0">
- <property name="name">
- <cstring>textLabel4</cstring>
- </property>
- <property name="text">
- <string>PSK</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="3" column="1">
- <property name="name">
- <cstring>pskEdit</cstring>
- </property>
- <property name="enabled">
+ </widget>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QLineEdit" name="identityEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" stdset="0" >
+ <string>Username/Identity for EAP methods</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QLabel" name="textLabel7" >
+ <property name="text" >
+ <string>Password</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1" >
+ <widget class="QLineEdit" name="passwordEdit" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="echoMode" >
+ <enum>QLineEdit::Password</enum>
+ </property>
+ <property name="toolTip" stdset="0" >
+ <string>Password for EAP methods</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="0" >
+ <widget class="QLabel" name="textLabel1_2" >
+ <property name="text" >
+ <string>CA certificate</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" 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" >
+ <widget class="QGroupBox" name="buttonGroup1" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="title" >
+ <string>WEP keys</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QRadioButton" name="wep0Radio" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>key 0</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QRadioButton" name="wep1Radio" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>key 1</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QRadioButton" name="wep3Radio" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>key 3</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QRadioButton" name="wep2Radio" >
+ <property name="enabled" >
<bool>false</bool>
- </property>
- <property name="echoMode">
- <enum>Password</enum>
- </property>
- <property name="toolTip" stdset="0">
- <string>WPA/WPA2 pre-shared key or passphrase</string>
- </property>
- <property name="whatsThis" stdset="0">
- <string></string>
- </property>
- </widget>
- <widget class="QLabel" row="4" column="0">
- <property name="name">
- <cstring>textLabel5</cstring>
- </property>
- <property name="text">
- <string>EAP method</string>
- </property>
- </widget>
- <widget class="QComboBox" row="4" column="1">
- <property name="name">
- <cstring>eapSelect</cstring>
- </property>
- <property name="enabled">
+ </property>
+ <property name="text" >
+ <string>key 2</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="wep0Edit" >
+ <property name="enabled" >
<bool>false</bool>
- </property>
- </widget>
- <widget class="QLabel" row="5" column="0">
- <property name="name">
- <cstring>textLabel6</cstring>
- </property>
- <property name="text">
- <string>Identity</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="5" column="1">
- <property name="name">
- <cstring>identityEdit</cstring>
- </property>
- <property name="enabled">
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="wep1Edit" >
+ <property name="enabled" >
<bool>false</bool>
- </property>
- <property name="toolTip" stdset="0">
- <string>Username/Identity for EAP methods</string>
- </property>
- </widget>
- <widget class="QLabel" row="6" column="0">
- <property name="name">
- <cstring>textLabel7</cstring>
- </property>
- <property name="text">
- <string>Password</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="6" column="1">
- <property name="name">
- <cstring>passwordEdit</cstring>
- </property>
- <property name="enabled">
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLineEdit" name="wep2Edit" >
+ <property name="enabled" >
<bool>false</bool>
- </property>
- <property name="echoMode">
- <enum>Password</enum>
- </property>
- <property name="toolTip" stdset="0">
- <string>Password for EAP methods</string>
- </property>
- </widget>
- <widget class="QLabel" row="7" column="0">
- <property name="name">
- <cstring>textLabel1_2</cstring>
- </property>
- <property name="text">
- <string>CA certificate</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="7" column="1">
- <property name="name">
- <cstring>cacertEdit</cstring>
- </property>
- <property name="enabled">
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLineEdit" name="wep3Edit" >
+ <property name="enabled" >
<bool>false</bool>
- </property>
- </widget>
- <widget class="QButtonGroup" row="8" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>buttonGroup1</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="title">
- <string>WEP keys</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QRadioButton" row="0" column="0">
- <property name="name">
- <cstring>wep0Radio</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>key 0</string>
- </property>
- </widget>
- <widget class="QRadioButton" row="1" column="0">
- <property name="name">
- <cstring>wep1Radio</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>key 1</string>
- </property>
- </widget>
- <widget class="QRadioButton" row="3" column="0">
- <property name="name">
- <cstring>wep3Radio</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>key 3</string>
- </property>
- </widget>
- <widget class="QRadioButton" row="2" column="0">
- <property name="name">
- <cstring>wep2Radio</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>key 2</string>
- </property>
- </widget>
- <widget class="QLineEdit" row="0" column="1">
- <property name="name">
- <cstring>wep0Edit</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QLineEdit" row="1" column="1">
- <property name="name">
- <cstring>wep1Edit</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QLineEdit" row="2" column="1">
- <property name="name">
- <cstring>wep2Edit</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- <widget class="QLineEdit" row="3" column="1">
- <property name="name">
- <cstring>wep3Edit</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- </widget>
- </grid>
- </widget>
- </grid>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
</widget>
- <spacer row="1" column="0">
- <property name="name">
- <cstring>spacer5</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>130</width>
- <height>20</height>
- </size>
- </property>
+ </item>
+ <item row="1" column="0" >
+ <spacer name="spacer5" >
+ <property name="sizeHint" >
+ <size>
+ <width>130</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType" >
+ <enum>Expanding</enum>
+ </property>
+ <property name="orientation" >
+ <enum>Horizontal</enum>
+ </property>
</spacer>
- <widget class="QPushButton" row="1" column="1">
- <property name="name">
- <cstring>addButton</cstring>
- </property>
- <property name="text">
- <string>Add</string>
- </property>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="addButton" >
+ <property name="text" >
+ <string>Add</string>
+ </property>
</widget>
- <widget class="QPushButton" row="1" column="2">
- <property name="name">
- <cstring>removeButton</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Remove</string>
- </property>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="removeButton" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="text" >
+ <string>Remove</string>
+ </property>
</widget>
- </grid>
-</widget>
-<connections>
- <connection>
- <sender>authSelect</sender>
- <signal>activated(int)</signal>
- <receiver>NetworkConfig</receiver>
- <slot>authChanged(int)</slot>
- </connection>
- <connection>
- <sender>cancelButton</sender>
- <signal>clicked()</signal>
- <receiver>NetworkConfig</receiver>
- <slot>close()</slot>
- </connection>
- <connection>
- <sender>addButton</sender>
- <signal>clicked()</signal>
- <receiver>NetworkConfig</receiver>
- <slot>addNetwork()</slot>
- </connection>
- <connection>
- <sender>encrSelect</sender>
- <signal>activated(const QString&amp;)</signal>
- <receiver>NetworkConfig</receiver>
- <slot>encrChanged(const QString&amp;)</slot>
- </connection>
- <connection>
- <sender>removeButton</sender>
- <signal>clicked()</signal>
- <receiver>NetworkConfig</receiver>
- <slot>removeNetwork()</slot>
- </connection>
-</connections>
-<tabstops>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <tabstops>
<tabstop>ssidEdit</tabstop>
<tabstop>authSelect</tabstop>
<tabstop>encrSelect</tabstop>
@@ -418,38 +349,8 @@
<tabstop>addButton</tabstop>
<tabstop>removeButton</tabstop>
<tabstop>cancelButton</tabstop>
-</tabstops>
-<includes>
- <include location="global" impldecl="in declaration">qlistview.h</include>
- <include location="global" impldecl="in implementation">qmessagebox.h</include>
- <include location="local" impldecl="in implementation">wpagui.h</include>
- <include location="local" impldecl="in implementation">networkconfig.ui.h</include>
-</includes>
-<forwards>
- <forward>class WpaGui;</forward>
-</forwards>
-<variables>
- <variable access="private">WpaGui *wpagui;</variable>
- <variable access="private">int edit_network_id;</variable>
- <variable access="private">bool new_network;</variable>
-</variables>
-<slots>
- <slot>authChanged( int sel )</slot>
- <slot>addNetwork()</slot>
- <slot>encrChanged( const QString &amp; sel )</slot>
- <slot>writeWepKey( int network_id, QLineEdit * edit, int id )</slot>
- <slot>removeNetwork()</slot>
-</slots>
-<functions>
- <function access="private" specifier="non virtual">init()</function>
- <function>paramsFromScanResults( QListViewItem * sel )</function>
- <function>setWpaGui( WpaGui * _wpagui )</function>
- <function returnType="int">setNetworkParam( int id, const char * field, const char * value, bool quote )</function>
- <function access="private">wepEnabled( bool enabled )</function>
- <function>paramsFromConfig( int network_id )</function>
- <function>newNetwork()</function>
- <function access="private">getEapCapa()</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </tabstops>
+ <includes>
+ <include location="global" >q3listview.h</include>
+ </includes>
+</ui>
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.cpp b/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
new file mode 100644
index 0000000..57cf716
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.cpp
@@ -0,0 +1,124 @@
+/*
+ * wpa_gui - ScanResults class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include <QTimer>
+
+#include "scanresults.h"
+#include "wpagui.h"
+#include "networkconfig.h"
+
+
+ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
+ connect(scanButton, SIGNAL(clicked()), this, SLOT(scanRequest()));
+ connect(scanResultsView, SIGNAL(doubleClicked(Q3ListViewItem *)), this,
+ SLOT(bssSelected(Q3ListViewItem *)));
+
+ wpagui = NULL;
+}
+
+
+ScanResults::~ScanResults()
+{
+ delete timer;
+}
+
+
+void ScanResults::languageChange()
+{
+ retranslateUi(this);
+}
+
+
+void ScanResults::setWpaGui(WpaGui *_wpagui)
+{
+ wpagui = _wpagui;
+ updateResults();
+
+ timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), SLOT(getResults()));
+ timer->start(10000, FALSE);
+}
+
+
+void ScanResults::updateResults()
+{
+ char reply[8192];
+ size_t reply_len;
+
+ if (wpagui == NULL)
+ return;
+
+ reply_len = sizeof(reply) - 1;
+ if (wpagui->ctrlRequest("SCAN_RESULTS", reply, &reply_len) < 0)
+ return;
+ reply[reply_len] = '\0';
+
+ scanResultsView->clear();
+
+ QString res(reply);
+ QStringList lines = QStringList::split(QChar('\n'), res);
+ bool first = true;
+ for (QStringList::Iterator it = lines.begin(); it != lines.end(); it++)
+ {
+ if (first) {
+ first = false;
+ continue;
+ }
+
+ QStringList cols = QStringList::split(QChar('\t'), *it, true);
+ QString ssid, bssid, freq, signal, flags;
+ bssid = cols.count() > 0 ? cols[0] : "";
+ freq = cols.count() > 1 ? cols[1] : "";
+ signal = cols.count() > 2 ? cols[2] : "";
+ flags = cols.count() > 3 ? cols[3] : "";
+ ssid = cols.count() > 4 ? cols[4] : "";
+ new Q3ListViewItem(scanResultsView, ssid, bssid, freq, signal,
+ flags);
+ }
+}
+
+
+void ScanResults::scanRequest()
+{
+ char reply[10];
+ size_t reply_len = sizeof(reply);
+
+ if (wpagui == NULL)
+ return;
+
+ wpagui->ctrlRequest("SCAN", reply, &reply_len);
+}
+
+
+void ScanResults::getResults()
+{
+ updateResults();
+}
+
+
+void ScanResults::bssSelected( Q3ListViewItem * sel )
+{
+ NetworkConfig *nc = new NetworkConfig();
+ if (nc == NULL)
+ return;
+ nc->setWpaGui(wpagui);
+ nc->paramsFromScanResults(sel);
+ nc->show();
+ nc->exec();
+}
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.h b/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.h
new file mode 100644
index 0000000..22b54c9
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.h
@@ -0,0 +1,47 @@
+/*
+ * wpa_gui - ScanResults class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef SCANRESULTS_H
+#define SCANRESULTS_H
+
+#include <QObject>
+#include "ui_scanresults.h"
+
+class WpaGui;
+
+class ScanResults : public QDialog, public Ui::ScanResults
+{
+ Q_OBJECT
+
+public:
+ ScanResults(QWidget *parent = 0, const char *name = 0,
+ bool modal = false, Qt::WFlags fl = 0);
+ ~ScanResults();
+
+public slots:
+ virtual void setWpaGui(WpaGui *_wpagui);
+ virtual void updateResults();
+ virtual void scanRequest();
+ virtual void getResults();
+ virtual void bssSelected(Q3ListViewItem *sel);
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ WpaGui *wpagui;
+ QTimer *timer;
+};
+
+#endif /* SCANRESULTS_H */
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.ui b/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.ui
index 66c8b4b..4a49b05 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.ui
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/scanresults.ui
@@ -1,179 +1,125 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>ScanResults</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>ScanResults</cstring>
+<ui version="4.0" stdsetdef="1" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>ScanResults</class>
+ <widget class="QDialog" name="ScanResults" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>452</width>
+ <height>225</height>
+ </rect>
</property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>452</width>
- <height>225</height>
- </rect>
+ <property name="windowTitle" >
+ <string>Scan results</string>
</property>
- <property name="caption">
- <string>Scan results</string>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QListView">
- <column>
- <property name="text">
- <string>SSID</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>BSSID</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>frequency</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>signal</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <column>
- <property name="text">
- <string>flags</string>
- </property>
- <property name="clickable">
- <bool>true</bool>
- </property>
- <property name="resizable">
- <bool>true</bool>
- </property>
- </column>
- <property name="name">
- <cstring>scanResultsView</cstring>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="Q3ListView" name="scanResultsView" >
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Sunken</enum>
+ </property>
+ <column>
+ <property name="text" >
+ <string>SSID</string>
</property>
- <property name="frameShape">
- <enum>StyledPanel</enum>
+ <property name="clickable" >
+ <bool>true</bool>
</property>
- <property name="frameShadow">
- <enum>Sunken</enum>
+ <property name="resizable" >
+ <bool>true</bool>
</property>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout24</cstring>
+ </column>
+ <column>
+ <property name="text" >
+ <string>BSSID</string>
+ </property>
+ <property name="clickable" >
+ <bool>true</bool>
+ </property>
+ <property name="resizable" >
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>frequency</string>
+ </property>
+ <property name="clickable" >
+ <bool>true</bool>
+ </property>
+ <property name="resizable" >
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>signal</string>
+ </property>
+ <property name="clickable" >
+ <bool>true</bool>
+ </property>
+ <property name="resizable" >
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text" >
+ <string>flags</string>
+ </property>
+ <property name="clickable" >
+ <bool>true</bool>
+ </property>
+ <property name="resizable" >
+ <bool>true</bool>
</property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>spacer6</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>50</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>scanButton</cstring>
- </property>
- <property name="text">
- <string>Scan</string>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>closeButton</cstring>
- </property>
- <property name="text">
- <string>Close</string>
- </property>
- </widget>
- </hbox>
+ </column>
</widget>
- </vbox>
-</widget>
-<connections>
- <connection>
- <sender>closeButton</sender>
- <signal>clicked()</signal>
- <receiver>ScanResults</receiver>
- <slot>close()</slot>
- </connection>
- <connection>
- <sender>scanButton</sender>
- <signal>clicked()</signal>
- <receiver>ScanResults</receiver>
- <slot>scanRequest()</slot>
- </connection>
- <connection>
- <sender>scanResultsView</sender>
- <signal>doubleClicked(QListViewItem*)</signal>
- <receiver>ScanResults</receiver>
- <slot>bssSelected(QListViewItem*)</slot>
- </connection>
-</connections>
-<includes>
- <include location="local" impldecl="in implementation">wpa_ctrl.h</include>
- <include location="local" impldecl="in implementation">wpagui.h</include>
- <include location="local" impldecl="in implementation">networkconfig.h</include>
- <include location="local" impldecl="in implementation">scanresults.ui.h</include>
-</includes>
-<forwards>
- <forward>class WpaGui;</forward>
-</forwards>
-<variables>
- <variable access="private">WpaGui *wpagui;</variable>
- <variable access="private">QTimer *timer;</variable>
-</variables>
-<slots>
- <slot>setWpaGui( WpaGui * _wpagui )</slot>
- <slot>updateResults()</slot>
- <slot>scanRequest()</slot>
- <slot>getResults()</slot>
- <slot>bssSelected( QListViewItem * sel )</slot>
-</slots>
-<functions>
- <function access="private" specifier="non virtual">init()</function>
- <function access="private" specifier="non virtual">destroy()</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="spacer6" >
+ <property name="sizeHint" >
+ <size>
+ <width>50</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType" >
+ <enum>Expanding</enum>
+ </property>
+ <property name="orientation" >
+ <enum>Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="scanButton" >
+ <property name="text" >
+ <string>Scan</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="closeButton" >
+ <property name="text" >
+ <string>Close</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+</ui>
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp b/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp
new file mode 100644
index 0000000..e198955
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp
@@ -0,0 +1,100 @@
+/*
+ * wpa_gui - UserDataRequest class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include "userdatarequest.h"
+#include "wpagui.h"
+#include "wpa_ctrl.h"
+
+
+UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool,
+ Qt::WFlags)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(sendReply()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+ connect(queryEdit, SIGNAL(returnPressed()), this, SLOT(sendReply()));
+}
+
+
+UserDataRequest::~UserDataRequest()
+{
+}
+
+
+void UserDataRequest::languageChange()
+{
+ retranslateUi(this);
+}
+
+
+int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
+{
+ char *tmp, *pos, *pos2;
+ wpagui = _wpagui;
+ tmp = strdup(reqMsg);
+ if (tmp == NULL)
+ return -1;
+ pos = strchr(tmp, '-');
+ if (pos == NULL) {
+ free(tmp);
+ return -1;
+ }
+ *pos++ = '\0';
+ field = tmp;
+ pos2 = strchr(pos, ':');
+ if (pos2 == NULL) {
+ free(tmp);
+ return -1;
+ }
+ *pos2++ = '\0';
+
+ networkid = atoi(pos);
+ queryInfo->setText(pos2);
+ if (strcmp(tmp, "PASSWORD") == 0) {
+ queryField->setText("Password: ");
+ queryEdit->setEchoMode(QLineEdit::Password);
+ } else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
+ queryField->setText("New password: ");
+ queryEdit->setEchoMode(QLineEdit::Password);
+ } else if (strcmp(tmp, "IDENTITY") == 0)
+ queryField->setText("Identity: ");
+ else if (strcmp(tmp, "PASSPHRASE") == 0) {
+ queryField->setText("Private key passphrase: ");
+ queryEdit->setEchoMode(QLineEdit::Password);
+ } else
+ queryField->setText(field + ":");
+ free(tmp);
+
+ return 0;
+}
+
+
+void UserDataRequest::sendReply()
+{
+ char reply[10];
+ size_t reply_len = sizeof(reply);
+
+ if (wpagui == NULL) {
+ reject();
+ return;
+ }
+
+ QString cmd = QString(WPA_CTRL_RSP) + field + '-' +
+ QString::number(networkid) + ':' +
+ queryEdit->text();
+ wpagui->ctrlRequest(cmd.ascii(), reply, &reply_len);
+ accept();
+}
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.h b/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.h
new file mode 100644
index 0000000..2b6e837
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.h
@@ -0,0 +1,46 @@
+/*
+ * wpa_gui - UserDataRequest class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef USERDATAREQUEST_H
+#define USERDATAREQUEST_H
+
+#include <QObject>
+#include "ui_userdatarequest.h"
+
+class WpaGui;
+
+class UserDataRequest : public QDialog, public Ui::UserDataRequest
+{
+ Q_OBJECT
+
+public:
+ UserDataRequest(QWidget *parent = 0, const char *name = 0,
+ bool modal = false, Qt::WFlags fl = 0);
+ ~UserDataRequest();
+
+ int setParams(WpaGui *_wpagui, const char *reqMsg);
+
+public slots:
+ virtual void sendReply();
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ WpaGui *wpagui;
+ int networkid;
+ QString field;
+};
+
+#endif /* USERDATAREQUEST_H */
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.ui b/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.ui
index c3d545f..ea01721 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.ui
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/userdatarequest.ui
@@ -1,163 +1,109 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>UserDataRequest</class>
-<widget class="QDialog">
- <property name="name">
- <cstring>UserDataRequest</cstring>
+<ui version="4.0" stdsetdef="1" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>UserDataRequest</class>
+ <widget class="QDialog" name="UserDataRequest" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>216</width>
+ <height>103</height>
+ </rect>
</property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>216</width>
- <height>103</height>
- </rect>
+ <property name="windowTitle" >
+ <string>Authentication credentials required</string>
</property>
- <property name="caption">
- <string>Authentication credentials required</string>
+ <property name="sizeGripEnabled" >
+ <bool>true</bool>
</property>
- <property name="sizeGripEnabled">
- <bool>true</bool>
- </property>
- <vbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>queryInfo</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout28</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel">
- <property name="name">
- <cstring>queryField</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
- </widget>
- <widget class="QLineEdit">
- <property name="name">
- <cstring>queryEdit</cstring>
- </property>
- <property name="enabled">
- <bool>true</bool>
- </property>
- <property name="echoMode">
- <enum>Password</enum>
- </property>
- </widget>
- </hbox>
- </widget>
- <widget class="QLayoutWidget">
- <property name="name">
- <cstring>layout27</cstring>
- </property>
- <hbox>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <spacer>
- <property name="name">
- <cstring>spacer4</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonOk</cstring>
- </property>
- <property name="text">
- <string>&amp;OK</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- <property name="default">
- <bool>true</bool>
- </property>
- </widget>
- <widget class="QPushButton">
- <property name="name">
- <cstring>buttonCancel</cstring>
- </property>
- <property name="text">
- <string>&amp;Cancel</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
- <property name="autoDefault">
- <bool>true</bool>
- </property>
- </widget>
- </hbox>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="queryInfo" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- </vbox>
-</widget>
-<connections>
- <connection>
- <sender>buttonOk</sender>
- <signal>clicked()</signal>
- <receiver>UserDataRequest</receiver>
- <slot>sendReply()</slot>
- </connection>
- <connection>
- <sender>buttonCancel</sender>
- <signal>clicked()</signal>
- <receiver>UserDataRequest</receiver>
- <slot>reject()</slot>
- </connection>
- <connection>
- <sender>queryEdit</sender>
- <signal>returnPressed()</signal>
- <receiver>UserDataRequest</receiver>
- <slot>sendReply()</slot>
- </connection>
-</connections>
-<includes>
- <include location="local" impldecl="in implementation">wpa_ctrl.h</include>
- <include location="local" impldecl="in implementation">wpagui.h</include>
- <include location="local" impldecl="in implementation">userdatarequest.ui.h</include>
-</includes>
-<forwards>
- <forward>class WpaGui;</forward>
-</forwards>
-<variables>
- <variable access="private">WpaGui *wpagui;</variable>
- <variable access="private">int networkid;</variable>
- <variable access="private">QString field;</variable>
-</variables>
-<slots>
- <slot>sendReply()</slot>
-</slots>
-<functions>
- <function specifier="non virtual" returnType="int">setParams( WpaGui * _wpagui, const char * reqMsg )</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="queryField" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="queryEdit" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="echoMode" >
+ <enum>QLineEdit::Password</enum>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <item>
+ <spacer name="spacer4" >
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ <property name="sizeType" >
+ <enum>Expanding</enum>
+ </property>
+ <property name="orientation" >
+ <enum>Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonOk" >
+ <property name="text" >
+ <string>&amp;OK</string>
+ </property>
+ <property name="shortcut" >
+ <string/>
+ </property>
+ <property name="autoDefault" >
+ <bool>true</bool>
+ </property>
+ <property name="default" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="buttonCancel" >
+ <property name="text" >
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="shortcut" >
+ <string/>
+ </property>
+ <property name="autoDefault" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+</ui>
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro b/contrib/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
index a1ad0ee..0d1c32b 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro
@@ -3,20 +3,34 @@ LANGUAGE = C++
CONFIG += qt warn_on release
+DEFINES += CONFIG_CTRL_IFACE
+
win32 {
LIBS += -lws2_32 -static
- DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_UDP
+ DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE
} else:win32-g++ {
# cross compilation to win32
LIBS += -lws2_32 -static
- DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_UDP
+ DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE
+} else {
+ DEFINES += CONFIG_CTRL_IFACE_UNIX
}
-INCLUDEPATH += . ..
+INCLUDEPATH += . .. ../../hostapd
-HEADERS += wpamsg.h
+HEADERS += wpamsg.h \
+ wpagui.h \
+ eventhistory.h \
+ scanresults.h \
+ userdatarequest.h \
+ networkconfig.h
SOURCES += main.cpp \
+ wpagui.cpp \
+ eventhistory.cpp \
+ scanresults.cpp \
+ userdatarequest.cpp \
+ networkconfig.cpp \
../wpa_ctrl.c
FORMS = wpagui.ui \
@@ -32,10 +46,5 @@ unix {
OBJECTS_DIR = .obj
}
-
-
-#The following line was inserted by qt3to4
-QT += qt3support
-#The following line was inserted by qt3to4
-CONFIG += uic3
-
+# TODO: remove need for Qt3 support code
+QT += qt3support
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
new file mode 100644
index 0000000..1dc7af2
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.cpp
@@ -0,0 +1,779 @@
+/*
+ * wpa_gui - WpaGui class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifdef __MINGW32__
+/* Need to get getopt() */
+#include <unistd.h>
+#endif
+
+#include <QMessageBox>
+
+#include "wpagui.h"
+#include "dirent.h"
+#include "wpa_ctrl.h"
+#include "userdatarequest.h"
+#include "networkconfig.h"
+
+WpaGui::WpaGui(QWidget *parent, const char *, Qt::WFlags)
+ : QMainWindow(parent)
+{
+ setupUi(this);
+
+ (void) statusBar();
+
+ connect(helpIndexAction, SIGNAL(activated()), this, SLOT(helpIndex()));
+ connect(helpContentsAction, SIGNAL(activated()), this,
+ SLOT(helpContents()));
+ connect(helpAboutAction, SIGNAL(activated()), this, SLOT(helpAbout()));
+ connect(fileExitAction, SIGNAL(activated()), this, SLOT(close()));
+ connect(disconnectButton, SIGNAL(clicked()), this, SLOT(disconnect()));
+ connect(scanButton, SIGNAL(clicked()), this, SLOT(scan()));
+ connect(connectButton, SIGNAL(clicked()), this, SLOT(connectB()));
+ connect(fileEventHistoryAction, SIGNAL(activated()), this,
+ SLOT(eventHistory()));
+ connect(networkSelect, SIGNAL(activated(const QString&)), this,
+ SLOT(selectNetwork(const QString&)));
+ connect(fileEdit_networkAction, SIGNAL(activated()), this,
+ SLOT(editNetwork()));
+ connect(fileAdd_NetworkAction, SIGNAL(activated()), this,
+ SLOT(addNetwork()));
+ connect(adapterSelect, SIGNAL(activated(const QString&)), this,
+ SLOT(selectAdapter(const QString&)));
+
+ eh = NULL;
+ scanres = NULL;
+ udr = NULL;
+ ctrl_iface = NULL;
+ ctrl_conn = NULL;
+ monitor_conn = NULL;
+ msgNotifier = NULL;
+ ctrl_iface_dir = strdup("/var/run/wpa_supplicant");
+
+ parse_argv();
+
+ textStatus->setText("connecting to wpa_supplicant");
+ timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), SLOT(ping()));
+ timer->start(1000, FALSE);
+
+ if (openCtrlConnection(ctrl_iface) < 0) {
+ printf("Failed to open control connection to "
+ "wpa_supplicant.\n");
+ }
+
+ updateStatus();
+ networkMayHaveChanged = true;
+ updateNetworks();
+}
+
+
+WpaGui::~WpaGui()
+{
+ delete msgNotifier;
+
+ if (monitor_conn) {
+ wpa_ctrl_detach(monitor_conn);
+ wpa_ctrl_close(monitor_conn);
+ monitor_conn = NULL;
+ }
+ if (ctrl_conn) {
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = NULL;
+ }
+
+ if (eh) {
+ eh->close();
+ delete eh;
+ eh = NULL;
+ }
+
+ if (scanres) {
+ scanres->close();
+ delete scanres;
+ scanres = NULL;
+ }
+
+ if (udr) {
+ udr->close();
+ delete udr;
+ udr = NULL;
+ }
+
+ free(ctrl_iface);
+ ctrl_iface = NULL;
+
+ free(ctrl_iface_dir);
+ ctrl_iface_dir = NULL;
+}
+
+
+void WpaGui::languageChange()
+{
+ retranslateUi(this);
+}
+
+
+void WpaGui::parse_argv()
+{
+ int c;
+ for (;;) {
+ c = getopt(qApp->argc(), qApp->argv(), "i:p:");
+ if (c < 0)
+ break;
+ switch (c) {
+ case 'i':
+ free(ctrl_iface);
+ ctrl_iface = strdup(optarg);
+ break;
+ case 'p':
+ free(ctrl_iface_dir);
+ ctrl_iface_dir = strdup(optarg);
+ break;
+ }
+ }
+}
+
+
+int WpaGui::openCtrlConnection(const char *ifname)
+{
+ char *cfile;
+ int flen;
+ char buf[2048], *pos, *pos2;
+ size_t len;
+
+ if (ifname) {
+ if (ifname != ctrl_iface) {
+ free(ctrl_iface);
+ ctrl_iface = strdup(ifname);
+ }
+ } else {
+#ifdef CONFIG_CTRL_IFACE_UDP
+ free(ctrl_iface);
+ ctrl_iface = strdup("udp");
+#endif /* CONFIG_CTRL_IFACE_UDP */
+#ifdef CONFIG_CTRL_IFACE_UNIX
+ struct dirent *dent;
+ DIR *dir = opendir(ctrl_iface_dir);
+ free(ctrl_iface);
+ ctrl_iface = NULL;
+ if (dir) {
+ while ((dent = readdir(dir))) {
+#ifdef _DIRENT_HAVE_D_TYPE
+ /* Skip the file if it is not a socket.
+ * Also accept DT_UNKNOWN (0) in case
+ * the C library or underlying file
+ * system does not support d_type. */
+ if (dent->d_type != DT_SOCK &&
+ dent->d_type != DT_UNKNOWN)
+ continue;
+#endif /* _DIRENT_HAVE_D_TYPE */
+
+ if (strcmp(dent->d_name, ".") == 0 ||
+ strcmp(dent->d_name, "..") == 0)
+ continue;
+ printf("Selected interface '%s'\n",
+ dent->d_name);
+ ctrl_iface = strdup(dent->d_name);
+ break;
+ }
+ closedir(dir);
+ }
+#endif /* CONFIG_CTRL_IFACE_UNIX */
+#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
+ struct wpa_ctrl *ctrl;
+ int ret;
+
+ free(ctrl_iface);
+ ctrl_iface = NULL;
+
+ ctrl = wpa_ctrl_open(NULL);
+ if (ctrl) {
+ len = sizeof(buf) - 1;
+ ret = wpa_ctrl_request(ctrl, "INTERFACES", 10, buf,
+ &len, NULL);
+ if (ret >= 0) {
+ buf[len] = '\0';
+ pos = strchr(buf, '\n');
+ if (pos)
+ *pos = '\0';
+ ctrl_iface = strdup(buf);
+ }
+ wpa_ctrl_close(ctrl);
+ }
+#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+ }
+
+ if (ctrl_iface == NULL)
+ return -1;
+
+#ifdef CONFIG_CTRL_IFACE_UNIX
+ flen = strlen(ctrl_iface_dir) + strlen(ctrl_iface) + 2;
+ cfile = (char *) malloc(flen);
+ if (cfile == NULL)
+ return -1;
+ snprintf(cfile, flen, "%s/%s", ctrl_iface_dir, ctrl_iface);
+#else /* CONFIG_CTRL_IFACE_UNIX */
+ flen = strlen(ctrl_iface) + 1;
+ cfile = (char *) malloc(flen);
+ if (cfile == NULL)
+ return -1;
+ snprintf(cfile, flen, "%s", ctrl_iface);
+#endif /* CONFIG_CTRL_IFACE_UNIX */
+
+ if (ctrl_conn) {
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = NULL;
+ }
+
+ if (monitor_conn) {
+ delete msgNotifier;
+ msgNotifier = NULL;
+ wpa_ctrl_detach(monitor_conn);
+ wpa_ctrl_close(monitor_conn);
+ monitor_conn = NULL;
+ }
+
+ printf("Trying to connect to '%s'\n", cfile);
+ ctrl_conn = wpa_ctrl_open(cfile);
+ if (ctrl_conn == NULL) {
+ free(cfile);
+ return -1;
+ }
+ monitor_conn = wpa_ctrl_open(cfile);
+ free(cfile);
+ if (monitor_conn == NULL) {
+ wpa_ctrl_close(ctrl_conn);
+ return -1;
+ }
+ if (wpa_ctrl_attach(monitor_conn)) {
+ printf("Failed to attach to wpa_supplicant\n");
+ wpa_ctrl_close(monitor_conn);
+ monitor_conn = NULL;
+ wpa_ctrl_close(ctrl_conn);
+ ctrl_conn = NULL;
+ return -1;
+ }
+
+#if defined(CONFIG_CTRL_IFACE_UNIX) || defined(CONFIG_CTRL_IFACE_UDP)
+ msgNotifier = new QSocketNotifier(wpa_ctrl_get_fd(monitor_conn),
+ QSocketNotifier::Read, this);
+ connect(msgNotifier, SIGNAL(activated(int)), SLOT(receiveMsgs()));
+#endif
+
+ adapterSelect->clear();
+ adapterSelect->insertItem(ctrl_iface);
+ adapterSelect->setCurrentItem(0);
+
+ len = sizeof(buf) - 1;
+ if (wpa_ctrl_request(ctrl_conn, "INTERFACES", 10, buf, &len, NULL) >=
+ 0) {
+ buf[len] = '\0';
+ pos = buf;
+ while (*pos) {
+ pos2 = strchr(pos, '\n');
+ if (pos2)
+ *pos2 = '\0';
+ if (strcmp(pos, ctrl_iface) != 0)
+ adapterSelect->insertItem(pos);
+ if (pos2)
+ pos = pos2 + 1;
+ else
+ break;
+ }
+ }
+
+ return 0;
+}
+
+
+static void wpa_gui_msg_cb(char *msg, size_t)
+{
+ /* This should not happen anymore since two control connections are
+ * used. */
+ printf("missed message: %s\n", msg);
+}
+
+
+int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen)
+{
+ int ret;
+
+ if (ctrl_conn == NULL)
+ return -3;
+ ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen,
+ wpa_gui_msg_cb);
+ if (ret == -2)
+ printf("'%s' command timed out.\n", cmd);
+ else if (ret < 0)
+ printf("'%s' command failed.\n", cmd);
+
+ return ret;
+}
+
+
+void WpaGui::updateStatus()
+{
+ char buf[2048], *start, *end, *pos;
+ size_t len;
+
+ pingsToStatusUpdate = 10;
+
+ len = sizeof(buf) - 1;
+ if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) {
+ textStatus->setText("Could not get status from "
+ "wpa_supplicant");
+ textAuthentication->clear();
+ textEncryption->clear();
+ textSsid->clear();
+ textBssid->clear();
+ textIpAddress->clear();
+ return;
+ }
+
+ buf[len] = '\0';
+
+ bool auth_updated = false, ssid_updated = false;
+ bool bssid_updated = false, ipaddr_updated = false;
+ bool status_updated = false;
+ char *pairwise_cipher = NULL, *group_cipher = NULL;
+
+ start = buf;
+ while (*start) {
+ bool last = false;
+ end = strchr(start, '\n');
+ if (end == NULL) {
+ last = true;
+ end = start;
+ while (end[0] && end[1])
+ end++;
+ }
+ *end = '\0';
+
+ pos = strchr(start, '=');
+ if (pos) {
+ *pos++ = '\0';
+ if (strcmp(start, "bssid") == 0) {
+ bssid_updated = true;
+ textBssid->setText(pos);
+ } else if (strcmp(start, "ssid") == 0) {
+ ssid_updated = true;
+ textSsid->setText(pos);
+ } else if (strcmp(start, "ip_address") == 0) {
+ ipaddr_updated = true;
+ textIpAddress->setText(pos);
+ } else if (strcmp(start, "wpa_state") == 0) {
+ status_updated = true;
+ textStatus->setText(pos);
+ } else if (strcmp(start, "key_mgmt") == 0) {
+ auth_updated = true;
+ textAuthentication->setText(pos);
+ /* TODO: could add EAP status to this */
+ } else if (strcmp(start, "pairwise_cipher") == 0) {
+ pairwise_cipher = pos;
+ } else if (strcmp(start, "group_cipher") == 0) {
+ group_cipher = pos;
+ }
+ }
+
+ if (last)
+ break;
+ start = end + 1;
+ }
+
+ if (pairwise_cipher || group_cipher) {
+ QString encr;
+ if (pairwise_cipher && group_cipher &&
+ strcmp(pairwise_cipher, group_cipher) != 0) {
+ encr.append(pairwise_cipher);
+ encr.append(" + ");
+ encr.append(group_cipher);
+ } else if (pairwise_cipher) {
+ encr.append(pairwise_cipher);
+ } else if (group_cipher) {
+ encr.append(group_cipher);
+ encr.append(" [group key only]");
+ } else {
+ encr.append("?");
+ }
+ textEncryption->setText(encr);
+ } else
+ textEncryption->clear();
+
+ if (!status_updated)
+ textStatus->clear();
+ if (!auth_updated)
+ textAuthentication->clear();
+ if (!ssid_updated)
+ textSsid->clear();
+ if (!bssid_updated)
+ textBssid->clear();
+ if (!ipaddr_updated)
+ textIpAddress->clear();
+}
+
+
+void WpaGui::updateNetworks()
+{
+ char buf[2048], *start, *end, *id, *ssid, *bssid, *flags;
+ size_t len;
+ int first_active = -1;
+ bool selected = false;
+
+ if (!networkMayHaveChanged)
+ return;
+
+ networkSelect->clear();
+
+ if (ctrl_conn == NULL)
+ return;
+
+ len = sizeof(buf) - 1;
+ if (ctrlRequest("LIST_NETWORKS", buf, &len) < 0)
+ return;
+
+ buf[len] = '\0';
+ start = strchr(buf, '\n');
+ if (start == NULL)
+ return;
+ start++;
+
+ while (*start) {
+ bool last = false;
+ end = strchr(start, '\n');
+ if (end == NULL) {
+ last = true;
+ end = start;
+ while (end[0] && end[1])
+ end++;
+ }
+ *end = '\0';
+
+ id = start;
+ ssid = strchr(id, '\t');
+ if (ssid == NULL)
+ break;
+ *ssid++ = '\0';
+ bssid = strchr(ssid, '\t');
+ if (bssid == NULL)
+ break;
+ *bssid++ = '\0';
+ flags = strchr(bssid, '\t');
+ if (flags == NULL)
+ break;
+ *flags++ = '\0';
+
+ QString network(id);
+ network.append(": ");
+ network.append(ssid);
+ networkSelect->insertItem(network);
+
+ if (strstr(flags, "[CURRENT]")) {
+ networkSelect->setCurrentItem(networkSelect->count() -
+ 1);
+ selected = true;
+ } else if (first_active < 0 &&
+ strstr(flags, "[DISABLED]") == NULL)
+ first_active = networkSelect->count() - 1;
+
+ if (last)
+ break;
+ start = end + 1;
+ }
+
+ if (!selected && first_active >= 0)
+ networkSelect->setCurrentItem(first_active);
+
+ networkMayHaveChanged = false;
+}
+
+
+void WpaGui::helpIndex()
+{
+ printf("helpIndex\n");
+}
+
+
+void WpaGui::helpContents()
+{
+ printf("helpContents\n");
+}
+
+
+void WpaGui::helpAbout()
+{
+ QMessageBox::about(this, "wpa_gui for wpa_supplicant",
+ "Copyright (c) 2003-2006,\n"
+ "Jouni Malinen <j@w1.fi>\n"
+ "and contributors.\n"
+ "\n"
+ "This program is free software. You can\n"
+ "distribute it and/or modify it under the terms "
+ "of\n"
+ "the GNU General Public License version 2.\n"
+ "\n"
+ "Alternatively, this software may be distributed\n"
+ "under the terms of the BSD license.\n"
+ "\n"
+ "This product includes software developed\n"
+ "by the OpenSSL Project for use in the\n"
+ "OpenSSL Toolkit (http://www.openssl.org/)\n");
+}
+
+
+void WpaGui::disconnect()
+{
+ char reply[10];
+ size_t reply_len = sizeof(reply);
+ ctrlRequest("DISCONNECT", reply, &reply_len);
+}
+
+
+void WpaGui::scan()
+{
+ if (scanres) {
+ scanres->close();
+ delete scanres;
+ }
+
+ scanres = new ScanResults();
+ if (scanres == NULL)
+ return;
+ scanres->setWpaGui(this);
+ scanres->show();
+ scanres->exec();
+}
+
+
+void WpaGui::eventHistory()
+{
+ if (eh) {
+ eh->close();
+ delete eh;
+ }
+
+ eh = new EventHistory();
+ if (eh == NULL)
+ return;
+ eh->addEvents(msgs);
+ eh->show();
+ eh->exec();
+}
+
+
+void WpaGui::ping()
+{
+ char buf[10];
+ size_t len;
+
+#ifdef CONFIG_CTRL_IFACE_NAMED_PIPE
+ /*
+ * QSocketNotifier cannot be used with Windows named pipes, so use a
+ * timer to check for received messages for now. This could be
+ * optimized be doing something specific to named pipes or Windows
+ * events, but it is not clear what would be the best way of doing that
+ * in Qt.
+ */
+ receiveMsgs();
+#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
+
+ if (scanres && !scanres->isVisible()) {
+ delete scanres;
+ scanres = NULL;
+ }
+
+ if (eh && !eh->isVisible()) {
+ delete eh;
+ eh = NULL;
+ }
+
+ if (udr && !udr->isVisible()) {
+ delete udr;
+ udr = NULL;
+ }
+
+ len = sizeof(buf) - 1;
+ if (ctrlRequest("PING", buf, &len) < 0) {
+ printf("PING failed - trying to reconnect\n");
+ if (openCtrlConnection(ctrl_iface) >= 0) {
+ printf("Reconnected successfully\n");
+ pingsToStatusUpdate = 0;
+ }
+ }
+
+ pingsToStatusUpdate--;
+ if (pingsToStatusUpdate <= 0) {
+ updateStatus();
+ updateNetworks();
+ }
+}
+
+
+static int str_match(const char *a, const char *b)
+{
+ return strncmp(a, b, strlen(b)) == 0;
+}
+
+
+void WpaGui::processMsg(char *msg)
+{
+ char *pos = msg, *pos2;
+ int priority = 2;
+
+ if (*pos == '<') {
+ /* skip priority */
+ pos++;
+ priority = atoi(pos);
+ pos = strchr(pos, '>');
+ if (pos)
+ pos++;
+ else
+ pos = msg;
+ }
+
+ WpaMsg wm(pos, priority);
+ if (eh)
+ eh->addEvent(wm);
+ msgs.append(wm);
+ while (msgs.count() > 100)
+ msgs.pop_front();
+
+ /* Update last message with truncated version of the event */
+ if (strncmp(pos, "CTRL-", 5) == 0) {
+ pos2 = strchr(pos, str_match(pos, WPA_CTRL_REQ) ? ':' : ' ');
+ if (pos2)
+ pos2++;
+ else
+ pos2 = pos;
+ } else
+ pos2 = pos;
+ QString lastmsg = pos2;
+ lastmsg.truncate(40);
+ textLastMessage->setText(lastmsg);
+
+ pingsToStatusUpdate = 0;
+ networkMayHaveChanged = true;
+
+ if (str_match(pos, WPA_CTRL_REQ))
+ processCtrlReq(pos + strlen(WPA_CTRL_REQ));
+}
+
+
+void WpaGui::processCtrlReq(const char *req)
+{
+ if (udr) {
+ udr->close();
+ delete udr;
+ }
+ udr = new UserDataRequest();
+ if (udr == NULL)
+ return;
+ if (udr->setParams(this, req) < 0) {
+ delete udr;
+ udr = NULL;
+ return;
+ }
+ udr->show();
+ udr->exec();
+}
+
+
+void WpaGui::receiveMsgs()
+{
+ char buf[256];
+ size_t len;
+
+ while (monitor_conn && wpa_ctrl_pending(monitor_conn) > 0) {
+ len = sizeof(buf) - 1;
+ if (wpa_ctrl_recv(monitor_conn, buf, &len) == 0) {
+ buf[len] = '\0';
+ processMsg(buf);
+ }
+ }
+}
+
+
+void WpaGui::connectB()
+{
+ char reply[10];
+ size_t reply_len = sizeof(reply);
+ ctrlRequest("REASSOCIATE", reply, &reply_len);
+}
+
+
+void WpaGui::selectNetwork( const QString &sel )
+{
+ QString cmd(sel);
+ char reply[10];
+ size_t reply_len = sizeof(reply);
+
+ int pos = cmd.find(':');
+ if (pos < 0) {
+ printf("Invalid selectNetwork '%s'\n", cmd.ascii());
+ return;
+ }
+ cmd.truncate(pos);
+ cmd.prepend("SELECT_NETWORK ");
+ ctrlRequest(cmd.ascii(), reply, &reply_len);
+}
+
+
+void WpaGui::editNetwork()
+{
+ QString sel(networkSelect->currentText());
+ int pos = sel.find(':');
+ if (pos < 0) {
+ printf("Invalid selectNetwork '%s'\n", sel.ascii());
+ return;
+ }
+ sel.truncate(pos);
+
+ NetworkConfig *nc = new NetworkConfig();
+ if (nc == NULL)
+ return;
+ nc->setWpaGui(this);
+
+ nc->paramsFromConfig(sel.toInt());
+ nc->show();
+ nc->exec();
+}
+
+
+void WpaGui::triggerUpdate()
+{
+ updateStatus();
+ networkMayHaveChanged = true;
+ updateNetworks();
+}
+
+
+void WpaGui::addNetwork()
+{
+ NetworkConfig *nc = new NetworkConfig();
+ if (nc == NULL)
+ return;
+ nc->setWpaGui(this);
+ nc->newNetwork();
+ nc->show();
+ nc->exec();
+}
+
+
+void WpaGui::selectAdapter( const QString & sel )
+{
+ if (openCtrlConnection(sel.ascii()) < 0)
+ printf("Failed to open control connection to "
+ "wpa_supplicant.\n");
+ updateStatus();
+ updateNetworks();
+}
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.h b/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.h
new file mode 100644
index 0000000..cd5c1af
--- /dev/null
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.h
@@ -0,0 +1,76 @@
+/*
+ * wpa_gui - WpaGui class
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#ifndef WPAGUI_H
+#define WPAGUI_H
+
+#include <QObject>
+#include "ui_wpagui.h"
+
+class UserDataRequest;
+
+
+class WpaGui : public QMainWindow, public Ui::WpaGui
+{
+ Q_OBJECT
+
+public:
+ WpaGui(QWidget *parent = 0, const char *name = 0,
+ Qt::WFlags fl = Qt::WType_TopLevel);
+ ~WpaGui();
+
+ virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen);
+ virtual void triggerUpdate();
+
+public slots:
+ virtual void parse_argv();
+ virtual void updateStatus();
+ virtual void updateNetworks();
+ virtual void helpIndex();
+ virtual void helpContents();
+ virtual void helpAbout();
+ virtual void disconnect();
+ virtual void scan();
+ virtual void eventHistory();
+ virtual void ping();
+ virtual void processMsg(char *msg);
+ virtual void processCtrlReq(const char *req);
+ virtual void receiveMsgs();
+ virtual void connectB();
+ virtual void selectNetwork(const QString &sel);
+ virtual void editNetwork();
+ virtual void addNetwork();
+ virtual void selectAdapter(const QString &sel);
+
+protected slots:
+ virtual void languageChange();
+
+private:
+ ScanResults *scanres;
+ bool networkMayHaveChanged;
+ char *ctrl_iface;
+ EventHistory *eh;
+ struct wpa_ctrl *ctrl_conn;
+ QSocketNotifier *msgNotifier;
+ QTimer *timer;
+ int pingsToStatusUpdate;
+ WpaMsgList msgs;
+ char *ctrl_iface_dir;
+ struct wpa_ctrl *monitor_conn;
+ UserDataRequest *udr;
+
+ int openCtrlConnection(const char *ifname);
+};
+
+#endif /* WPAGUI_H */
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.ui b/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.ui
index 7097bfa..7047a2a 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.ui
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/wpagui.ui
@@ -1,464 +1,318 @@
-<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
-<class>WpaGui</class>
-<widget class="QMainWindow">
- <property name="name">
- <cstring>WpaGui</cstring>
+<ui version="4.0" stdsetdef="1" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>WpaGui</class>
+ <widget class="QMainWindow" name="WpaGui" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>279</width>
+ <height>308</height>
+ </rect>
</property>
- <property name="geometry">
- <rect>
- <x>0</x>
- <y>0</y>
- <width>279</width>
- <height>308</height>
- </rect>
+ <property name="windowTitle" >
+ <string>wpa_gui</string>
</property>
- <property name="caption">
- <string>wpa_gui</string>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel16</cstring>
- </property>
- <property name="text">
- <string>Adapter:</string>
- </property>
- </widget>
- <widget class="QComboBox" row="0" column="2" rowspan="1" colspan="2">
- <property name="name">
- <cstring>adapterSelect</cstring>
- </property>
- </widget>
- <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
- <property name="name">
- <cstring>textLabel8</cstring>
+ <widget class="QWidget" >
+ <layout class="QGridLayout" >
+ <item rowspan="1" row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel16" >
+ <property name="text" >
+ <string>Adapter:</string>
</property>
- <property name="text">
- <string>Network:</string>
+ </widget>
+ </item>
+ <item rowspan="1" row="0" column="2" colspan="2" >
+ <widget class="QComboBox" name="adapterSelect" />
+ </item>
+ <item rowspan="1" row="1" column="0" colspan="2" >
+ <widget class="QLabel" name="textLabel8" >
+ <property name="text" >
+ <string>Network:</string>
</property>
- </widget>
- <widget class="QComboBox" row="1" column="2" rowspan="1" colspan="2">
- <property name="name">
- <cstring>networkSelect</cstring>
+ </widget>
+ </item>
+ <item rowspan="1" row="1" column="2" colspan="2" >
+ <widget class="QComboBox" name="networkSelect" />
+ </item>
+ <item rowspan="1" row="2" column="0" colspan="4" >
+ <widget class="QFrame" name="frame3" >
+ <property name="frameShape" >
+ <enum>StyledPanel</enum>
</property>
- </widget>
- <widget class="QFrame" row="2" column="0" rowspan="1" colspan="4">
- <property name="name">
- <cstring>frame3</cstring>
+ <property name="frameShadow" >
+ <enum>Raised</enum>
</property>
- <property name="frameShape">
- <enum>StyledPanel</enum>
- </property>
- <property name="frameShadow">
- <enum>Raised</enum>
- </property>
- <grid>
- <property name="name">
- <cstring>unnamed</cstring>
- </property>
- <widget class="QLabel" row="0" column="0">
- <property name="name">
- <cstring>textLabel1</cstring>
- </property>
- <property name="text">
- <string>Status:</string>
- </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="textLabel1" >
+ <property name="text" >
+ <string>Status:</string>
+ </property>
</widget>
- <widget class="QLabel" row="1" column="0">
- <property name="name">
- <cstring>textLabel2</cstring>
- </property>
- <property name="text">
- <string>Last message:</string>
- </property>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="textLabel2" >
+ <property name="text" >
+ <string>Last message:</string>
+ </property>
</widget>
- <widget class="QLabel" row="2" column="0">
- <property name="name">
- <cstring>textLabel3</cstring>
- </property>
- <property name="text">
- <string>Authentication:</string>
- </property>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="textLabel3" >
+ <property name="text" >
+ <string>Authentication:</string>
+ </property>
</widget>
- <widget class="QLabel" row="3" column="0">
- <property name="name">
- <cstring>textLabel4</cstring>
- </property>
- <property name="text">
- <string>Encryption:</string>
- </property>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QLabel" name="textLabel4" >
+ <property name="text" >
+ <string>Encryption:</string>
+ </property>
</widget>
- <widget class="QLabel" row="4" column="0">
- <property name="name">
- <cstring>textLabel5</cstring>
- </property>
- <property name="text">
- <string>SSID:</string>
- </property>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="textLabel5" >
+ <property name="text" >
+ <string>SSID:</string>
+ </property>
</widget>
- <widget class="QLabel" row="5" column="0">
- <property name="name">
- <cstring>textLabel6</cstring>
- </property>
- <property name="text">
- <string>BSSID:</string>
- </property>
+ </item>
+ <item row="5" column="0" >
+ <widget class="QLabel" name="textLabel6" >
+ <property name="text" >
+ <string>BSSID:</string>
+ </property>
</widget>
- <widget class="QLabel" row="6" column="0">
- <property name="name">
- <cstring>textLabel7</cstring>
- </property>
- <property name="text">
- <string>IP address:</string>
- </property>
+ </item>
+ <item row="6" column="0" >
+ <widget class="QLabel" name="textLabel7" >
+ <property name="text" >
+ <string>IP address:</string>
+ </property>
</widget>
- <widget class="QLabel" row="0" column="1">
- <property name="name">
- <cstring>textStatus</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="textStatus" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- <widget class="QLabel" row="1" column="1" rowspan="1" colspan="3">
- <property name="name">
- <cstring>textLastMessage</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item rowspan="1" row="1" column="1" colspan="3" >
+ <widget class="QLabel" name="textLastMessage" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- <widget class="QLabel" row="2" column="1">
- <property name="name">
- <cstring>textAuthentication</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QLabel" name="textAuthentication" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- <widget class="QLabel" row="3" column="1">
- <property name="name">
- <cstring>textEncryption</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QLabel" name="textEncryption" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- <widget class="QLabel" row="4" column="1">
- <property name="name">
- <cstring>textSsid</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item row="4" column="1" >
+ <widget class="QLabel" name="textSsid" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- <widget class="QLabel" row="5" column="1">
- <property name="name">
- <cstring>textBssid</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item row="5" column="1" >
+ <widget class="QLabel" name="textBssid" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- <widget class="QLabel" row="6" column="1">
- <property name="name">
- <cstring>textIpAddress</cstring>
- </property>
- <property name="text">
- <string></string>
- </property>
+ </item>
+ <item row="6" column="1" >
+ <widget class="QLabel" name="textIpAddress" >
+ <property name="text" >
+ <string/>
+ </property>
</widget>
- </grid>
- </widget>
- <spacer row="3" column="0">
- <property name="name">
- <cstring>spacer7</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Expanding</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>16</width>
- <height>16</height>
- </size>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <spacer name="spacer7" >
+ <property name="sizeHint" >
+ <size>
+ <width>16</width>
+ <height>16</height>
+ </size>
</property>
- </spacer>
- <widget class="QPushButton" row="3" column="1">
- <property name="name">
- <cstring>connectButton</cstring>
+ <property name="sizeType" >
+ <enum>Expanding</enum>
</property>
- <property name="text">
- <string>Connect</string>
+ <property name="orientation" >
+ <enum>Horizontal</enum>
</property>
- </widget>
- <widget class="QPushButton" row="3" column="2">
- <property name="name">
- <cstring>disconnectButton</cstring>
+ </spacer>
+ </item>
+ <item row="3" column="1" >
+ <widget class="QPushButton" name="connectButton" >
+ <property name="text" >
+ <string>Connect</string>
</property>
- <property name="text">
- <string>Disconnect</string>
+ </widget>
+ </item>
+ <item row="3" column="2" >
+ <widget class="QPushButton" name="disconnectButton" >
+ <property name="text" >
+ <string>Disconnect</string>
</property>
- </widget>
- <widget class="QPushButton" row="3" column="3">
- <property name="name">
- <cstring>scanButton</cstring>
+ </widget>
+ </item>
+ <item row="3" column="3" >
+ <widget class="QPushButton" name="scanButton" >
+ <property name="text" >
+ <string>Scan</string>
</property>
- <property name="text">
- <string>Scan</string>
- </property>
- </widget>
- </grid>
-</widget>
-<menubar>
- <property name="name">
- <cstring>MenuBar</cstring>
- </property>
- <item text="&amp;File" name="fileMenu">
- <separator/>
- <action name="fileEventHistoryAction"/>
- <action name="fileAdd_NetworkAction"/>
- <action name="fileEdit_networkAction"/>
- <separator/>
- <action name="fileExitAction"/>
- </item>
- <item text="&amp;Help" name="helpMenu">
- <action name="helpContentsAction"/>
- <action name="helpIndexAction"/>
- <separator/>
- <action name="helpAboutAction"/>
- </item>
-</menubar>
-<toolbars>
-</toolbars>
-<actions>
- <action>
- <property name="name">
- <cstring>fileExitAction</cstring>
- </property>
- <property name="text">
- <string>Exit</string>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QMenuBar" name="MenuBar" >
+ <widget class="QMenu" name="fileMenu" >
+ <property name="title" >
+ <string>&amp;File</string>
</property>
- <property name="menuText">
- <string>E&amp;xit</string>
- </property>
- <property name="accel">
- <string>Ctrl+Q</string>
+ <addaction name="separator" />
+ <addaction name="fileEventHistoryAction" />
+ <addaction name="fileAdd_NetworkAction" />
+ <addaction name="fileEdit_networkAction" />
+ <addaction name="separator" />
+ <addaction name="fileExitAction" />
+ </widget>
+ <widget class="QMenu" name="helpMenu" >
+ <property name="title" >
+ <string>&amp;Help</string>
</property>
+ <addaction name="helpContentsAction" />
+ <addaction name="helpIndexAction" />
+ <addaction name="separator" />
+ <addaction name="helpAboutAction" />
+ </widget>
+ <addaction name="fileMenu" />
+ <addaction name="helpMenu" />
+ </widget>
+ <action name="fileExitAction" >
+ <property name="name" >
+ <cstring>fileExitAction</cstring>
+ </property>
+ <property name="iconText" >
+ <string>Exit</string>
+ </property>
+ <property name="text" >
+ <string>E&amp;xit</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+Q</string>
+ </property>
</action>
- <action>
- <property name="name">
- <cstring>helpContentsAction</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Contents</string>
- </property>
- <property name="menuText">
- <string>&amp;Contents...</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
+ <action name="helpContentsAction" >
+ <property name="name" >
+ <cstring>helpContentsAction</cstring>
+ </property>
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="iconText" >
+ <string>Contents</string>
+ </property>
+ <property name="text" >
+ <string>&amp;Contents...</string>
+ </property>
+ <property name="shortcut" >
+ <string/>
+ </property>
</action>
- <action>
- <property name="name">
- <cstring>helpIndexAction</cstring>
- </property>
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="text">
- <string>Index</string>
- </property>
- <property name="menuText">
- <string>&amp;Index...</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
+ <action name="helpIndexAction" >
+ <property name="name" >
+ <cstring>helpIndexAction</cstring>
+ </property>
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="iconText" >
+ <string>Index</string>
+ </property>
+ <property name="text" >
+ <string>&amp;Index...</string>
+ </property>
+ <property name="shortcut" >
+ <string/>
+ </property>
</action>
- <action>
- <property name="name">
- <cstring>helpAboutAction</cstring>
- </property>
- <property name="text">
- <string>About</string>
- </property>
- <property name="menuText">
- <string>&amp;About</string>
- </property>
- <property name="accel">
- <string></string>
- </property>
+ <action name="helpAboutAction" >
+ <property name="name" >
+ <cstring>helpAboutAction</cstring>
+ </property>
+ <property name="iconText" >
+ <string>About</string>
+ </property>
+ <property name="text" >
+ <string>&amp;About</string>
+ </property>
+ <property name="shortcut" >
+ <string/>
+ </property>
</action>
- <action>
- <property name="name">
- <cstring>fileEventHistoryAction</cstring>
- </property>
- <property name="text">
- <string>Event History</string>
- </property>
- <property name="menuText">
- <string>Event &amp;History</string>
- </property>
+ <action name="fileEventHistoryAction" >
+ <property name="name" >
+ <cstring>fileEventHistoryAction</cstring>
+ </property>
+ <property name="iconText" >
+ <string>Event History</string>
+ </property>
+ <property name="text" >
+ <string>Event &amp;History</string>
+ </property>
</action>
- <action>
- <property name="name">
- <cstring>fileAdd_NetworkAction</cstring>
- </property>
- <property name="text">
- <string>Add Network</string>
- </property>
- <property name="menuText">
- <string>&amp;Add Network</string>
- </property>
+ <action name="fileAdd_NetworkAction" >
+ <property name="name" >
+ <cstring>fileAdd_NetworkAction</cstring>
+ </property>
+ <property name="iconText" >
+ <string>Add Network</string>
+ </property>
+ <property name="text" >
+ <string>&amp;Add Network</string>
+ </property>
</action>
- <action>
- <property name="name">
- <cstring>fileEdit_networkAction</cstring>
- </property>
- <property name="text">
- <string>Edit Network</string>
- </property>
- <property name="menuText">
- <string>&amp;Edit Network</string>
- </property>
+ <action name="fileEdit_networkAction" >
+ <property name="name" >
+ <cstring>fileEdit_networkAction</cstring>
+ </property>
+ <property name="iconText" >
+ <string>Edit Network</string>
+ </property>
+ <property name="text" >
+ <string>&amp;Edit Network</string>
+ </property>
</action>
-</actions>
-<connections>
- <connection>
- <sender>helpIndexAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>helpIndex()</slot>
- </connection>
- <connection>
- <sender>helpContentsAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>helpContents()</slot>
- </connection>
- <connection>
- <sender>helpAboutAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>helpAbout()</slot>
- </connection>
- <connection>
- <sender>fileExitAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>close()</slot>
- </connection>
- <connection>
- <sender>disconnectButton</sender>
- <signal>clicked()</signal>
- <receiver>WpaGui</receiver>
- <slot>disconnect()</slot>
- </connection>
- <connection>
- <sender>scanButton</sender>
- <signal>clicked()</signal>
- <receiver>WpaGui</receiver>
- <slot>scan()</slot>
- </connection>
- <connection>
- <sender>connectButton</sender>
- <signal>clicked()</signal>
- <receiver>WpaGui</receiver>
- <slot>connectB()</slot>
- </connection>
- <connection>
- <sender>fileEventHistoryAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>eventHistory()</slot>
- </connection>
- <connection>
- <sender>networkSelect</sender>
- <signal>activated(const QString&amp;)</signal>
- <receiver>WpaGui</receiver>
- <slot>selectNetwork(const QString&amp;)</slot>
- </connection>
- <connection>
- <sender>fileEdit_networkAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>editNetwork()</slot>
- </connection>
- <connection>
- <sender>fileAdd_NetworkAction</sender>
- <signal>activated()</signal>
- <receiver>WpaGui</receiver>
- <slot>addNetwork()</slot>
- </connection>
-</connections>
-<includes>
- <include location="global" impldecl="in declaration">qtimer.h</include>
- <include location="global" impldecl="in declaration">qsocketnotifier.h</include>
- <include location="local" impldecl="in declaration">wpamsg.h</include>
- <include location="local" impldecl="in declaration">eventhistory.h</include>
- <include location="local" impldecl="in declaration">scanresults.h</include>
- <include location="local" impldecl="in implementation">wpa_ctrl.h</include>
- <include location="global" impldecl="in implementation">dirent.h</include>
- <include location="global" impldecl="in implementation">qmessagebox.h</include>
- <include location="global" impldecl="in implementation">qapplication.h</include>
- <include location="local" impldecl="in implementation">userdatarequest.h</include>
- <include location="local" impldecl="in implementation">networkconfig.h</include>
- <include location="local" impldecl="in implementation">wpagui.ui.h</include>
-</includes>
-<forwards>
- <forward>class UserDataRequest;</forward>
-</forwards>
-<variables>
- <variable access="private">ScanResults *scanres;</variable>
- <variable access="private">bool networkMayHaveChanged;</variable>
- <variable access="private">char *ctrl_iface;</variable>
- <variable access="private">EventHistory *eh;</variable>
- <variable access="private">struct wpa_ctrl *ctrl_conn;</variable>
- <variable access="private">QSocketNotifier *msgNotifier;</variable>
- <variable access="private">QTimer *timer;</variable>
- <variable access="private">int pingsToStatusUpdate;</variable>
- <variable access="private">WpaMsgList msgs;</variable>
- <variable access="private">char *ctrl_iface_dir;</variable>
- <variable access="private">struct wpa_ctrl *monitor_conn;</variable>
- <variable access="private">UserDataRequest *udr;</variable>
-</variables>
-<slots>
- <slot>parse_argv()</slot>
- <slot>updateStatus()</slot>
- <slot>updateNetworks()</slot>
- <slot>helpIndex()</slot>
- <slot>helpContents()</slot>
- <slot>helpAbout()</slot>
- <slot>disconnect()</slot>
- <slot>scan()</slot>
- <slot>eventHistory()</slot>
- <slot>ping()</slot>
- <slot>processMsg( char * msg )</slot>
- <slot>processCtrlReq( const char * req )</slot>
- <slot>receiveMsgs()</slot>
- <slot>connectB()</slot>
- <slot>selectNetwork( const QString &amp; sel )</slot>
- <slot>editNetwork()</slot>
- <slot>addNetwork()</slot>
-</slots>
-<functions>
- <function access="private" specifier="non virtual">init()</function>
- <function access="private" specifier="non virtual">destroy()</function>
- <function access="private" specifier="non virtual" returnType="int">openCtrlConnection( const char * ifname )</function>
- <function returnType="int">ctrlRequest( const char * cmd, char * buf, size_t * buflen )</function>
- <function>triggerUpdate()</function>
-</functions>
-<pixmapinproject/>
-<layoutdefaults spacing="6" margin="11"/>
-</UI>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
+ <includes>
+ <include location="global" >qtimer.h</include>
+ <include location="global" >qsocketnotifier.h</include>
+ <include location="local" >wpamsg.h</include>
+ <include location="local" >eventhistory.h</include>
+ <include location="local" >scanresults.h</include>
+ </includes>
+</ui>
diff --git a/contrib/wpa_supplicant/wpa_gui-qt4/wpamsg.h b/contrib/wpa_supplicant/wpa_gui-qt4/wpamsg.h
index 0808e1f..65ce2e8 100644
--- a/contrib/wpa_supplicant/wpa_gui-qt4/wpamsg.h
+++ b/contrib/wpa_supplicant/wpa_gui-qt4/wpamsg.h
@@ -1,3 +1,17 @@
+/*
+ * wpa_gui - WpaMsg class for storing event messages
+ * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
#ifndef WPAMSG_H
#define WPAMSG_H
@@ -6,21 +20,21 @@
class WpaMsg {
public:
- WpaMsg() {}
- WpaMsg(const QString &_msg, int _priority = 2)
- : msg(_msg), priority(_priority)
- {
- timestamp = QDateTime::currentDateTime();
- }
-
- QString getMsg() const { return msg; }
- int getPriority() const { return priority; }
- QDateTime getTimestamp() const { return timestamp; }
-
+ WpaMsg() {}
+ WpaMsg(const QString &_msg, int _priority = 2)
+ : msg(_msg), priority(_priority)
+ {
+ timestamp = QDateTime::currentDateTime();
+ }
+
+ QString getMsg() const { return msg; }
+ int getPriority() const { return priority; }
+ QDateTime getTimestamp() const { return timestamp; }
+
private:
- QString msg;
- int priority;
- QDateTime timestamp;
+ QString msg;
+ int priority;
+ QDateTime timestamp;
};
typedef QLinkedList<WpaMsg> WpaMsgList;
OpenPOWER on IntegriCloud