Save portal to settings

This commit is contained in:
Kevin Yue 2020-02-16 17:20:39 +08:00
parent 71d5e96f65
commit c63c494ea4
3 changed files with 7 additions and 1 deletions

View File

@ -13,6 +13,9 @@ GPClient::GPClient(QWidget *parent)
setFixedSize(width(), height());
moveCenter();
settings = new QSettings("com.yuezk.qt", "GPClient");
ui->portalInput->setText(settings->value("portal", "").toString());
QObject::connect(this, &GPClient::connectFailed, [this]() {
ui->connectButton->setDisabled(false);
ui->connectButton->setText("Connect");
@ -47,6 +50,7 @@ GPClient::~GPClient()
delete reply;
delete loginWindow;
delete vpn;
delete settings;
}
void GPClient::on_connectButton_clicked()
@ -55,6 +59,7 @@ void GPClient::on_connectButton_clicked()
if (btnText == "Connect") {
QString portal = ui->portalInput->text();
settings->setValue("portal", portal);
ui->statusLabel->setText("Authenticating...");
ui->connectButton->setDisabled(true);
samlLogin(portal);

View File

@ -38,6 +38,7 @@ private:
QNetworkAccessManager *networkManager;
QNetworkReply *reply;
com::yuezk::qt::GPService *vpn;
QSettings *settings;
void moveCenter();
void samlLogin(const QString portal);

View File

@ -66,7 +66,7 @@
<item>
<widget class="QLineEdit" name="portalInput">
<property name="text">
<string>vpn.microstrategy.com</string>
<string/>
</property>
<property name="placeholderText">
<string>Please enter your portal address</string>