wpa_gui: Convert strings to use tr() in user-visible text
This is in preparation for allowing wpa_gui to be translated.
This commit is contained in:
parent
c56ce48a6f
commit
9086fe4466
6 changed files with 148 additions and 136 deletions
|
@ -35,7 +35,7 @@
|
||||||
AddInterface::AddInterface(WpaGui *_wpagui, QWidget *parent)
|
AddInterface::AddInterface(WpaGui *_wpagui, QWidget *parent)
|
||||||
: QDialog(parent), wpagui(_wpagui)
|
: QDialog(parent), wpagui(_wpagui)
|
||||||
{
|
{
|
||||||
setWindowTitle("Select network interface to add");
|
setWindowTitle(tr("Select network interface to add"));
|
||||||
resize(400, 200);
|
resize(400, 200);
|
||||||
vboxLayout = new QVBoxLayout(this);
|
vboxLayout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
@ -44,9 +44,9 @@ AddInterface::AddInterface(WpaGui *_wpagui, QWidget *parent)
|
||||||
interfaceWidget->setUniformRowHeights(true);
|
interfaceWidget->setUniformRowHeights(true);
|
||||||
interfaceWidget->setSortingEnabled(true);
|
interfaceWidget->setSortingEnabled(true);
|
||||||
interfaceWidget->setColumnCount(3);
|
interfaceWidget->setColumnCount(3);
|
||||||
interfaceWidget->headerItem()->setText(0, "driver");
|
interfaceWidget->headerItem()->setText(0, tr("driver"));
|
||||||
interfaceWidget->headerItem()->setText(1, "interface");
|
interfaceWidget->headerItem()->setText(1, tr("interface"));
|
||||||
interfaceWidget->headerItem()->setText(2, "description");
|
interfaceWidget->headerItem()->setText(2, tr("description"));
|
||||||
interfaceWidget->setItemsExpandable(FALSE);
|
interfaceWidget->setItemsExpandable(FALSE);
|
||||||
interfaceWidget->setRootIsDecorated(FALSE);
|
interfaceWidget->setRootIsDecorated(FALSE);
|
||||||
vboxLayout->addWidget(interfaceWidget);
|
vboxLayout->addWidget(interfaceWidget);
|
||||||
|
@ -218,15 +218,15 @@ void AddInterface::interfaceSelected(QTreeWidgetItem *sel)
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
QMessageBox::warning(this, "wpa_gui",
|
QMessageBox::warning(this, "wpa_gui",
|
||||||
"Add interface command could not be "
|
tr("Add interface command could not be "
|
||||||
"completed.");
|
"completed."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
if (buf[0] != 'O' || buf[1] != 'K') {
|
if (buf[0] != 'O' || buf[1] != 'K') {
|
||||||
QMessageBox::warning(this, "wpa_gui",
|
QMessageBox::warning(this, "wpa_gui",
|
||||||
"Failed to add the interface.");
|
tr("Failed to add the interface."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +235,8 @@ void AddInterface::interfaceSelected(QTreeWidgetItem *sel)
|
||||||
#ifdef CONFIG_NATIVE_WINDOWS
|
#ifdef CONFIG_NATIVE_WINDOWS
|
||||||
if (!addRegistryInterface(sel->text(1))) {
|
if (!addRegistryInterface(sel->text(1))) {
|
||||||
QMessageBox::information(this, "wpa_gui",
|
QMessageBox::information(this, "wpa_gui",
|
||||||
"Failed to add the interface into "
|
tr("Failed to add the interface into "
|
||||||
"registry.");
|
"registry."));
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NATIVE_WINDOWS */
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,9 @@ QVariant EventListModel::headerData(int section, Qt::Orientation orientation,
|
||||||
if (orientation == Qt::Horizontal) {
|
if (orientation == Qt::Horizontal) {
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case 0:
|
case 0:
|
||||||
return QString("Timestamp");
|
return QString(tr("Timestamp"));
|
||||||
case 1:
|
case 1:
|
||||||
return QString("Message");
|
return QString(tr("Message"));
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,10 +197,12 @@ void NetworkConfig::addNetwork()
|
||||||
|
|
||||||
if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
|
if (auth == AUTH_WPA_PSK || auth == AUTH_WPA2_PSK) {
|
||||||
if (psklen < 8 || psklen > 64) {
|
if (psklen < 8 || psklen > 64) {
|
||||||
QMessageBox::warning(this, "WPA Pre-Shared Key Error",
|
QMessageBox::warning(
|
||||||
"WPA-PSK requires a passphrase "
|
this,
|
||||||
"of 8 to 63 characters\n"
|
tr("WPA Pre-Shared Key Error"),
|
||||||
"or 64 hex digit PSK");
|
tr("WPA-PSK requires a passphrase of 8 to 63 "
|
||||||
|
"characters\n"
|
||||||
|
"or 64 hex digit PSK"));
|
||||||
pskEdit->setFocus();
|
pskEdit->setFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -209,13 +211,14 @@ void NetworkConfig::addNetwork()
|
||||||
if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) {
|
if (idstrEdit->isEnabled() && !idstrEdit->text().isEmpty()) {
|
||||||
QRegExp rx("^(\\w|-)+$");
|
QRegExp rx("^(\\w|-)+$");
|
||||||
if (rx.indexIn(idstrEdit->text()) < 0) {
|
if (rx.indexIn(idstrEdit->text()) < 0) {
|
||||||
QMessageBox::warning(this, "Network ID Error",
|
QMessageBox::warning(
|
||||||
"Network ID String contains "
|
this, tr("Network ID Error"),
|
||||||
"non-word characters.\n"
|
tr("Network ID String contains non-word "
|
||||||
"It must be a simple string, "
|
"characters.\n"
|
||||||
"without spaces, containing\n"
|
"It must be a simple string, "
|
||||||
"only characters in this range: "
|
"without spaces, containing\n"
|
||||||
"[A-Za-z0-9_-]\n");
|
"only characters in this range: "
|
||||||
|
"[A-Za-z0-9_-]\n"));
|
||||||
idstrEdit->setFocus();
|
idstrEdit->setFocus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -230,9 +233,10 @@ void NetworkConfig::addNetwork()
|
||||||
if (new_network) {
|
if (new_network) {
|
||||||
wpagui->ctrlRequest("ADD_NETWORK", reply, &reply_len);
|
wpagui->ctrlRequest("ADD_NETWORK", reply, &reply_len);
|
||||||
if (reply[0] == 'F') {
|
if (reply[0] == 'F') {
|
||||||
QMessageBox::warning(this, "wpa_gui", "Failed to add "
|
QMessageBox::warning(this, "wpa_gui",
|
||||||
"network to wpa_supplicant\n"
|
tr("Failed to add "
|
||||||
"configuration.");
|
"network to wpa_supplicant\n"
|
||||||
|
"configuration."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
id = atoi(reply);
|
id = atoi(reply);
|
||||||
|
@ -406,9 +410,10 @@ void NetworkConfig::addNetwork()
|
||||||
reply_len = sizeof(reply);
|
reply_len = sizeof(reply);
|
||||||
wpagui->ctrlRequest(cmd, reply, &reply_len);
|
wpagui->ctrlRequest(cmd, reply, &reply_len);
|
||||||
if (strncmp(reply, "OK", 2) != 0) {
|
if (strncmp(reply, "OK", 2) != 0) {
|
||||||
QMessageBox::warning(this, "wpa_gui", "Failed to enable "
|
QMessageBox::warning(this, "wpa_gui",
|
||||||
"network in wpa_supplicant\n"
|
tr("Failed to enable "
|
||||||
"configuration.");
|
"network in wpa_supplicant\n"
|
||||||
|
"configuration."));
|
||||||
/* Network was added, so continue anyway */
|
/* Network was added, so continue anyway */
|
||||||
}
|
}
|
||||||
wpagui->triggerUpdate();
|
wpagui->triggerUpdate();
|
||||||
|
@ -792,13 +797,12 @@ void NetworkConfig::removeNetwork()
|
||||||
char reply[10], cmd[256];
|
char reply[10], cmd[256];
|
||||||
size_t reply_len;
|
size_t reply_len;
|
||||||
|
|
||||||
if (QMessageBox::information(this, "wpa_gui",
|
if (QMessageBox::information(
|
||||||
"This will permanently remove the "
|
this, "wpa_gui",
|
||||||
"network\n"
|
tr("This will permanently remove the network\n"
|
||||||
"from the configuration. Do you really "
|
"from the configuration. Do you really want\n"
|
||||||
"want\n"
|
"to remove this network?"),
|
||||||
"to remove this network?", "Yes", "No")
|
tr("Yes"), tr("No")) != 0)
|
||||||
!= 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id);
|
snprintf(cmd, sizeof(cmd), "REMOVE_NETWORK %d", edit_network_id);
|
||||||
|
@ -806,9 +810,9 @@ void NetworkConfig::removeNetwork()
|
||||||
wpagui->ctrlRequest(cmd, reply, &reply_len);
|
wpagui->ctrlRequest(cmd, reply, &reply_len);
|
||||||
if (strncmp(reply, "OK", 2) != 0) {
|
if (strncmp(reply, "OK", 2) != 0) {
|
||||||
QMessageBox::warning(this, "wpa_gui",
|
QMessageBox::warning(this, "wpa_gui",
|
||||||
"Failed to remove network from "
|
tr("Failed to remove network from "
|
||||||
"wpa_supplicant\n"
|
"wpa_supplicant\n"
|
||||||
"configuration.");
|
"configuration."));
|
||||||
} else {
|
} else {
|
||||||
wpagui->triggerUpdate();
|
wpagui->triggerUpdate();
|
||||||
wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);
|
wpagui->ctrlRequest("SAVE_CONFIG", reply, &reply_len);
|
||||||
|
|
|
@ -181,7 +181,8 @@ void Peers::context_menu(const QPoint &pos)
|
||||||
menu->addAction(tr("Properties"), this, SLOT(properties()));
|
menu->addAction(tr("Properties"), this, SLOT(properties()));
|
||||||
} else {
|
} else {
|
||||||
ctx_item = NULL;
|
ctx_item = NULL;
|
||||||
menu->addAction(QString("Refresh"), this, SLOT(ctx_refresh()));
|
menu->addAction(QString(tr("Refresh")), this,
|
||||||
|
SLOT(ctx_refresh()));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->exec(peers->mapToGlobal(pos));
|
menu->exec(peers->mapToGlobal(pos));
|
||||||
|
@ -223,7 +224,7 @@ void Peers::enter_pin()
|
||||||
if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) {
|
if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) {
|
||||||
QMessageBox msg;
|
QMessageBox msg;
|
||||||
msg.setIcon(QMessageBox::Warning);
|
msg.setIcon(QMessageBox::Warning);
|
||||||
msg.setText("Failed to set the WPS PIN.");
|
msg.setText(tr("Failed to set the WPS PIN."));
|
||||||
msg.exec();
|
msg.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -920,7 +921,7 @@ void Peers::connect_pbc()
|
||||||
if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) {
|
if (wpagui->ctrlRequest(cmd, reply, &reply_len) < 0) {
|
||||||
QMessageBox msg;
|
QMessageBox msg;
|
||||||
msg.setIcon(QMessageBox::Warning);
|
msg.setIcon(QMessageBox::Warning);
|
||||||
msg.setText("Failed to start WPS PBC.");
|
msg.setText(tr("Failed to start WPS PBC."));
|
||||||
msg.exec();
|
msg.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,15 +64,15 @@ int UserDataRequest::setParams(WpaGui *_wpagui, const char *reqMsg)
|
||||||
networkid = atoi(pos);
|
networkid = atoi(pos);
|
||||||
queryInfo->setText(pos2);
|
queryInfo->setText(pos2);
|
||||||
if (strcmp(tmp, "PASSWORD") == 0) {
|
if (strcmp(tmp, "PASSWORD") == 0) {
|
||||||
queryField->setText("Password: ");
|
queryField->setText(tr("Password: "));
|
||||||
queryEdit->setEchoMode(QLineEdit::Password);
|
queryEdit->setEchoMode(QLineEdit::Password);
|
||||||
} else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
|
} else if (strcmp(tmp, "NEW_PASSWORD") == 0) {
|
||||||
queryField->setText("New password: ");
|
queryField->setText(tr("New password: "));
|
||||||
queryEdit->setEchoMode(QLineEdit::Password);
|
queryEdit->setEchoMode(QLineEdit::Password);
|
||||||
} else if (strcmp(tmp, "IDENTITY") == 0)
|
} else if (strcmp(tmp, "IDENTITY") == 0)
|
||||||
queryField->setText("Identity: ");
|
queryField->setText(tr("Identity: "));
|
||||||
else if (strcmp(tmp, "PASSPHRASE") == 0) {
|
else if (strcmp(tmp, "PASSPHRASE") == 0) {
|
||||||
queryField->setText("Private key passphrase: ");
|
queryField->setText(tr("Private key passphrase: "));
|
||||||
queryEdit->setEchoMode(QLineEdit::Password);
|
queryEdit->setEchoMode(QLineEdit::Password);
|
||||||
} else
|
} else
|
||||||
queryField->setText(field + ":");
|
queryField->setText(field + ":");
|
||||||
|
|
|
@ -50,12 +50,12 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
|
||||||
#ifdef CONFIG_NATIVE_WINDOWS
|
#ifdef CONFIG_NATIVE_WINDOWS
|
||||||
fileStopServiceAction = new QAction(this);
|
fileStopServiceAction = new QAction(this);
|
||||||
fileStopServiceAction->setObjectName("Stop Service");
|
fileStopServiceAction->setObjectName("Stop Service");
|
||||||
fileStopServiceAction->setIconText("Stop Service");
|
fileStopServiceAction->setIconText(tr("Stop Service"));
|
||||||
fileMenu->insertAction(actionWPS, fileStopServiceAction);
|
fileMenu->insertAction(actionWPS, fileStopServiceAction);
|
||||||
|
|
||||||
fileStartServiceAction = new QAction(this);
|
fileStartServiceAction = new QAction(this);
|
||||||
fileStartServiceAction->setObjectName("Start Service");
|
fileStartServiceAction->setObjectName("Start Service");
|
||||||
fileStartServiceAction->setIconText("Start Service");
|
fileStartServiceAction->setIconText(tr("Start Service"));
|
||||||
fileMenu->insertAction(fileStopServiceAction, fileStartServiceAction);
|
fileMenu->insertAction(fileStopServiceAction, fileStartServiceAction);
|
||||||
|
|
||||||
connect(fileStartServiceAction, SIGNAL(triggered()), this,
|
connect(fileStartServiceAction, SIGNAL(triggered()), this,
|
||||||
|
@ -64,7 +64,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
|
||||||
SLOT(stopService()));
|
SLOT(stopService()));
|
||||||
|
|
||||||
addInterfaceAction = new QAction(this);
|
addInterfaceAction = new QAction(this);
|
||||||
addInterfaceAction->setIconText("Add Interface");
|
addInterfaceAction->setIconText(tr("Add Interface"));
|
||||||
fileMenu->insertAction(fileStartServiceAction, addInterfaceAction);
|
fileMenu->insertAction(fileStartServiceAction, addInterfaceAction);
|
||||||
|
|
||||||
connect(addInterfaceAction, SIGNAL(triggered()), this,
|
connect(addInterfaceAction, SIGNAL(triggered()), this,
|
||||||
|
@ -164,7 +164,7 @@ WpaGui::WpaGui(QApplication *_app, QWidget *parent, const char *, Qt::WFlags)
|
||||||
show();
|
show();
|
||||||
|
|
||||||
connectedToService = false;
|
connectedToService = false;
|
||||||
textStatus->setText("connecting to wpa_supplicant");
|
textStatus->setText(tr("connecting to wpa_supplicant"));
|
||||||
timer = new QTimer(this);
|
timer = new QTimer(this);
|
||||||
connect(timer, SIGNAL(timeout()), SLOT(ping()));
|
connect(timer, SIGNAL(timeout()), SLOT(ping()));
|
||||||
timer->setSingleShot(FALSE);
|
timer->setSingleShot(FALSE);
|
||||||
|
@ -340,8 +340,9 @@ int WpaGui::openCtrlConnection(const char *ifname)
|
||||||
first = false;
|
first = false;
|
||||||
if (QMessageBox::warning(
|
if (QMessageBox::warning(
|
||||||
this, qAppName(),
|
this, qAppName(),
|
||||||
"wpa_supplicant service is not running.\n"
|
tr("wpa_supplicant service is not "
|
||||||
"Do you want to start it?",
|
"running.\n"
|
||||||
|
"Do you want to start it?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) ==
|
QMessageBox::Yes | QMessageBox::No) ==
|
||||||
QMessageBox::Yes)
|
QMessageBox::Yes)
|
||||||
startService();
|
startService();
|
||||||
|
@ -468,8 +469,8 @@ void WpaGui::updateStatus()
|
||||||
|
|
||||||
len = sizeof(buf) - 1;
|
len = sizeof(buf) - 1;
|
||||||
if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) {
|
if (ctrl_conn == NULL || ctrlRequest("STATUS", buf, &len) < 0) {
|
||||||
textStatus->setText("Could not get status from "
|
textStatus->setText(tr("Could not get status from "
|
||||||
"wpa_supplicant");
|
"wpa_supplicant"));
|
||||||
textAuthentication->clear();
|
textAuthentication->clear();
|
||||||
textEncryption->clear();
|
textEncryption->clear();
|
||||||
textSsid->clear();
|
textSsid->clear();
|
||||||
|
@ -483,8 +484,8 @@ void WpaGui::updateStatus()
|
||||||
first = false;
|
first = false;
|
||||||
if (QMessageBox::information(
|
if (QMessageBox::information(
|
||||||
this, qAppName(),
|
this, qAppName(),
|
||||||
"No network interfaces in use.\n"
|
tr("No network interfaces in use.\n"
|
||||||
"Would you like to add one?",
|
"Would you like to add one?"),
|
||||||
QMessageBox::Yes | QMessageBox::No) ==
|
QMessageBox::Yes | QMessageBox::No) ==
|
||||||
QMessageBox::Yes)
|
QMessageBox::Yes)
|
||||||
addInterface();
|
addInterface();
|
||||||
|
@ -653,7 +654,7 @@ void WpaGui::updateNetworks()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (networkSelect->count() > 1)
|
if (networkSelect->count() > 1)
|
||||||
networkSelect->addItem("Select any network");
|
networkSelect->addItem(tr("Select any network"));
|
||||||
|
|
||||||
if (!current && first_active >= 0)
|
if (!current && first_active >= 0)
|
||||||
networkSelect->setCurrentIndex(first_active);
|
networkSelect->setCurrentIndex(first_active);
|
||||||
|
@ -854,45 +855,45 @@ void WpaGui::processMsg(char *msg)
|
||||||
scanres->updateResults();
|
scanres->updateResults();
|
||||||
else if (str_match(pos, WPA_EVENT_DISCONNECTED))
|
else if (str_match(pos, WPA_EVENT_DISCONNECTED))
|
||||||
showTrayMessage(QSystemTrayIcon::Information, 3,
|
showTrayMessage(QSystemTrayIcon::Information, 3,
|
||||||
"Disconnected from network.");
|
tr("Disconnected from network."));
|
||||||
else if (str_match(pos, WPA_EVENT_CONNECTED)) {
|
else if (str_match(pos, WPA_EVENT_CONNECTED)) {
|
||||||
showTrayMessage(QSystemTrayIcon::Information, 3,
|
showTrayMessage(QSystemTrayIcon::Information, 3,
|
||||||
"Connection to network established.");
|
tr("Connection to network established."));
|
||||||
QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus()));
|
QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus()));
|
||||||
stopWpsRun(true);
|
stopWpsRun(true);
|
||||||
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) {
|
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) {
|
||||||
wpsStatusText->setText("WPS AP in active PBC mode found");
|
wpsStatusText->setText(tr("WPS AP in active PBC mode found"));
|
||||||
if (textStatus->text() == "INACTIVE" ||
|
if (textStatus->text() == "INACTIVE" ||
|
||||||
textStatus->text() == "DISCONNECTED")
|
textStatus->text() == "DISCONNECTED")
|
||||||
wpaguiTab->setCurrentWidget(wpsTab);
|
wpaguiTab->setCurrentWidget(wpsTab);
|
||||||
wpsInstructions->setText("Press the PBC button on the screen "
|
wpsInstructions->setText(tr("Press the PBC button on the "
|
||||||
"to start registration");
|
"screen to start registration"));
|
||||||
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PIN)) {
|
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PIN)) {
|
||||||
wpsStatusText->setText("WPS AP with recently selected "
|
wpsStatusText->setText(tr("WPS AP with recently selected "
|
||||||
"registrar");
|
"registrar"));
|
||||||
if (textStatus->text() == "INACTIVE" ||
|
if (textStatus->text() == "INACTIVE" ||
|
||||||
textStatus->text() == "DISCONNECTED")
|
textStatus->text() == "DISCONNECTED")
|
||||||
wpaguiTab->setCurrentWidget(wpsTab);
|
wpaguiTab->setCurrentWidget(wpsTab);
|
||||||
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE)) {
|
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE)) {
|
||||||
wpsStatusText->setText("WPS AP detected");
|
wpsStatusText->setText(tr("WPS AP detected"));
|
||||||
} else if (str_match(pos, WPS_EVENT_OVERLAP)) {
|
} else if (str_match(pos, WPS_EVENT_OVERLAP)) {
|
||||||
wpsStatusText->setText("PBC mode overlap detected");
|
wpsStatusText->setText(tr("PBC mode overlap detected"));
|
||||||
wpsInstructions->setText("More than one AP is currently in "
|
wpsInstructions->setText(tr("More than one AP is currently in "
|
||||||
"active WPS PBC mode. Wait couple of "
|
"active WPS PBC mode. Wait couple "
|
||||||
"minutes and try again");
|
"of minutes and try again"));
|
||||||
wpaguiTab->setCurrentWidget(wpsTab);
|
wpaguiTab->setCurrentWidget(wpsTab);
|
||||||
} else if (str_match(pos, WPS_EVENT_CRED_RECEIVED)) {
|
} else if (str_match(pos, WPS_EVENT_CRED_RECEIVED)) {
|
||||||
wpsStatusText->setText("Network configuration received");
|
wpsStatusText->setText(tr("Network configuration received"));
|
||||||
wpaguiTab->setCurrentWidget(wpsTab);
|
wpaguiTab->setCurrentWidget(wpsTab);
|
||||||
} else if (str_match(pos, WPA_EVENT_EAP_METHOD)) {
|
} else if (str_match(pos, WPA_EVENT_EAP_METHOD)) {
|
||||||
if (strstr(pos, "(WSC)"))
|
if (strstr(pos, "(WSC)"))
|
||||||
wpsStatusText->setText("Registration started");
|
wpsStatusText->setText(tr("Registration started"));
|
||||||
} else if (str_match(pos, WPS_EVENT_M2D)) {
|
} else if (str_match(pos, WPS_EVENT_M2D)) {
|
||||||
wpsStatusText->setText("Registrar does not yet know PIN");
|
wpsStatusText->setText(tr("Registrar does not yet know PIN"));
|
||||||
} else if (str_match(pos, WPS_EVENT_FAIL)) {
|
} else if (str_match(pos, WPS_EVENT_FAIL)) {
|
||||||
wpsStatusText->setText("Registration failed");
|
wpsStatusText->setText(tr("Registration failed"));
|
||||||
} else if (str_match(pos, WPS_EVENT_SUCCESS)) {
|
} else if (str_match(pos, WPS_EVENT_SUCCESS)) {
|
||||||
wpsStatusText->setText("Registration succeeded");
|
wpsStatusText->setText(tr("Registration succeeded"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,7 +946,7 @@ void WpaGui::selectNetwork( const QString &sel )
|
||||||
char reply[10];
|
char reply[10];
|
||||||
size_t reply_len = sizeof(reply);
|
size_t reply_len = sizeof(reply);
|
||||||
|
|
||||||
if (cmd.startsWith("Select any")) {
|
if (cmd.compare(tr("Select any network"))) {
|
||||||
cmd = "any";
|
cmd = "any";
|
||||||
} else {
|
} else {
|
||||||
int pos = cmd.indexOf(':');
|
int pos = cmd.indexOf(':');
|
||||||
|
@ -1010,7 +1011,7 @@ void WpaGui::editNetwork(const QString &sel)
|
||||||
QString cmd(sel);
|
QString cmd(sel);
|
||||||
int id = -1;
|
int id = -1;
|
||||||
|
|
||||||
if (!cmd.startsWith("Select any")) {
|
if (!cmd.compare(tr("Select any network"))) {
|
||||||
int pos = sel.indexOf(':');
|
int pos = sel.indexOf(':');
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
printf("Invalid editNetwork '%s'\n",
|
printf("Invalid editNetwork '%s'\n",
|
||||||
|
@ -1039,8 +1040,9 @@ void WpaGui::editNetwork(const QString &sel)
|
||||||
void WpaGui::editSelectedNetwork()
|
void WpaGui::editSelectedNetwork()
|
||||||
{
|
{
|
||||||
if (networkSelect->count() < 1) {
|
if (networkSelect->count() < 1) {
|
||||||
QMessageBox::information(this, "No Networks",
|
QMessageBox::information(
|
||||||
"There are no networks to edit.\n");
|
this, tr("No Networks"),
|
||||||
|
tr("There are no networks to edit.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString sel(networkSelect->currentText());
|
QString sel(networkSelect->currentText());
|
||||||
|
@ -1051,9 +1053,9 @@ void WpaGui::editSelectedNetwork()
|
||||||
void WpaGui::editListedNetwork()
|
void WpaGui::editListedNetwork()
|
||||||
{
|
{
|
||||||
if (networkList->currentRow() < 0) {
|
if (networkList->currentRow() < 0) {
|
||||||
QMessageBox::information(this, "Select A Network",
|
QMessageBox::information(this, tr("Select A Network"),
|
||||||
"Select a network from the list to"
|
tr("Select a network from the list to"
|
||||||
" edit it.\n");
|
" edit it.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString sel(networkList->currentItem()->text());
|
QString sel(networkList->currentItem()->text());
|
||||||
|
@ -1087,7 +1089,7 @@ void WpaGui::removeNetwork(const QString &sel)
|
||||||
char reply[10];
|
char reply[10];
|
||||||
size_t reply_len = sizeof(reply);
|
size_t reply_len = sizeof(reply);
|
||||||
|
|
||||||
if (cmd.startsWith("Select any"))
|
if (cmd.compare(tr("Select any network")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!cmd.startsWith("all")) {
|
if (!cmd.startsWith("all")) {
|
||||||
|
@ -1108,8 +1110,9 @@ void WpaGui::removeNetwork(const QString &sel)
|
||||||
void WpaGui::removeSelectedNetwork()
|
void WpaGui::removeSelectedNetwork()
|
||||||
{
|
{
|
||||||
if (networkSelect->count() < 1) {
|
if (networkSelect->count() < 1) {
|
||||||
QMessageBox::information(this, "No Networks",
|
QMessageBox::information(this, tr("No Networks"),
|
||||||
"There are no networks to remove.\n");
|
tr("There are no networks to remove."
|
||||||
|
"\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString sel(networkSelect->currentText());
|
QString sel(networkSelect->currentText());
|
||||||
|
@ -1120,9 +1123,9 @@ void WpaGui::removeSelectedNetwork()
|
||||||
void WpaGui::removeListedNetwork()
|
void WpaGui::removeListedNetwork()
|
||||||
{
|
{
|
||||||
if (networkList->currentRow() < 0) {
|
if (networkList->currentRow() < 0) {
|
||||||
QMessageBox::information(this, "Select A Network",
|
QMessageBox::information(this, tr("Select A Network"),
|
||||||
"Select a network from the list to"
|
tr("Select a network from the list "
|
||||||
" remove it.\n");
|
"to remove it.\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString sel(networkList->currentItem()->text());
|
QString sel(networkList->currentItem()->text());
|
||||||
|
@ -1232,16 +1235,18 @@ void WpaGui::saveConfig()
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
if (str_match(buf, "FAIL"))
|
if (str_match(buf, "FAIL"))
|
||||||
QMessageBox::warning(this, "Failed to save configuration",
|
QMessageBox::warning(
|
||||||
"The configuration could not be saved.\n"
|
this, tr("Failed to save configuration"),
|
||||||
"\n"
|
tr("The configuration could not be saved.\n"
|
||||||
"The update_config=1 configuration option\n"
|
"\n"
|
||||||
"must be used for configuration saving to\n"
|
"The update_config=1 configuration option\n"
|
||||||
"be permitted.\n");
|
"must be used for configuration saving to\n"
|
||||||
|
"be permitted.\n"));
|
||||||
else
|
else
|
||||||
QMessageBox::information(this, "Saved configuration",
|
QMessageBox::information(
|
||||||
"The current configuration was saved."
|
this, tr("Saved configuration"),
|
||||||
"\n");
|
tr("The current configuration was saved."
|
||||||
|
"\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1260,7 +1265,7 @@ void WpaGui::createTrayIcon(bool trayOnly)
|
||||||
QApplication::setQuitOnLastWindowClosed(false);
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
tray_icon = new QSystemTrayIcon(this);
|
tray_icon = new QSystemTrayIcon(this);
|
||||||
tray_icon->setToolTip(qAppName() + " - wpa_supplicant user interface");
|
tray_icon->setToolTip(qAppName() + tr(" - wpa_supplicant user interface"));
|
||||||
if (QImageReader::supportedImageFormats().contains(QByteArray("svg")))
|
if (QImageReader::supportedImageFormats().contains(QByteArray("svg")))
|
||||||
tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg"));
|
tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg"));
|
||||||
else
|
else
|
||||||
|
@ -1274,8 +1279,8 @@ void WpaGui::createTrayIcon(bool trayOnly)
|
||||||
|
|
||||||
tray_menu = new QMenu(this);
|
tray_menu = new QMenu(this);
|
||||||
|
|
||||||
disconnectAction = new QAction("&Disconnect", this);
|
disconnectAction = new QAction(tr("&Disconnect"), this);
|
||||||
reconnectAction = new QAction("Re&connect", this);
|
reconnectAction = new QAction(tr("Re&connect"), this);
|
||||||
connect(disconnectAction, SIGNAL(triggered()), this,
|
connect(disconnectAction, SIGNAL(triggered()), this,
|
||||||
SLOT(disconnect()));
|
SLOT(disconnect()));
|
||||||
connect(reconnectAction, SIGNAL(triggered()), this,
|
connect(reconnectAction, SIGNAL(triggered()), this,
|
||||||
|
@ -1284,9 +1289,9 @@ void WpaGui::createTrayIcon(bool trayOnly)
|
||||||
tray_menu->addAction(reconnectAction);
|
tray_menu->addAction(reconnectAction);
|
||||||
tray_menu->addSeparator();
|
tray_menu->addSeparator();
|
||||||
|
|
||||||
eventAction = new QAction("&Event History", this);
|
eventAction = new QAction(tr("&Event History"), this);
|
||||||
scanAction = new QAction("Scan &Results", this);
|
scanAction = new QAction(tr("Scan &Results"), this);
|
||||||
statAction = new QAction("S&tatus", this);
|
statAction = new QAction(tr("S&tatus"), this);
|
||||||
connect(eventAction, SIGNAL(triggered()), this, SLOT(eventHistory()));
|
connect(eventAction, SIGNAL(triggered()), this, SLOT(eventHistory()));
|
||||||
connect(scanAction, SIGNAL(triggered()), this, SLOT(scan()));
|
connect(scanAction, SIGNAL(triggered()), this, SLOT(scan()));
|
||||||
connect(statAction, SIGNAL(triggered()), this, SLOT(showTrayStatus()));
|
connect(statAction, SIGNAL(triggered()), this, SLOT(showTrayStatus()));
|
||||||
|
@ -1295,9 +1300,9 @@ void WpaGui::createTrayIcon(bool trayOnly)
|
||||||
tray_menu->addAction(statAction);
|
tray_menu->addAction(statAction);
|
||||||
tray_menu->addSeparator();
|
tray_menu->addSeparator();
|
||||||
|
|
||||||
showAction = new QAction("&Show Window", this);
|
showAction = new QAction(tr("&Show Window"), this);
|
||||||
hideAction = new QAction("&Hide Window", this);
|
hideAction = new QAction(tr("&Hide Window"), this);
|
||||||
quitAction = new QAction("&Quit", this);
|
quitAction = new QAction(tr("&Quit"), this);
|
||||||
connect(showAction, SIGNAL(triggered()), this, SLOT(show()));
|
connect(showAction, SIGNAL(triggered()), this, SLOT(show()));
|
||||||
connect(hideAction, SIGNAL(triggered()), this, SLOT(hide()));
|
connect(hideAction, SIGNAL(triggered()), this, SLOT(hide()));
|
||||||
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
|
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
|
@ -1428,13 +1433,15 @@ void WpaGui::closeEvent(QCloseEvent *event)
|
||||||
if (QSystemTrayIcon::supportsMessages()) {
|
if (QSystemTrayIcon::supportsMessages()) {
|
||||||
hide();
|
hide();
|
||||||
showTrayMessage(QSystemTrayIcon::Information, 3,
|
showTrayMessage(QSystemTrayIcon::Information, 3,
|
||||||
qAppName() + " will keep running in "
|
qAppName() +
|
||||||
"the system tray.");
|
tr(" will keep running in "
|
||||||
|
"the system tray."));
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, qAppName() + " systray",
|
QMessageBox::information(this, qAppName() +
|
||||||
"The program will keep "
|
tr(" systray"),
|
||||||
"running in the system "
|
tr("The program will keep "
|
||||||
"tray.");
|
"running in the system "
|
||||||
|
"tray."));
|
||||||
}
|
}
|
||||||
ackTrayIcon = true;
|
ackTrayIcon = true;
|
||||||
}
|
}
|
||||||
|
@ -1488,15 +1495,15 @@ void WpaGui::wpsPbc()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wpsPinEdit->setEnabled(false);
|
wpsPinEdit->setEnabled(false);
|
||||||
if (wpsStatusText->text().compare("WPS AP in active PBC mode found")) {
|
if (wpsStatusText->text().compare(tr("WPS AP in active PBC mode found"))) {
|
||||||
wpsInstructions->setText("Press the push button on the AP to "
|
wpsInstructions->setText(tr("Press the push button on the AP to "
|
||||||
"start the PBC mode.");
|
"start the PBC mode."));
|
||||||
} else {
|
} else {
|
||||||
wpsInstructions->setText("If you have not yet done so, press "
|
wpsInstructions->setText(tr("If you have not yet done so, press "
|
||||||
"the push button on the AP to start "
|
"the push button on the AP to start "
|
||||||
"the PBC mode.");
|
"the PBC mode."));
|
||||||
}
|
}
|
||||||
wpsStatusText->setText("Waiting for Registrar");
|
wpsStatusText->setText(tr("Waiting for Registrar"));
|
||||||
wpsRunning = true;
|
wpsRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1513,10 +1520,10 @@ void WpaGui::wpsGeneratePin()
|
||||||
|
|
||||||
wpsPinEdit->setText(reply);
|
wpsPinEdit->setText(reply);
|
||||||
wpsPinEdit->setEnabled(true);
|
wpsPinEdit->setEnabled(true);
|
||||||
wpsInstructions->setText("Enter the generated PIN into the Registrar "
|
wpsInstructions->setText(tr("Enter the generated PIN into the Registrar "
|
||||||
"(either the internal one in the AP or an "
|
"(either the internal one in the AP or an "
|
||||||
"external one).");
|
"external one)."));
|
||||||
wpsStatusText->setText("Waiting for Registrar");
|
wpsStatusText->setText(tr("Waiting for Registrar"));
|
||||||
wpsRunning = true;
|
wpsRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1526,10 +1533,10 @@ void WpaGui::setBssFromScan(const QString &bssid)
|
||||||
bssFromScan = bssid;
|
bssFromScan = bssid;
|
||||||
wpsApPinEdit->setEnabled(!bssFromScan.isEmpty());
|
wpsApPinEdit->setEnabled(!bssFromScan.isEmpty());
|
||||||
wpsApPinButton->setEnabled(wpsApPinEdit->text().length() == 8);
|
wpsApPinButton->setEnabled(wpsApPinEdit->text().length() == 8);
|
||||||
wpsStatusText->setText("WPS AP selected from scan results");
|
wpsStatusText->setText(tr("WPS AP selected from scan results"));
|
||||||
wpsInstructions->setText("If you want to use an AP device PIN, e.g., "
|
wpsInstructions->setText(tr("If you want to use an AP device PIN, e.g., "
|
||||||
"from a label in the device, enter the eight "
|
"from a label in the device, enter the eight "
|
||||||
"digit AP PIN and click Use AP PIN button.");
|
"digit AP PIN and click Use AP PIN button."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1548,7 +1555,7 @@ void WpaGui::wpsApPin()
|
||||||
if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) < 0)
|
if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wpsStatusText->setText("Waiting for AP/Enrollee");
|
wpsStatusText->setText(tr("Waiting for AP/Enrollee"));
|
||||||
wpsRunning = true;
|
wpsRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1556,8 +1563,8 @@ void WpaGui::wpsApPin()
|
||||||
void WpaGui::stopWpsRun(bool success)
|
void WpaGui::stopWpsRun(bool success)
|
||||||
{
|
{
|
||||||
if (wpsRunning)
|
if (wpsRunning)
|
||||||
wpsStatusText->setText(success ? "Connected to the network" :
|
wpsStatusText->setText(success ? tr("Connected to the network") :
|
||||||
"Stopped");
|
tr("Stopped"));
|
||||||
else
|
else
|
||||||
wpsStatusText->setText("");
|
wpsStatusText->setText("");
|
||||||
wpsPinEdit->setEnabled(false);
|
wpsPinEdit->setEnabled(false);
|
||||||
|
@ -1586,7 +1593,7 @@ private:
|
||||||
ErrorMsg::ErrorMsg(QWidget *parent, DWORD last_err) :
|
ErrorMsg::ErrorMsg(QWidget *parent, DWORD last_err) :
|
||||||
QMessageBox(parent), err(last_err)
|
QMessageBox(parent), err(last_err)
|
||||||
{
|
{
|
||||||
setWindowTitle("wpa_gui error");
|
setWindowTitle(tr("wpa_gui error"));
|
||||||
setIcon(QMessageBox::Warning);
|
setIcon(QMessageBox::Warning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,20 +1623,20 @@ void WpaGui::startService()
|
||||||
|
|
||||||
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
||||||
if (!scm) {
|
if (!scm) {
|
||||||
ErrorMsg(this).showMsg("OpenSCManager failed");
|
ErrorMsg(this).showMsg(tr("OpenSCManager failed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
svc = OpenService(scm, WPASVC_NAME, SERVICE_START);
|
svc = OpenService(scm, WPASVC_NAME, SERVICE_START);
|
||||||
if (!svc) {
|
if (!svc) {
|
||||||
ErrorMsg(this).showMsg("OpenService failed");
|
ErrorMsg(this).showMsg(tr("OpenService failed"));
|
||||||
CloseServiceHandle(scm);
|
CloseServiceHandle(scm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StartService(svc, 0, NULL)) {
|
if (!StartService(svc, 0, NULL)) {
|
||||||
ErrorMsg(this).showMsg("Failed to start wpa_supplicant "
|
ErrorMsg(this).showMsg(tr("Failed to start wpa_supplicant "
|
||||||
"service");
|
"service"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(svc);
|
CloseServiceHandle(svc);
|
||||||
|
@ -1644,20 +1651,20 @@ void WpaGui::stopService()
|
||||||
|
|
||||||
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
||||||
if (!scm) {
|
if (!scm) {
|
||||||
ErrorMsg(this).showMsg("OpenSCManager failed");
|
ErrorMsg(this).showMsg(tr("OpenSCManager failed"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
svc = OpenService(scm, WPASVC_NAME, SERVICE_STOP);
|
svc = OpenService(scm, WPASVC_NAME, SERVICE_STOP);
|
||||||
if (!svc) {
|
if (!svc) {
|
||||||
ErrorMsg(this).showMsg("OpenService failed");
|
ErrorMsg(this).showMsg(tr("OpenService failed"));
|
||||||
CloseServiceHandle(scm);
|
CloseServiceHandle(scm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ControlService(svc, SERVICE_CONTROL_STOP, &status)) {
|
if (!ControlService(svc, SERVICE_CONTROL_STOP, &status)) {
|
||||||
ErrorMsg(this).showMsg("Failed to stop wpa_supplicant "
|
ErrorMsg(this).showMsg(tr("Failed to stop wpa_supplicant "
|
||||||
"service");
|
"service"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(svc);
|
CloseServiceHandle(svc);
|
||||||
|
@ -1673,13 +1680,13 @@ bool WpaGui::serviceRunning()
|
||||||
|
|
||||||
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
|
||||||
if (!scm) {
|
if (!scm) {
|
||||||
printf("OpenSCManager failed: %d\n", (int) GetLastError());
|
printf(tr("OpenSCManager failed: %d\n"), (int) GetLastError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
svc = OpenService(scm, WPASVC_NAME, SERVICE_QUERY_STATUS);
|
svc = OpenService(scm, WPASVC_NAME, SERVICE_QUERY_STATUS);
|
||||||
if (!svc) {
|
if (!svc) {
|
||||||
printf("OpenService failed: %d\n\n", (int) GetLastError());
|
printf(tr("OpenService failed: %d\n\n"), (int) GetLastError());
|
||||||
CloseServiceHandle(scm);
|
CloseServiceHandle(scm);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue