summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-16 13:43:00 -0600
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-12-16 13:43:00 -0600
commit23c5d80678f45d9fd6c8afb057ba33f0ddc46f9d (patch)
tree186b9b3cc399b0cab1780b5f8640c6ac4239558b
parentb11e7dfbd89b839f47aa72f6cf280eab841963f0 (diff)
downloadhorizon-23c5d80678f45d9fd6c8afb057ba33f0ddc46f9d.tar.gz
horizon-23c5d80678f45d9fd6c8afb057ba33f0ddc46f9d.tar.bz2
horizon-23c5d80678f45d9fd6c8afb057ba33f0ddc46f9d.tar.xz
horizon-23c5d80678f45d9fd6c8afb057ba33f0ddc46f9d.zip
Qt UI: Maybe handle associating correctly
-rw-r--r--ui/qt5/netsimplewifipage.cc31
1 files changed, 26 insertions, 5 deletions
diff --git a/ui/qt5/netsimplewifipage.cc b/ui/qt5/netsimplewifipage.cc
index bb08fc1..b9dc3f1 100644
--- a/ui/qt5/netsimplewifipage.cc
+++ b/ui/qt5/netsimplewifipage.cc
@@ -335,17 +335,38 @@ bool NetworkSimpleWirelessPage::validatePage() {
connNotify = new QSocketNotifier(wpactrl_fd(&control), QSocketNotifier::Read, this);
connect(connNotify, &QSocketNotifier::activated, [=](int) {
- QString status;
-
if(wpactrl_update(&control) < 0) {
dialog->setLabelText(tr("Issue communicating with wireless subsystem."));
} else {
- char *msg = wpactrl_msg(&control);
- if(msg == nullptr) {
+ char *raw_msg = wpactrl_msg(&control);
+ if(raw_msg == nullptr) {
return;
}
wpactrl_ackmsg(&control);
- qDebug() << msg;
+ QString msg(raw_msg);
+ msg = msg.remove(0, 3);
+
+ if(msg.startsWith("CTRL-EVENT-CONNECTED")) {
+ /* Happy day! */
+ dialog->setRange(0, 1);
+ dialog->setValue(1);
+ dialog->setLabelText(tr("Connected."));
+ } else if(msg.startsWith("CTRL-EVENT-ASSOC-REJECT")) {
+ dialog->hide();
+ QMessageBox::critical(this, tr("Could Not Connect"),
+ tr("An issue occurred connecting to the specified wireless network. "
+ "You may need to move closer to your wireless gateway, or reset your hardware and try again.\n\n"
+ "Technical details: %1").arg(msg));
+ } else if(msg.startsWith("CTRL-EVENT-AUTH-REJECT")) {
+ dialog->hide();
+ QMessageBox::critical(this, tr("Could Not Connect"),
+ tr("An issue occurred connecting to the specified wireless network. "
+ "Ensure your passphrase is correct and try again.\n\n"
+ "Technical details: %1").arg(msg));
+ } else {
+ /* unknown message. */
+ return;
+ }
}
connNotify->setEnabled(false);
connNotify->deleteLater();