summaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-22 09:38:56 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-05-22 09:38:56 -0500
commit275e69dfd3f7e0017deef1ec5b262f5af83d75f0 (patch)
treefa0e40a85ee641e00a04775d4ffac7683d0fc70b /ui
parentbb58a013f4dc10a359d786ce157d53408fd4fcdd (diff)
downloadhorizon-275e69dfd3f7e0017deef1ec5b262f5af83d75f0.tar.gz
horizon-275e69dfd3f7e0017deef1ec5b262f5af83d75f0.tar.bz2
horizon-275e69dfd3f7e0017deef1ec5b262f5af83d75f0.tar.xz
horizon-275e69dfd3f7e0017deef1ec5b262f5af83d75f0.zip
Qt UI: Settle on Netsurf, implement Captive Portal support
Diffstat (limited to 'ui')
-rw-r--r--ui/qt5/intropage.cc6
-rw-r--r--ui/qt5/netdhcppage.cc43
-rw-r--r--ui/qt5/netdhcppage.hh2
3 files changed, 32 insertions, 19 deletions
diff --git a/ui/qt5/intropage.cc b/ui/qt5/intropage.cc
index 2cbbbe2..f0c80ee 100644
--- a/ui/qt5/intropage.cc
+++ b/ui/qt5/intropage.cc
@@ -49,10 +49,10 @@ IntroPage::IntroPage(QWidget *parent) : HorizonWizardPage(parent) {
QProcess p;
p.execute("partitionmanager");
});
- /*connect(toolMenu->addAction("&Web Browser"), &QAction::triggered, [=](void){
+ connect(toolMenu->addAction("&Web Browser"), &QAction::triggered, [=](void){
QProcess p;
- p.execute("otter-browser");
- });*/
+ p.execute("netsurf-gtk");
+ });
toolButton->setMenu(toolMenu);
descLabel = new QLabel(
diff --git a/ui/qt5/netdhcppage.cc b/ui/qt5/netdhcppage.cc
index ed4d394..5a16af2 100644
--- a/ui/qt5/netdhcppage.cc
+++ b/ui/qt5/netdhcppage.cc
@@ -40,11 +40,20 @@ NetDHCPPage::NetDHCPPage(QWidget *parent) : HorizonWizardPage(parent) {
logview.exec();
});
+ authButton = new QPushButton(tr("Authenticate"));
+ authButton->setHidden(true);
+ authButton->setWhatsThis(tr("Opens a browser window where you can authenticate to this network."));
+ connect(authButton, &QPushButton::clicked, [=] {
+ QProcess p;
+ p.execute("netsurf-gtk", {"http://distfiles.adelielinux.org/horizon.txt"});
+ });
+
QVBoxLayout *overallLayout = new QVBoxLayout(this);
overallLayout->addWidget(progress);
overallLayout->addSpacing(40);
overallLayout->addWidget(information);
overallLayout->addWidget(logButton, 0, Qt::AlignCenter);
+ overallLayout->addWidget(authButton, 0, Qt::AlignCenter);
}
void NetDHCPPage::startDHCP() {
@@ -89,6 +98,9 @@ void NetDHCPPage::checkInet() {
}
void NetDHCPPage::inetFinished() {
+ QVariant redirUrl;
+ QByteArray result;
+
assert(inetReply);
if(inetReply->error()) {
@@ -96,25 +108,22 @@ void NetDHCPPage::inetFinished() {
information->setText(tr("Couldn't connect to %1: %2")
.arg(QString::fromStdString(horizonWizard()->mirror_domain))
.arg(inetReply->errorString()));
- inetReply->deleteLater();
- inetReply = nullptr;
- return;
+ goto cleanReply;
}
- const QVariant redirUrl = inetReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
+ redirUrl = inetReply->attribute(QNetworkRequest::RedirectionTargetAttribute);
if(!redirUrl.isNull()) {
- progress->setStepStatus(1, StepProgressWidget::Failed);
- /* XXX TODO BAD UNIMPLEMENTED !!!! LOOK AT ME DO NOT RELEASE YET !!!! */
- information->setText(tr("Received redirect to %2 while connecting to %1."
- "God help us if we don't ship Otter Browser and have to handle captive portals with QtWebKitWidgets.")
+ progress->stepPassed(1);
+ information->setText(tr("Received redirect to %2 while connecting to %1. "
+ "You may need to authenticate to this network before continuing. "
+ "Choose 'Authenticate' and close the browser window when you have successfully connected.")
.arg(QString::fromStdString(horizonWizard()->mirror_domain))
.arg(redirUrl.toUrl().toString()));
- inetReply->deleteLater();
- inetReply = nullptr;
- return;
+ authButton->setHidden(false);
+ goto goOnline;
}
- QByteArray result = inetReply->readAll();
+ result = inetReply->readAll();
if(result.size() != 3 || result[0] != 'O' || result[1] != 'K' ||
result[2] != '\n') {
QString res_str(result.left(512));
@@ -123,17 +132,21 @@ void NetDHCPPage::inetFinished() {
information->setText(tr("Received unexpected %3 byte reply from %1: %2")
.arg(QString::fromStdString(horizonWizard()->mirror_domain))
.arg(res_str).arg(result.size()));
- inetReply->deleteLater();
- inetReply = nullptr;
- return;
+ goto goOnline;
}
progress->stepPassed(1);
information->setText(tr("Your computer has successfully connected to the network. You may now proceed."));
+goOnline:
online = true;
emit completeChanged();
+
+cleanReply:
+ inetReply->deleteLater();
+ inetReply = nullptr;
+ return;
}
void NetDHCPPage::initializePage() {
diff --git a/ui/qt5/netdhcppage.hh b/ui/qt5/netdhcppage.hh
index 0d54ba5..5d0f3fd 100644
--- a/ui/qt5/netdhcppage.hh
+++ b/ui/qt5/netdhcppage.hh
@@ -30,7 +30,7 @@ public:
private:
StepProgressWidget *progress;
QLabel *information;
- QPushButton *logButton;
+ QPushButton *logButton, *authButton;
QNetworkAccessManager qnam;
QNetworkReply *inetReply;