mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
feat: expose os-version to settings
This commit is contained in:
parent
f552ef6204
commit
2069b7fd8e
@ -69,12 +69,14 @@ void GPClient::setupSettings()
|
||||
void GPClient::onSettingsButtonClicked()
|
||||
{
|
||||
settingsDialog->setClientos(settings::get("clientos", "Linux").toString());
|
||||
settingsDialog->setOsVersion(settings::get("os-version", QSysInfo::prettyProductName()).toString());
|
||||
settingsDialog->show();
|
||||
}
|
||||
|
||||
void GPClient::onSettingsAccepted()
|
||||
{
|
||||
settings::save("clientos", settingsDialog->clientos());
|
||||
settings::save("os-version", settingsDialog->osVersion());
|
||||
}
|
||||
|
||||
void GPClient::on_connectButton_clicked()
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include <QtCore/QUrlQuery>
|
||||
|
||||
#include "loginparams.h"
|
||||
#include "gphelper.h"
|
||||
|
||||
using namespace gpclient::helper;
|
||||
|
||||
LoginParams::LoginParams(const QString clientos)
|
||||
{
|
||||
@ -14,13 +17,18 @@ LoginParams::LoginParams(const QString clientos)
|
||||
params.addQueryItem("ok", "Login");
|
||||
params.addQueryItem("direct", "yes");
|
||||
params.addQueryItem("clientVer", "4100");
|
||||
params.addQueryItem("os-version", QUrl::toPercentEncoding(QSysInfo::prettyProductName()));
|
||||
|
||||
// add the clientos parameter if not empty
|
||||
if (!clientos.isEmpty()) {
|
||||
params.addQueryItem("clientos", clientos);
|
||||
}
|
||||
|
||||
auto osVersion = settings::get("os-version", "").toString();
|
||||
if (osVersion.isEmpty()) {
|
||||
osVersion = QSysInfo::prettyProductName();
|
||||
}
|
||||
params.addQueryItem("os-version", QUrl::toPercentEncoding(osVersion));
|
||||
|
||||
params.addQueryItem("portal-userauthcookie", "");
|
||||
params.addQueryItem("portal-prelogonuserauthcookie", "");
|
||||
params.addQueryItem("prelogin-cookie", "");
|
||||
|
@ -32,3 +32,11 @@ QString SettingsDialog::clientos()
|
||||
{
|
||||
return ui->clientosInput->text();
|
||||
}
|
||||
|
||||
void SettingsDialog::setOsVersion(QString osVersion) {
|
||||
ui->osVersionInput->setText(osVersion);
|
||||
}
|
||||
|
||||
QString SettingsDialog::osVersion() {
|
||||
return ui->osVersionInput->text();
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ public:
|
||||
void setClientos(QString clientos);
|
||||
QString clientos();
|
||||
|
||||
void setOsVersion(QString osVersion);
|
||||
QString osVersion();
|
||||
|
||||
private:
|
||||
Ui::SettingsDialog *ui;
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>488</width>
|
||||
<height>177</height>
|
||||
<height>220</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -44,7 +44,7 @@
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Value of "clientos":</string>
|
||||
<string>clientos:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -55,7 +55,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -65,6 +65,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="osVersionInput"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>os-version:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
|
Loading…
Reference in New Issue
Block a user