mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ccaf93ec31 | ||
|
e08d7d7c4d | ||
|
c14a6ad1d2 |
@@ -69,7 +69,7 @@ void GPClient::initSystemTrayIcon()
|
|||||||
connect(systemTrayIcon, &QSystemTrayIcon::activated, this, &GPClient::onSystemTrayActivated);
|
connect(systemTrayIcon, &QSystemTrayIcon::activated, this, &GPClient::onSystemTrayActivated);
|
||||||
connect(gatewaySwitchMenu, &QMenu::triggered, this, &GPClient::onGatewayChanged);
|
connect(gatewaySwitchMenu, &QMenu::triggered, this, &GPClient::onGatewayChanged);
|
||||||
|
|
||||||
openAction = contextMenu->addAction(QIcon::fromTheme("window-new"), "Open", this, &GPClient::activiate);
|
openAction = contextMenu->addAction(QIcon::fromTheme("window-new"), "Open", this, &GPClient::activate);
|
||||||
connectAction = contextMenu->addAction(QIcon::fromTheme("preferences-system-network"), "Connect", this, &GPClient::doConnect);
|
connectAction = contextMenu->addAction(QIcon::fromTheme("preferences-system-network"), "Connect", this, &GPClient::doConnect);
|
||||||
contextMenu->addMenu(gatewaySwitchMenu);
|
contextMenu->addMenu(gatewaySwitchMenu);
|
||||||
contextMenu->addSeparator();
|
contextMenu->addSeparator();
|
||||||
@@ -167,7 +167,7 @@ void GPClient::onSystemTrayActivated(QSystemTrayIcon::ActivationReason reason)
|
|||||||
switch (reason) {
|
switch (reason) {
|
||||||
case QSystemTrayIcon::Trigger:
|
case QSystemTrayIcon::Trigger:
|
||||||
case QSystemTrayIcon::DoubleClick:
|
case QSystemTrayIcon::DoubleClick:
|
||||||
this->activiate();
|
this->activate();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -209,7 +209,7 @@ void GPClient::doConnect()
|
|||||||
|
|
||||||
// Display the main window if portal is empty
|
// Display the main window if portal is empty
|
||||||
if (portal.isEmpty()) {
|
if (portal.isEmpty()) {
|
||||||
activiate();
|
activate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ void GPClient::onGatewayFail(const QString &msg)
|
|||||||
updateConnectionStatus(VpnStatus::disconnected);
|
updateConnectionStatus(VpnStatus::disconnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPClient::activiate()
|
void GPClient::activate()
|
||||||
{
|
{
|
||||||
activateWindow();
|
activateWindow();
|
||||||
showNormal();
|
showNormal();
|
||||||
|
@@ -20,7 +20,7 @@ public:
|
|||||||
GPClient(QWidget *parent = nullptr);
|
GPClient(QWidget *parent = nullptr);
|
||||||
~GPClient();
|
~GPClient();
|
||||||
|
|
||||||
void activiate();
|
void activate();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_connectButton_clicked();
|
void on_connectButton_clicked();
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
#include <plog/Log.h>
|
#include <plog/Log.h>
|
||||||
#include <plog/Appenders/ColorConsoleAppender.h>
|
#include <plog/Appenders/ColorConsoleAppender.h>
|
||||||
|
|
||||||
static const QString version = "v1.2.5";
|
static const QString version = "v1.2.7";
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -28,10 +28,12 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
SingleApplication app(argc, argv);
|
SingleApplication app(argc, argv);
|
||||||
|
app.setQuitOnLastWindowClosed(false);
|
||||||
|
|
||||||
GPClient w;
|
GPClient w;
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activiate);
|
QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activate);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@@ -65,6 +65,14 @@ QList<GPGateway> PortalConfigResponse::parseGateways(QXmlStreamReader &xmlReader
|
|||||||
|
|
||||||
QList<GPGateway> gateways;
|
QList<GPGateway> gateways;
|
||||||
|
|
||||||
|
while (xmlReader.name() != "external"){
|
||||||
|
xmlReader.readNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
while (xmlReader.name() != "list"){
|
||||||
|
xmlReader.readNext();
|
||||||
|
}
|
||||||
|
|
||||||
while (xmlReader.name() != xmlGateways || !xmlReader.isEndElement()) {
|
while (xmlReader.name() != xmlGateways || !xmlReader.isEndElement()) {
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
// Parse the gateways -> external -> list -> entry
|
// Parse the gateways -> external -> list -> entry
|
||||||
@@ -89,13 +97,15 @@ QMap<QString, int> PortalConfigResponse::parsePriorityRules(QXmlStreamReader &xm
|
|||||||
|
|
||||||
QMap<QString, int> priorityRules;
|
QMap<QString, int> priorityRules;
|
||||||
|
|
||||||
while (xmlReader.name() != "priority-rule" || !xmlReader.isEndElement()) {
|
while ((xmlReader.name() != "priority-rule" || !xmlReader.isEndElement()) && !xmlReader.hasError()) {
|
||||||
xmlReader.readNext();
|
xmlReader.readNext();
|
||||||
|
|
||||||
if (xmlReader.name() == "entry" && xmlReader.isStartElement()) {
|
if (xmlReader.name() == "entry" && xmlReader.isStartElement()) {
|
||||||
QString ruleName = xmlReader.attributes().value("name").toString();
|
QString ruleName = xmlReader.attributes().value("name").toString();
|
||||||
// Read the priority tag
|
// Read the priority tag
|
||||||
xmlReader.readNextStartElement();
|
while (xmlReader.name() != "priority"){
|
||||||
|
xmlReader.readNext();
|
||||||
|
}
|
||||||
int ruleValue = xmlReader.readElementText().toUInt();
|
int ruleValue = xmlReader.readElementText().toUInt();
|
||||||
priorityRules.insert(ruleName, ruleValue);
|
priorityRules.insert(ruleName, ruleValue);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user