diff --git a/GPClient/gpclient.cpp b/GPClient/gpclient.cpp index 3de730b..4b2d079 100644 --- a/GPClient/gpclient.cpp +++ b/GPClient/gpclient.cpp @@ -69,7 +69,7 @@ void GPClient::initSystemTrayIcon() connect(systemTrayIcon, &QSystemTrayIcon::activated, this, &GPClient::onSystemTrayActivated); 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); contextMenu->addMenu(gatewaySwitchMenu); contextMenu->addSeparator(); @@ -167,7 +167,7 @@ void GPClient::onSystemTrayActivated(QSystemTrayIcon::ActivationReason reason) switch (reason) { case QSystemTrayIcon::Trigger: case QSystemTrayIcon::DoubleClick: - this->activiate(); + this->activate(); break; default: break; @@ -209,7 +209,7 @@ void GPClient::doConnect() // Display the main window if portal is empty if (portal.isEmpty()) { - activiate(); + activate(); return; } @@ -351,7 +351,7 @@ void GPClient::onGatewayFail(const QString &msg) updateConnectionStatus(VpnStatus::disconnected); } -void GPClient::activiate() +void GPClient::activate() { activateWindow(); showNormal(); diff --git a/GPClient/gpclient.h b/GPClient/gpclient.h index 07ca0fd..f3a15d0 100644 --- a/GPClient/gpclient.h +++ b/GPClient/gpclient.h @@ -20,7 +20,7 @@ public: GPClient(QWidget *parent = nullptr); ~GPClient(); - void activiate(); + void activate(); private slots: void on_connectButton_clicked(); diff --git a/GPClient/main.cpp b/GPClient/main.cpp index 9f57e26..c992e1e 100644 --- a/GPClient/main.cpp +++ b/GPClient/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) GPClient w; w.show(); - QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activiate); + QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::activate); return app.exec(); } diff --git a/GPClient/portalconfigresponse.cpp b/GPClient/portalconfigresponse.cpp index c861991..9db5c56 100644 --- a/GPClient/portalconfigresponse.cpp +++ b/GPClient/portalconfigresponse.cpp @@ -65,6 +65,14 @@ QList PortalConfigResponse::parseGateways(QXmlStreamReader &xmlReader QList gateways; + while (xmlReader.name() != "external"){ + xmlReader.readNext(); + } + + while (xmlReader.name() != "list"){ + xmlReader.readNext(); + } + while (xmlReader.name() != xmlGateways || !xmlReader.isEndElement()) { xmlReader.readNext(); // Parse the gateways -> external -> list -> entry @@ -89,13 +97,15 @@ QMap PortalConfigResponse::parsePriorityRules(QXmlStreamReader &xm QMap priorityRules; - while (xmlReader.name() != "priority-rule" || !xmlReader.isEndElement()) { + while ((xmlReader.name() != "priority-rule" || !xmlReader.isEndElement()) && !xmlReader.hasError()) { xmlReader.readNext(); if (xmlReader.name() == "entry" && xmlReader.isStartElement()) { QString ruleName = xmlReader.attributes().value("name").toString(); // Read the priority tag - xmlReader.readNextStartElement(); + while (xmlReader.name() != "priority"){ + xmlReader.readNext(); + } int ruleValue = xmlReader.readElementText().toUInt(); priorityRules.insert(ruleName, ruleValue); }