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()
|
void GPClient::onSettingsButtonClicked()
|
||||||
{
|
{
|
||||||
settingsDialog->setClientos(settings::get("clientos", "Linux").toString());
|
settingsDialog->setClientos(settings::get("clientos", "Linux").toString());
|
||||||
|
settingsDialog->setOsVersion(settings::get("os-version", QSysInfo::prettyProductName()).toString());
|
||||||
settingsDialog->show();
|
settingsDialog->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPClient::onSettingsAccepted()
|
void GPClient::onSettingsAccepted()
|
||||||
{
|
{
|
||||||
settings::save("clientos", settingsDialog->clientos());
|
settings::save("clientos", settingsDialog->clientos());
|
||||||
|
settings::save("os-version", settingsDialog->osVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPClient::on_connectButton_clicked()
|
void GPClient::on_connectButton_clicked()
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#include <QtCore/QUrlQuery>
|
#include <QtCore/QUrlQuery>
|
||||||
|
|
||||||
#include "loginparams.h"
|
#include "loginparams.h"
|
||||||
|
#include "gphelper.h"
|
||||||
|
|
||||||
|
using namespace gpclient::helper;
|
||||||
|
|
||||||
LoginParams::LoginParams(const QString clientos)
|
LoginParams::LoginParams(const QString clientos)
|
||||||
{
|
{
|
||||||
@ -14,13 +17,18 @@ LoginParams::LoginParams(const QString clientos)
|
|||||||
params.addQueryItem("ok", "Login");
|
params.addQueryItem("ok", "Login");
|
||||||
params.addQueryItem("direct", "yes");
|
params.addQueryItem("direct", "yes");
|
||||||
params.addQueryItem("clientVer", "4100");
|
params.addQueryItem("clientVer", "4100");
|
||||||
params.addQueryItem("os-version", QUrl::toPercentEncoding(QSysInfo::prettyProductName()));
|
|
||||||
|
|
||||||
// add the clientos parameter if not empty
|
// add the clientos parameter if not empty
|
||||||
if (!clientos.isEmpty()) {
|
if (!clientos.isEmpty()) {
|
||||||
params.addQueryItem("clientos", clientos);
|
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-userauthcookie", "");
|
||||||
params.addQueryItem("portal-prelogonuserauthcookie", "");
|
params.addQueryItem("portal-prelogonuserauthcookie", "");
|
||||||
params.addQueryItem("prelogin-cookie", "");
|
params.addQueryItem("prelogin-cookie", "");
|
||||||
|
@ -32,3 +32,11 @@ QString SettingsDialog::clientos()
|
|||||||
{
|
{
|
||||||
return ui->clientosInput->text();
|
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);
|
void setClientos(QString clientos);
|
||||||
QString clientos();
|
QString clientos();
|
||||||
|
|
||||||
|
void setOsVersion(QString osVersion);
|
||||||
|
QString osVersion();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsDialog *ui;
|
Ui::SettingsDialog *ui;
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>488</width>
|
<width>488</width>
|
||||||
<height>177</height>
|
<height>220</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Value of "clientos":</string>
|
<string>clientos:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -55,7 +55,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -65,6 +65,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user