mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
Read all saved Gateways (for selecting in Systray)
This commit is contained in:
parent
75a24c89cd
commit
2efdc8ac21
@ -446,8 +446,14 @@ bool GPClient::connected() const
|
||||
|
||||
QList<GPGateway> GPClient::allGateways() const
|
||||
{
|
||||
const QString gatewaysJson = settings::get(portal() + "_gateways").toString();
|
||||
return GPGateway::fromJson(gatewaysJson);
|
||||
|
||||
QList<GPGateway> gateways;
|
||||
|
||||
for (auto g :settings::get_all("_gateways$") ){
|
||||
|
||||
gateways.append(GPGateway::fromJson(settings::get(g).toString()));
|
||||
}
|
||||
return gateways;
|
||||
}
|
||||
|
||||
void GPClient::setAllGateways(QList<GPGateway> gateways)
|
||||
|
@ -115,6 +115,12 @@ QVariant gpclient::helper::settings::get(const QString &key, const QVariant &def
|
||||
return _settings->value(key, defaultValue);
|
||||
}
|
||||
|
||||
QStringList gpclient::helper::settings::get_all(const QString &key, const QVariant &defaultValue)
|
||||
{
|
||||
QRegularExpression re(key);
|
||||
return _settings->allKeys().filter(re);
|
||||
}
|
||||
|
||||
void gpclient::helper::settings::save(const QString &key, const QVariant &value)
|
||||
{
|
||||
_settings->setValue(key, value);
|
||||
|
@ -34,6 +34,7 @@ namespace gpclient {
|
||||
static const QStringList reservedKeys {"extraArgs", "clientos"};
|
||||
|
||||
QVariant get(const QString &key, const QVariant &defaultValue = QVariant());
|
||||
QStringList get_all(const QString &key, const QVariant &defaultValue = QVariant());
|
||||
void save(const QString &key, const QVariant &value);
|
||||
void clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user