From 444825dd4e46432346938b98ade360efac252e41 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Sat, 14 Dec 2019 19:30:22 -0600 Subject: Qt UI: First pass at associating with a network --- ui/qt5/netsimplewifipage.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ui/qt5') diff --git a/ui/qt5/netsimplewifipage.cc b/ui/qt5/netsimplewifipage.cc index 65d56c9..12f8301 100644 --- a/ui/qt5/netsimplewifipage.cc +++ b/ui/qt5/netsimplewifipage.cc @@ -18,6 +18,7 @@ #include #ifdef HAS_INSTALL_ENV +# include int scanResults(wpactrl_t *control, char const *s, size_t len, void *page, tain_t *) { NetworkSimpleWirelessPage *our_page = reinterpret_cast(page); return our_page->processScan(control, s, len); @@ -299,6 +300,18 @@ int NetworkSimpleWirelessPage::processScan(wpactrl_t *c, const char *, size_t) { #endif /* HAS_INSTALL_ENV */ bool NetworkSimpleWirelessPage::validatePage() { +#ifdef HAS_INSTALL_ENV + const char *ssid, *pass; + if(passphrase->isHidden()) pass = nullptr; + else pass = passphrase->text().toStdString().c_str(); + ssid = ssidListView->selectedItems()[0]->text().toStdString().c_str(); + + if(wpactrl_associate_g(&control, ssid, pass) == 0) { + 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.")); + return false; + } +#endif /* HAS_INSTALL_ENV */ + /* What a hack! * * Independent Pages means the DHCP page is never cleaned, even when Back -- cgit v1.2.3-70-g09d2