* 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.
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
*/
#include <cstdio>
#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);
if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
if (psklen < 8 || psklen > 64) {
- QMessageBox::warning(this, "WPA Pre-Shared Key Error",
- "WPA-PSK requires a passphrase "
- "of 8 to 63 characters\n"
- "or 64 hex digit PSK");
+ QMessageBox::warning(
+ this,
+ tr("WPA Pre-Shared Key Error"),
+ tr("WPA-PSK requires a passphrase of 8 to 63 "
+ "characters\n"
+ "or 64 hex digit PSK"));
pskEdit->setFocus();
return;
}
if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) {
QRegExp rx("^(\\w|-)+$");
if (rx.indexIn(idstrEdit->text()) < 0) {
- QMessageBox::warning(this, "Network ID Error",
- "Network ID String contains "
- "non-word characters.\n"
- "It must be a simple string, "
- "without spaces, containing\n"
- "only characters in this range: "
- "[A-Za-z0-9_-]\n");
+ QMessageBox::warning(
+ this, tr("Network ID Error"),
+ tr("Network ID String contains non-word "
+ "characters.\n"
+ "It must be a simple string, "
+ "without spaces, containing\n"
+ "only characters in this range: "
+ "[A-Za-z0-9_-]\n"));
idstrEdit->setFocus();
return;
}
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.");
+ QMessageBox::warning(this, "wpa_gui",
+ tr("Failed to add "
+ "network to wpa_supplicant\n"
+ "configuration."));
return;
}
id = atoi(reply);
} else
id = edit_network_id;
- setNetworkParam(id, "ssid", ssidEdit->text().toAscii().constData(),
+ setNetworkParam(id, "ssid", ssidEdit->text().toLocal8Bit().constData(),
true);
const char *key_mgmt = NULL, *proto = NULL, *pairwise = NULL;
setNetworkParam(id, "group", "TKIP CCMP WEP104 WEP40", false);
}
if (pskEdit->isEnabled() &&
- strcmp(pskEdit->text().toAscii().constData(),
+ strcmp(pskEdit->text().toLocal8Bit().constData(),
WPA_GUI_KEY_DATA) != 0)
setNetworkParam(id, "psk",
- pskEdit->text().toAscii().constData(),
+ pskEdit->text().toLocal8Bit().constData(),
psklen != 64);
if (eapSelect->isEnabled()) {
const char *eap =
- eapSelect->currentText().toAscii().constData();
+ eapSelect->currentText().toLocal8Bit().constData();
setNetworkParam(id, "eap", eap, false);
if (strcmp(eap, "SIM") == 0 || strcmp(eap, "AKA") == 0)
setNetworkParam(id, "pcsc", "", true);
if (inner.startsWith("EAP-"))
snprintf(phase2, sizeof(phase2), "auth=%s",
inner.right(inner.size() - 4).
- toAscii().constData());
+ toLocal8Bit().constData());
} else if (eap.compare("TTLS") == 0) {
if (inner.startsWith("EAP-"))
snprintf(phase2, sizeof(phase2), "autheap=%s",
inner.right(inner.size() - 4).
- toAscii().constData());
+ toLocal8Bit().constData());
else
snprintf(phase2, sizeof(phase2), "auth=%s",
- inner.toAscii().constData());
+ inner.toLocal8Bit().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());
+ toLocal8Bit().constData());
provisioning = "fast_provisioning=2";
} else if (inner.compare("GTC(auth) + MSCHAPv2(prov)")
== 0) {
setNetworkParam(id, "phase2", "NULL", false);
if (identityEdit->isEnabled() && identityEdit->text().length() > 0)
setNetworkParam(id, "identity",
- identityEdit->text().toAscii().constData(),
+ identityEdit->text().toLocal8Bit().constData(),
true);
else
setNetworkParam(id, "identity", "NULL", false);
if (passwordEdit->isEnabled() && passwordEdit->text().length() > 0 &&
- strcmp(passwordEdit->text().toAscii().constData(),
+ strcmp(passwordEdit->text().toLocal8Bit().constData(),
WPA_GUI_KEY_DATA) != 0)
setNetworkParam(id, "password",
- passwordEdit->text().toAscii().constData(),
+ passwordEdit->text().toLocal8Bit().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().toLocal8Bit().constData(),
true);
else
setNetworkParam(id, "ca_cert", "NULL", false);
if (idstrEdit->isEnabled() && idstrEdit->text().length() > 0)
setNetworkParam(id, "id_str",
- idstrEdit->text().toAscii().constData(),
+ idstrEdit->text().toLocal8Bit().constData(),
true);
else
setNetworkParam(id, "id_str", "NULL", false);
if (prioritySpinBox->isEnabled()) {
QString prio;
prio = prio.setNum(prioritySpinBox->value());
- setNetworkParam(id, "priority", prio.toAscii().constData(),
+ setNetworkParam(id, "priority", prio.toLocal8Bit().constData(),
false);
}
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.");
+ QMessageBox::warning(this, "wpa_gui",
+ tr("Failed to enable "
+ "network in wpa_supplicant\n"
+ "configuration."));
/* Network was added, so continue anyway */
}
wpagui->triggerUpdate();
* 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().toLocal8Bit().constData();
if (strcmp(txt, WPA_GUI_KEY_DATA) == 0)
return;
len = strlen(txt);
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)
+ if (QMessageBox::information(
+ this, "wpa_gui",
+ tr("This will permanently remove the network\n"
+ "from the configuration. Do you really want\n"
+ "to remove this network?"),
+ tr("Yes"), tr("No")) != 0)
return;
snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id);
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.");
+ tr("Failed to remove network from "
+ "wpa_supplicant\n"
+ "configuration."));
} else {
wpagui->triggerUpdate();
wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);