50
50
#ifdef CONFIG_NATIVE_WINDOWS
51
51
fileStopServiceAction = new QAction(this);
52
52
fileStopServiceAction->setObjectName("Stop Service");
53
fileStopServiceAction->setIconText("Stop Service");
53
fileStopServiceAction->setIconText(tr("Stop Service"));
54
54
fileMenu->insertAction(actionWPS, fileStopServiceAction);
56
56
fileStartServiceAction = new QAction(this);
57
57
fileStartServiceAction->setObjectName("Start Service");
58
fileStartServiceAction->setIconText("Start Service");
58
fileStartServiceAction->setIconText(tr("Start Service"));
59
59
fileMenu->insertAction(fileStopServiceAction, fileStartServiceAction);
61
61
connect(fileStartServiceAction, SIGNAL(triggered()), this,
85
85
connect(fileSaveConfigAction, SIGNAL(triggered()), this,
86
86
SLOT(saveConfig()));
87
87
connect(actionWPS, SIGNAL(triggered()), this, SLOT(wpsDialog()));
88
connect(actionPeers, SIGNAL(triggered()), this, SLOT(peersDialog()));
88
89
connect(fileExitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
89
90
connect(networkAddAction, SIGNAL(triggered()), this,
90
91
SLOT(addNetwork()));
438
static void wpa_gui_msg_cb(char *msg, size_t)
440
/* This should not happen anymore since two control connections are
442
printf("missed message: %s\n", msg);
446
447
int WpaGui::ctrlRequest(const char *cmd, char *buf, size_t *buflen)
450
451
if (ctrl_conn == NULL)
452
ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen,
453
ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), buf, buflen, NULL);
455
455
printf("'%s' command timed out.\n", cmd);
456
456
else if (ret < 0)
463
QString WpaGui::wpaStateTranslate(char *state)
465
if (!strcmp(state, "DISCONNECTED"))
466
return tr("Disconnected");
467
else if (!strcmp(state, "INACTIVE"))
468
return tr("Inactive");
469
else if (!strcmp(state, "SCANNING"))
470
return tr("Scanning");
471
else if (!strcmp(state, "AUTHENTICATING"))
472
return tr("Authenticating");
473
else if (!strcmp(state, "ASSOCIATING"))
474
return tr("Associating");
475
else if (!strcmp(state, "ASSOCIATED"))
476
return tr("Associated");
477
else if (!strcmp(state, "4WAY_HANDSHAKE"))
478
return tr("4-Way Handshake");
479
else if (!strcmp(state, "GROUP_HANDSHAKE"))
480
return tr("Group Handshake");
481
else if (!strcmp(state, "COMPLETED"))
482
return tr("Completed");
484
return tr("Unknown");
463
488
void WpaGui::updateStatus()
465
490
char buf[2048], *start, *end, *pos;
848
880
scanres->updateResults();
849
881
else if (str_match(pos, WPA_EVENT_DISCONNECTED))
850
882
showTrayMessage(QSystemTrayIcon::Information, 3,
851
"Disconnected from network.");
883
tr("Disconnected from network."));
852
884
else if (str_match(pos, WPA_EVENT_CONNECTED)) {
853
885
showTrayMessage(QSystemTrayIcon::Information, 3,
854
"Connection to network established.");
886
tr("Connection to network established."));
855
887
QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus()));
856
888
stopWpsRun(true);
857
889
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) {
858
wpsStatusText->setText("WPS AP in active PBC mode found");
890
wpsStatusText->setText(tr("WPS AP in active PBC mode found"));
859
891
if (textStatus->text() == "INACTIVE" ||
860
892
textStatus->text() == "DISCONNECTED")
861
893
wpaguiTab->setCurrentWidget(wpsTab);
862
wpsInstructions->setText("Press the PBC button on the screen "
863
"to start registration");
894
wpsInstructions->setText(tr("Press the PBC button on the "
895
"screen to start registration"));
864
896
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PIN)) {
865
wpsStatusText->setText("WPS AP with recently selected "
897
wpsStatusText->setText(tr("WPS AP with recently selected "
867
899
if (textStatus->text() == "INACTIVE" ||
868
900
textStatus->text() == "DISCONNECTED")
869
901
wpaguiTab->setCurrentWidget(wpsTab);
870
902
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE)) {
871
wpsStatusText->setText("WPS AP detected");
903
wpsStatusText->setText(tr("WPS AP detected"));
872
904
} else if (str_match(pos, WPS_EVENT_OVERLAP)) {
873
wpsStatusText->setText("PBC mode overlap detected");
874
wpsInstructions->setText("More than one AP is currently in "
875
"active WPS PBC mode. Wait couple of "
876
"minutes and try again");
905
wpsStatusText->setText(tr("PBC mode overlap detected"));
906
wpsInstructions->setText(tr("More than one AP is currently in "
907
"active WPS PBC mode. Wait couple "
908
"of minutes and try again"));
877
909
wpaguiTab->setCurrentWidget(wpsTab);
878
910
} else if (str_match(pos, WPS_EVENT_CRED_RECEIVED)) {
879
wpsStatusText->setText("Network configuration received");
911
wpsStatusText->setText(tr("Network configuration received"));
880
912
wpaguiTab->setCurrentWidget(wpsTab);
881
913
} else if (str_match(pos, WPA_EVENT_EAP_METHOD)) {
882
914
if (strstr(pos, "(WSC)"))
883
wpsStatusText->setText("Registration started");
915
wpsStatusText->setText(tr("Registration started"));
884
916
} else if (str_match(pos, WPS_EVENT_M2D)) {
885
wpsStatusText->setText("Registrar does not yet know PIN");
917
wpsStatusText->setText(tr("Registrar does not yet know PIN"));
886
918
} else if (str_match(pos, WPS_EVENT_FAIL)) {
887
wpsStatusText->setText("Registration failed");
919
wpsStatusText->setText(tr("Registration failed"));
888
920
} else if (str_match(pos, WPS_EVENT_SUCCESS)) {
889
wpsStatusText->setText("Registration succeeded");
921
wpsStatusText->setText(tr("Registration succeeded"));
940
972
size_t reply_len = sizeof(reply);
942
if (cmd.startsWith("Select any")) {
974
if (cmd.contains(QRegExp("^\\d+:")))
975
cmd.truncate(cmd.indexOf(':'));
945
int pos = cmd.indexOf(':');
947
printf("Invalid selectNetwork '%s'\n",
948
cmd.toAscii().constData());
953
978
cmd.prepend("SELECT_NETWORK ");
954
979
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
964
989
size_t reply_len = sizeof(reply);
966
if (!cmd.startsWith("all")) {
967
int pos = cmd.indexOf(':');
969
printf("Invalid enableNetwork '%s'\n",
970
cmd.toAscii().constData());
991
if (cmd.contains(QRegExp("^\\d+:")))
992
cmd.truncate(cmd.indexOf(':'));
993
else if (!cmd.startsWith("all")) {
994
printf("Invalid editNetwork '%s'\n",
995
cmd.toAscii().constData());
975
998
cmd.prepend("ENABLE_NETWORK ");
976
999
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
985
1008
size_t reply_len = sizeof(reply);
987
if (!cmd.startsWith("all")) {
988
int pos = cmd.indexOf(':');
990
printf("Invalid disableNetwork '%s'\n",
991
cmd.toAscii().constData());
1010
if (cmd.contains(QRegExp("^\\d+:")))
1011
cmd.truncate(cmd.indexOf(':'));
1012
else if (!cmd.startsWith("all")) {
1013
printf("Invalid editNetwork '%s'\n",
1014
cmd.toAscii().constData());
996
1017
cmd.prepend("DISABLE_NETWORK ");
997
1018
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
1081
1097
char reply[10];
1082
1098
size_t reply_len = sizeof(reply);
1084
if (cmd.startsWith("Select any"))
1100
if (cmd.contains(QRegExp("^\\d+:")))
1101
cmd.truncate(cmd.indexOf(':'));
1102
else if (!cmd.startsWith("all")) {
1103
printf("Invalid editNetwork '%s'\n",
1104
cmd.toAscii().constData());
1087
if (!cmd.startsWith("all")) {
1088
int pos = cmd.indexOf(':');
1090
printf("Invalid removeNetwork '%s'\n",
1091
cmd.toAscii().constData());
1096
1107
cmd.prepend("REMOVE_NETWORK ");
1097
1108
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
1226
1238
buf[len] = '\0';
1228
1240
if (str_match(buf, "FAIL"))
1229
QMessageBox::warning(this, "Failed to save configuration",
1230
"The configuration could not be saved.\n"
1232
"The update_config=1 configuration option\n"
1233
"must be used for configuration saving to\n"
1241
QMessageBox::warning(
1242
this, tr("Failed to save configuration"),
1243
tr("The configuration could not be saved.\n"
1245
"The update_config=1 configuration option\n"
1246
"must be used for configuration saving to\n"
1247
"be permitted.\n"));
1236
QMessageBox::information(this, "Saved configuration",
1237
"The current configuration was saved."
1249
QMessageBox::information(
1250
this, tr("Saved configuration"),
1251
tr("The current configuration was saved."
1269
1283
tray_menu = new QMenu(this);
1271
disconnectAction = new QAction("&Disconnect", this);
1272
reconnectAction = new QAction("Re&connect", this);
1285
disconnectAction = new QAction(tr("&Disconnect"), this);
1286
reconnectAction = new QAction(tr("Re&connect"), this);
1273
1287
connect(disconnectAction, SIGNAL(triggered()), this,
1274
1288
SLOT(disconnect()));
1275
1289
connect(reconnectAction, SIGNAL(triggered()), this,
1278
1292
tray_menu->addAction(reconnectAction);
1279
1293
tray_menu->addSeparator();
1281
eventAction = new QAction("&Event History", this);
1282
scanAction = new QAction("Scan &Results", this);
1283
statAction = new QAction("S&tatus", this);
1295
eventAction = new QAction(tr("&Event History"), this);
1296
scanAction = new QAction(tr("Scan &Results"), this);
1297
statAction = new QAction(tr("S&tatus"), this);
1284
1298
connect(eventAction, SIGNAL(triggered()), this, SLOT(eventHistory()));
1285
1299
connect(scanAction, SIGNAL(triggered()), this, SLOT(scan()));
1286
1300
connect(statAction, SIGNAL(triggered()), this, SLOT(showTrayStatus()));
1289
1303
tray_menu->addAction(statAction);
1290
1304
tray_menu->addSeparator();
1292
showAction = new QAction("&Show Window", this);
1293
hideAction = new QAction("&Hide Window", this);
1294
quitAction = new QAction("&Quit", this);
1306
showAction = new QAction(tr("&Show Window"), this);
1307
hideAction = new QAction(tr("&Hide Window"), this);
1308
quitAction = new QAction(tr("&Quit"), this);
1295
1309
connect(showAction, SIGNAL(triggered()), this, SLOT(show()));
1296
1310
connect(hideAction, SIGNAL(triggered()), this, SLOT(hide()));
1297
1311
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
1462
1500
wpsPinEdit->setEnabled(false);
1463
if (wpsStatusText->text().compare("WPS AP in active PBC mode found")) {
1464
wpsInstructions->setText("Press the push button on the AP to "
1465
"start the PBC mode.");
1501
if (wpsStatusText->text().compare(tr("WPS AP in active PBC mode found"))) {
1502
wpsInstructions->setText(tr("Press the push button on the AP to "
1503
"start the PBC mode."));
1467
wpsInstructions->setText("If you have not yet done so, press "
1505
wpsInstructions->setText(tr("If you have not yet done so, press "
1468
1506
"the push button on the AP to start "
1471
wpsStatusText->setText("Waiting for Registrar");
1509
wpsStatusText->setText(tr("Waiting for Registrar"));
1472
1510
wpsRunning = true;
1498
1536
bssFromScan = bssid;
1499
1537
wpsApPinEdit->setEnabled(!bssFromScan.isEmpty());
1500
1538
wpsApPinButton->setEnabled(wpsApPinEdit->text().length() == 8);
1501
wpsStatusText->setText("WPS AP selected from scan results");
1502
wpsInstructions->setText("If you want to use an AP device PIN, e.g., "
1539
wpsStatusText->setText(tr("WPS AP selected from scan results"));
1540
wpsInstructions->setText(tr("If you want to use an AP device PIN, e.g., "
1503
1541
"from a label in the device, enter the eight "
1504
"digit AP PIN and click Use AP PIN button.");
1542
"digit AP PIN and click Use AP PIN button."));
1589
1627
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
1591
ErrorMsg(this).showMsg("OpenSCManager failed");
1629
ErrorMsg(this).showMsg(tr("OpenSCManager failed"));
1595
1633
svc = OpenService(scm, WPASVC_NAME, SERVICE_START);
1597
ErrorMsg(this).showMsg("OpenService failed");
1635
ErrorMsg(this).showMsg(tr("OpenService failed"));
1598
1636
CloseServiceHandle(scm);
1602
1640
if (!StartService(svc, 0, NULL)) {
1603
ErrorMsg(this).showMsg("Failed to start wpa_supplicant "
1641
ErrorMsg(this).showMsg(tr("Failed to start wpa_supplicant "
1607
1645
CloseServiceHandle(svc);
1617
1655
scm = OpenSCManager(0, 0, SC_MANAGER_CONNECT);
1619
ErrorMsg(this).showMsg("OpenSCManager failed");
1657
ErrorMsg(this).showMsg(tr("OpenSCManager failed"));
1623
1661
svc = OpenService(scm, WPASVC_NAME, SERVICE_STOP);
1625
ErrorMsg(this).showMsg("OpenService failed");
1663
ErrorMsg(this).showMsg(tr("OpenService failed"));
1626
1664
CloseServiceHandle(scm);
1630
1668
if (!ControlService(svc, SERVICE_CONTROL_STOP, &status)) {
1631
ErrorMsg(this).showMsg("Failed to stop wpa_supplicant "
1669
ErrorMsg(this).showMsg(tr("Failed to stop wpa_supplicant "
1635
1673
CloseServiceHandle(svc);