From 5e406cb7dfe3f7a533f7752c005b8526f0fe1d72 Mon Sep 17 00:00:00 2001 From: Prabindh Sundareson Date: Fri, 29 Nov 2013 21:18:38 +0530 Subject: [PATCH] Qt5 changes --- .../wpa_supplicant/wpa_gui-qt4/addinterface.cpp | 4 +- .../wpa_supplicant/wpa_gui-qt4/addinterface.h | 6 +-- .../wpa_supplicant/wpa_gui-qt4/eventhistory.cpp | 6 +-- .../wpa_supplicant/wpa_gui-qt4/eventhistory.h | 2 +- .../wpa_supplicant/wpa_gui-qt4/main.cpp | 18 +++++---- .../wpa_supplicant/wpa_gui-qt4/networkconfig.cpp | 32 +++++++-------- .../wpa_supplicant/wpa_gui-qt4/networkconfig.h | 2 +- .../wpa_supplicant/wpa_gui-qt4/peers.cpp | 46 +++++++++++----------- .../wpa_supplicant/wpa_gui-qt4/peers.h | 2 +- .../wpa_supplicant/wpa_gui-qt4/scanresults.cpp | 6 +-- .../wpa_supplicant/wpa_gui-qt4/scanresults.h | 2 +- .../wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp | 4 +- .../wpa_supplicant/wpa_gui-qt4/userdatarequest.h | 2 +- .../wpa_supplicant/wpa_gui-qt4/wpa_gui.pro | 2 + .../wpa_supplicant/wpa_gui-qt4/wpagui.cpp | 35 ++++++++-------- .../wpa_supplicant/wpa_gui-qt4/wpagui.h | 6 +-- 16 files changed, 91 insertions(+), 84 deletions(-) diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.cpp index 27cbdd6..bd73a43 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.cpp @@ -41,8 +41,8 @@ AddInterface::AddInterface(WpaGui *_wpagui, QWidget *parent) interfaceWidget->headerItem()->setText(0, tr("driver")); interfaceWidget->headerItem()->setText(1, tr("interface")); interfaceWidget->headerItem()->setText(2, tr("description")); - interfaceWidget->setItemsExpandable(FALSE); - interfaceWidget->setRootIsDecorated(FALSE); + interfaceWidget->setItemsExpandable(false);//FALSE); + interfaceWidget->setRootIsDecorated(false);//FALSE); vboxLayout->addWidget(interfaceWidget); connect(interfaceWidget, diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.h index 1b4c98d..332fc71 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/addinterface.h @@ -11,9 +11,9 @@ #include -#include -#include -#include +#include +#include +#include class WpaGui; diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp index a36085d..b7404b5 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.cpp @@ -73,15 +73,15 @@ void EventListModel::addEvent(QString time, QString msg) } -EventHistory::EventHistory(QWidget *parent, const char *, bool, Qt::WFlags) +EventHistory::EventHistory(QWidget *parent, const char *, bool, Qt::WindowFlags) : QDialog(parent) { setupUi(this); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); - eventListView->setItemsExpandable(FALSE); - eventListView->setRootIsDecorated(FALSE); + eventListView->setItemsExpandable(false);//FALSE); + eventListView->setRootIsDecorated(false); //FALSE); elm = new EventListModel(parent); eventListView->setModel(elm); } diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.h index 3c01aa8..afd7b63 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/eventhistory.h @@ -40,7 +40,7 @@ class EventHistory : public QDialog, public Ui::EventHistory public: EventHistory(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); + bool modal = false, Qt::WindowFlags fl = 0); ~EventHistory(); public slots: diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/main.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/main.cpp index 73d677c..aadef1e 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/main.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/main.cpp @@ -6,10 +6,13 @@ * See README for more details. */ +//hack +#define QT_NO_SESSIONMANAGER + #ifdef CONFIG_NATIVE_WINDOWS #include #endif /* CONFIG_NATIVE_WINDOWS */ -#include +#include #include #include #include "wpagui.h" @@ -18,28 +21,27 @@ class WpaGuiApp : public QApplication { public: - WpaGuiApp(int &argc, char **argv); + WpaGuiApp(int argc, char **argv); #ifndef QT_NO_SESSIONMANAGER - virtual void saveState(QSessionManager &manager); + void saveState(); #endif WpaGui *w; }; -WpaGuiApp::WpaGuiApp(int &argc, char **argv) : QApplication(argc, argv) +WpaGuiApp::WpaGuiApp(int argc, char **argv) : QApplication(argc, argv) { } #ifndef QT_NO_SESSIONMANAGER -void WpaGuiApp::saveState(QSessionManager &manager) +void WpaGuiApp::saveState() { - QApplication::saveState(manager); + QApplication::saveState(); w->saveState(); } #endif - int main(int argc, char *argv[]) { WpaGuiApp app(argc, argv); @@ -54,7 +56,7 @@ int main(int argc, char *argv[]) translator.load("wpa_gui_" + locale, "lang"); app.installTranslator(&translator); - WpaGui w(&app); + WpaGui w(&app, 0, 0, 0, argc, argv); #ifdef CONFIG_NATIVE_WINDOWS WSADATA wsaData; diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp index 737c41c..6a9c4f4 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.cpp @@ -26,7 +26,7 @@ enum { #define WPA_GUI_KEY_DATA "[key is configured]" -NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool, Qt::WFlags) +NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool, Qt::WindowFlags) : QDialog(parent) { setupUi(this); @@ -237,7 +237,7 @@ void NetworkConfig::addNetwork() } else id = edit_network_id; - setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(), + setNetworkParam(id, "ssid", ssidEdit->text().toLatin1().constData(), true); const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL; @@ -291,14 +291,14 @@ void NetworkConfig::addNetwork() setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false); } if (pskEdit->isEnabled() && - strcmp(pskEdit->text().toAscii().constData(), + strcmp(pskEdit->text().toLatin1().constData(), WPA_GUI_KEY_DATA) != 0) setNetworkParam(id, "psk", - pskEdit->text().toAscii().constData(), + pskEdit->text().toLatin1().constData(), psklen != 64); if (eapSelect->isEnabled()) { const char *eap = - eapSelect->currentText().toAscii().constData(); + eapSelect->currentText().toLatin1().constData(); setNetworkParam(id, "eap", eap, false); if (strcmp(eap, "SIM") == 0 || strcmp(eap, "AKA") == 0) setNetworkParam(id, "pcsc", "", true); @@ -314,21 +314,21 @@ void NetworkConfig::addNetwork() if (inner.startsWith("EAP-")) snprintf(phase2, sizeof(phase2), "auth=%s", inner.right(inner.size() - 4). - toAscii().constData()); + toLatin1().constData()); } else if (eap.compare("TTLS") == 0) { if (inner.startsWith("EAP-")) snprintf(phase2, sizeof(phase2), "autheap=%s", inner.right(inner.size() - 4). - toAscii().constData()); + toLatin1().constData()); else snprintf(phase2, sizeof(phase2), "auth=%s", - inner.toAscii().constData()); + inner.toLatin1().constData()); } else if (eap.compare("FAST") == 0) { const char *provisioning = NULL; if (inner.startsWith("EAP-")) { snprintf(phase2, sizeof(phase2), "auth=%s", inner.right(inner.size() - 4). - toAscii().constData()); + toLatin1().constData()); provisioning = "fast_provisioning=2"; } else if (inner.compare("GTC(auth) + MSCHAPv2(prov)") == 0) { @@ -354,21 +354,21 @@ void NetworkConfig::addNetwork() setNetworkParam(id, "phase2", "NULL", false); if (identityEdit->isEnabled() && identityEdit->text().length() > 0) setNetworkParam(id, "identity", - identityEdit->text().toAscii().constData(), + identityEdit->text().toLatin1().constData(), true); else setNetworkParam(id, "identity", "NULL", false); if (passwordEdit->isEnabled() && passwordEdit->text().length() > 0 && - strcmp(passwordEdit->text().toAscii().constData(), + strcmp(passwordEdit->text().toLatin1().constData(), WPA_GUI_KEY_DATA) != 0) setNetworkParam(id, "password", - passwordEdit->text().toAscii().constData(), + passwordEdit->text().toLatin1().constData(), true); else if (passwordEdit->text().length() == 0) setNetworkParam(id, "password", "NULL", false); if (cacertEdit->isEnabled() && cacertEdit->text().length() > 0) setNetworkParam(id, "ca_cert", - cacertEdit->text().toAscii().constData(), + cacertEdit->text().toLatin1().constData(), true); else setNetworkParam(id, "ca_cert", "NULL", false); @@ -388,7 +388,7 @@ void NetworkConfig::addNetwork() if (idstrEdit->isEnabled() && idstrEdit->text().length() > 0) setNetworkParam(id, "id_str", - idstrEdit->text().toAscii().constData(), + idstrEdit->text().toLatin1().constData(), true); else setNetworkParam(id, "id_str", "NULL", false); @@ -396,7 +396,7 @@ void NetworkConfig::addNetwork() if (prioritySpinBox->isEnabled()) { QString prio; prio = prio.setNum(prioritySpinBox->value()); - setNetworkParam(id, "priority", prio.toAscii().constData(), + setNetworkParam(id, "priority", prio.toLatin1().constData(), false); } @@ -468,7 +468,7 @@ void NetworkConfig::writeWepKey(int network_id, QLineEdit *edit, int id) * Assume hex key if only hex characters are present and length matches * with 40, 104, or 128-bit key */ - txt = edit->text().toAscii().constData(); + txt = edit->text().toLatin1().constData(); if (strcmp(txt, WPA_GUI_KEY_DATA) == 0) return; len = strlen(txt); diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.h index 429b648..fd09dec 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/networkconfig.h @@ -20,7 +20,7 @@ class NetworkConfig : public QDialog, public Ui::NetworkConfig public: NetworkConfig(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); + bool modal = false, Qt::WindowFlags fl = 0); ~NetworkConfig(); virtual void paramsFromScanResults(QTreeWidgetItem *sel); diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.cpp index f5aa9f7..536ed49 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.cpp @@ -62,7 +62,7 @@ enum peer_type { }; -Peers::Peers(QWidget *parent, const char *, bool, Qt::WFlags) +Peers::Peers(QWidget *parent, const char *, bool, Qt::WindowFlags) : QDialog(parent) { setupUi(this); @@ -323,13 +323,13 @@ void Peers::enter_pin() if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) { snprintf(cmd, sizeof(cmd), "WPS_ER_PIN %s %s %s", - uuid.toAscii().constData(), - input.get_string().toAscii().constData(), - addr.toAscii().constData()); + uuid.toLatin1().constData(), + input.get_string().toLatin1().constData(), + addr.toLatin1().constData()); } else { snprintf(cmd, sizeof(cmd), "WPS_PIN %s %s", - addr.toAscii().constData(), - input.get_string().toAscii().constData()); + addr.toLatin1().constData(), + input.get_string().toLatin1().constData()); } reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { @@ -868,7 +868,7 @@ void Peers::event_notify(WpaMsg msg) QStandardItem *item = find_addr(addr); if (item == NULL || item->data(peer_role_type).toInt() != PEER_TYPE_ASSOCIATED_STATION) - add_single_station(addr.toAscii().constData()); + add_single_station(addr.toLatin1().constData()); return; } @@ -1350,8 +1350,8 @@ void Peers::ctx_p2p_connect() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s display", - addr.toAscii().constData(), - arg.toAscii().constData()); + addr.toLatin1().constData(), + arg.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1384,8 +1384,8 @@ void Peers::ctx_p2p_connect() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s", - addr.toAscii().constData(), - arg.toAscii().constData()); + addr.toLatin1().constData(), + arg.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1408,7 +1408,7 @@ void Peers::ctx_p2p_req_pin() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_PROV_DISC %s display", - addr.toAscii().constData()); + addr.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1431,7 +1431,7 @@ void Peers::ctx_p2p_show_pin() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_PROV_DISC %s keypad", - addr.toAscii().constData()); + addr.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1452,7 +1452,7 @@ void Peers::ctx_p2p_display_pin() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s pin", - addr.toAscii().constData()); + addr.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1480,8 +1480,8 @@ void Peers::ctx_p2p_display_pin_pd() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s display", - addr.toAscii().constData(), - arg.toAscii().constData()); + addr.toLatin1().constData(), + arg.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1515,8 +1515,8 @@ void Peers::ctx_p2p_enter_pin() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s %s keypad", - addr.toAscii().constData(), - arg.toAscii().constData()); + addr.toLatin1().constData(), + arg.toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; @@ -1535,7 +1535,7 @@ void Peers::ctx_p2p_remove_group() char reply[100]; size_t reply_len; snprintf(cmd, sizeof(cmd), "P2P_GROUP_REMOVE %s", - ctx_item->data(peer_role_ifname).toString().toAscii(). + ctx_item->data(peer_role_ifname).toString().toLatin1(). constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { @@ -1713,13 +1713,13 @@ void Peers::connect_pbc() int peer_type = ctx_item->data(peer_role_type).toInt(); if (peer_type == PEER_TYPE_WPS_ER_ENROLLEE) { snprintf(cmd, sizeof(cmd), "WPS_ER_PBC %s", - ctx_item->data(peer_role_uuid).toString().toAscii(). + ctx_item->data(peer_role_uuid).toString().toLatin1(). constData()); } else if (peer_type == PEER_TYPE_P2P || peer_type == PEER_TYPE_P2P_CLIENT) { snprintf(cmd, sizeof(cmd), "P2P_CONNECT %s pbc", ctx_item->data(peer_role_address).toString(). - toAscii().constData()); + toLatin1().constData()); } else { snprintf(cmd, sizeof(cmd), "WPS_PBC"); } @@ -1750,8 +1750,8 @@ void Peers::learn_ap_config() size_t reply_len; snprintf(cmd, sizeof(cmd), "WPS_ER_LEARN %s %s", - uuid.toAscii().constData(), - input.get_string().toAscii().constData()); + uuid.toLatin1().constData(), + input.get_string().toLatin1().constData()); reply_len = sizeof(reply) - 1; if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) { QMessageBox msg; diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.h index bac77dc..bb73737 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/peers.h @@ -22,7 +22,7 @@ class Peers : public QDialog, public Ui::Peers public: Peers(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); + bool modal = false, Qt::WindowFlags fl = 0); ~Peers(); void setWpaGui(WpaGui *_wpagui); void event_notify(WpaMsg msg); diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.cpp index 063347e..887e39f 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.cpp @@ -14,7 +14,7 @@ #include "networkconfig.h" -ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags) +ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WindowFlags) : QDialog(parent) { setupUi(this); @@ -26,8 +26,8 @@ ScanResults::ScanResults(QWidget *parent, const char *, bool, Qt::WFlags) SLOT(bssSelected(QTreeWidgetItem *))); wpagui = NULL; - scanResultsWidget->setItemsExpandable(FALSE); - scanResultsWidget->setRootIsDecorated(FALSE); + scanResultsWidget->setItemsExpandable(false);//FALSE); + scanResultsWidget->setRootIsDecorated(false);//FALSE); scanResultsWidget->setItemDelegate(new SignalBar(scanResultsWidget)); } diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.h index 4a5842c..2cddd13 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/scanresults.h @@ -20,7 +20,7 @@ class ScanResults : public QDialog, public Ui::ScanResults public: ScanResults(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); + bool modal = false, Qt::WindowFlags fl = 0); ~ScanResults(); public slots: diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp index ba4c9f4..812162e 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.cpp @@ -12,7 +12,7 @@ UserDataRequest::UserDataRequest(QWidget *parent, const char *, bool, - Qt::WFlags) + Qt::WindowFlags) : QDialog(parent) { setupUi(this); @@ -89,6 +89,6 @@ void UserDataRequest::sendReply() QString cmd = QString(WPA_CTRL_RSP) + field + '-' + QString::number(networkid) + ':' + queryEdit->text(); - wpagui->ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + wpagui->ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); accept(); } diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.h index 0d9dbfc..b6d1ad2 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/userdatarequest.h @@ -20,7 +20,7 @@ class UserDataRequest : public QDialog, public Ui::UserDataRequest public: UserDataRequest(QWidget *parent = 0, const char *name = 0, - bool modal = false, Qt::WFlags fl = 0); + bool modal = false, Qt::WindowFlags fl = 0); ~UserDataRequest(); int setParams(WpaGui *_wpagui, const char *reqMsg); diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro index 3c81929..a5d2335 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpa_gui.pro @@ -2,6 +2,8 @@ TEMPLATE = app LANGUAGE = C++ TRANSLATIONS = lang/wpa_gui_de.ts +QT += widgets + CONFIG += qt warn_on release DEFINES += CONFIG_CTRL_IFACE diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.cpp index 42e14f0..54c9bfd 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.cpp +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.cpp @@ -6,6 +6,9 @@ * See README for more details. */ +//hack +#define QT_NO_SESSIONMANAGER + #ifdef CONFIG_NATIVE_WINDOWS #include #endif /* CONFIG_NATIVE_WINDOWS */ @@ -32,7 +35,7 @@ static int wpagui_printf(const char *, ...) } #endif -WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags) +WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WindowFlags, int argc, char ** argv) : QMainWindow(parent), app(_app) { setupUi(this); @@ -135,7 +138,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags) msgNotifier = NULL; ctrl_iface_dir = strdup("/var/run/wpa_supplicant"); - parse_argv(); + parse_argv(argc, argv); #ifndef QT_NO_SESSIONMANAGER if (app->isSessionRestored()) { @@ -157,7 +160,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags) textStatus->setText(tr("connecting to wpa_supplicant")); timer = new QTimer(this); connect(timer, SIGNAL(timeout()), SLOT(ping())); - timer->setSingleShot(FALSE); + timer->setSingleShot(false); //FALSE); timer->start(1000); if (openCtrlConnection(ctrl_iface) < 0) { @@ -229,11 +232,11 @@ void WpaGui::languageChange() } -void WpaGui::parse_argv() +void WpaGui::parse_argv(int argc, char ** argv) { int c; for (;;) { - c = getopt(qApp->argc(), qApp->argv(), "i:p:t"); + c = getopt(argc, argv, "i:p:t"); if (c < 0) break; switch (c) { @@ -978,7 +981,7 @@ void WpaGui::selectNetwork( const QString &sel ) else cmd = "any"; cmd.prepend("SELECT_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); triggerUpdate(); stopWpsRun(false); } @@ -994,11 +997,11 @@ void WpaGui::enableNetwork(const QString &sel) cmd.truncate(cmd.indexOf(':')); else if (!cmd.startsWith("all")) { printf("Invalid editNetwork '%s'\n", - cmd.toAscii().constData()); + cmd.toLatin1().constData()); return; } cmd.prepend("ENABLE_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); triggerUpdate(); } @@ -1013,11 +1016,11 @@ void WpaGui::disableNetwork(const QString &sel) cmd.truncate(cmd.indexOf(':')); else if (!cmd.startsWith("all")) { printf("Invalid editNetwork '%s'\n", - cmd.toAscii().constData()); + cmd.toLatin1().constData()); return; } cmd.prepend("DISABLE_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); triggerUpdate(); } @@ -1103,11 +1106,11 @@ void WpaGui::removeNetwork(const QString &sel) cmd.truncate(cmd.indexOf(':')); else if (!cmd.startsWith("all")) { printf("Invalid editNetwork '%s'\n", - cmd.toAscii().constData()); + cmd.toLatin1().constData()); return; } cmd.prepend("REMOVE_NETWORK "); - ctrlRequest(cmd.toAscii().constData(), reply, &reply_len); + ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len); triggerUpdate(); } @@ -1167,14 +1170,14 @@ int WpaGui::getNetworkDisabled(const QString &sel) int pos = cmd.indexOf(':'); if (pos < 0) { printf("Invalid getNetworkDisabled '%s'\n", - cmd.toAscii().constData()); + cmd.toLatin1().constData()); return -1; } cmd.truncate(pos); cmd.prepend("GET_NETWORK "); cmd.append(" disabled"); - if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) >= 0 + if (ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len) >= 0 && reply_len >= 1) { reply[reply_len] = '\0'; if (!str_match(reply, "FAIL")) @@ -1257,7 +1260,7 @@ void WpaGui::saveConfig() void WpaGui::selectAdapter( const QString & sel ) { - if (openCtrlConnection(sel.toAscii().constData()) < 0) + if (openCtrlConnection(sel.toLatin1().constData()) < 0) printf("Failed to open control connection to " "wpa_supplicant.\n"); updateStatus(); @@ -1557,7 +1560,7 @@ void WpaGui::wpsApPin() size_t reply_len = sizeof(reply); QString cmd("WPS_REG " + bssFromScan + " " + wpsApPinEdit->text()); - if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) < 0) + if (ctrlRequest(cmd.toLatin1().constData(), reply, &reply_len) < 0) return; wpsStatusText->setText(tr("Waiting for AP/Enrollee")); diff --git a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.h b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.h index 340286c..f559a53 100644 --- a/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.h +++ b/wpa_supplicant-2.0/wpa_supplicant/wpa_gui-qt4/wpagui.h @@ -9,7 +9,7 @@ #ifndef WPAGUI_H #define WPAGUI_H -#include +#include #include #include "ui_wpagui.h" #include "addinterface.h" @@ -23,7 +23,7 @@ class WpaGui : public QMainWindow, public Ui::WpaGui public: WpaGui(QApplication *app, QWidget *parent = 0, const char *name = 0, - Qt::WFlags fl = 0); + Qt::WindowFlags fl = 0, int argc = 0, char ** argv = 0); ~WpaGui(); virtual int ctrlRequest(const char *cmd, char *buf, size_t *buflen); @@ -39,7 +39,7 @@ class WpaGui : public QMainWindow, public Ui::WpaGui #endif public slots: - virtual void parse_argv(); + virtual void parse_argv(int argc, char ** argv); virtual void updateStatus(); virtual void updateNetworks(); virtual void helpIndex();