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

View File

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

View File

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