mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
feat: add --reset option to gpclient
This commit is contained in:
parent
5788474d7e
commit
fe64b2cd19
@ -40,14 +40,6 @@ GPClient::GPClient(QWidget *parent, IVpn *vpn)
|
||||
initVpnStatus();
|
||||
}
|
||||
|
||||
GPClient::~GPClient()
|
||||
{
|
||||
delete ui;
|
||||
delete vpn;
|
||||
delete settingsDialog;
|
||||
delete settingsButton;
|
||||
}
|
||||
|
||||
void GPClient::setupSettings()
|
||||
{
|
||||
settingsButton = new QPushButton(this);
|
||||
@ -112,7 +104,7 @@ void GPClient::initSystemTrayIcon()
|
||||
connectAction = contextMenu->addAction(QIcon::fromTheme("preferences-system-network"), "Connect", this, &GPClient::doConnect);
|
||||
contextMenu->addMenu(gatewaySwitchMenu);
|
||||
contextMenu->addSeparator();
|
||||
clearAction = contextMenu->addAction(QIcon::fromTheme("edit-clear"), "Reset", this, &GPClient::clearSettings);
|
||||
clearAction = contextMenu->addAction(QIcon::fromTheme("edit-clear"), "Reset", this, &GPClient::reset);
|
||||
quitAction = contextMenu->addAction(QIcon::fromTheme("application-exit"), "Quit", this, &GPClient::quit);
|
||||
|
||||
systemTrayIcon->show();
|
||||
@ -478,7 +470,7 @@ void GPClient::setCurrentGateway(const GPGateway gateway)
|
||||
populateGatewayMenu();
|
||||
}
|
||||
|
||||
void GPClient::clearSettings()
|
||||
void GPClient::reset()
|
||||
{
|
||||
settings::clear();
|
||||
populateGatewayMenu();
|
||||
|
@ -21,7 +21,6 @@ class GPClient : public QMainWindow
|
||||
|
||||
public:
|
||||
GPClient(QWidget *parent, IVpn *vpn);
|
||||
~GPClient();
|
||||
|
||||
void activate();
|
||||
void quit();
|
||||
@ -33,6 +32,7 @@ public:
|
||||
void setCurrentGateway(const GPGateway gateway);
|
||||
|
||||
void doConnect();
|
||||
void reset();
|
||||
|
||||
private slots:
|
||||
void onSettingsButtonClicked();
|
||||
@ -81,8 +81,6 @@ private:
|
||||
SettingsDialog *settingsDialog;
|
||||
QPushButton *settingsButton;
|
||||
|
||||
GatewayAuthenticator *gatewayAuthenticator;
|
||||
|
||||
bool isQuickConnect { false };
|
||||
bool isSwitchingGateway { false };
|
||||
PortalConfigResponse portalConfig;
|
||||
@ -102,7 +100,5 @@ private:
|
||||
|
||||
QList<GPGateway> allGateways() const;
|
||||
void setAllGateways(QList<GPGateway> gateways);
|
||||
|
||||
void clearSettings();
|
||||
};
|
||||
#endif // GPCLIENT_H
|
||||
|
@ -46,6 +46,7 @@ int main(int argc, char *argv[])
|
||||
{"json", "Write the result of the handshake with the GlobalConnect server to stdout as JSON and terminate. Useful for scripting."},
|
||||
{"now", "Do not show the dialog with the connect button; connect immediately instead."},
|
||||
{"start-minimized", "Launch the client minimized."},
|
||||
{"reset", "Reset the client's settings."},
|
||||
});
|
||||
parser.process(app);
|
||||
|
||||
@ -55,7 +56,11 @@ int main(int argc, char *argv[])
|
||||
? static_cast<IVpn*>(new VpnJson(nullptr)) // Print to stdout and exit
|
||||
: static_cast<IVpn*>(new VpnDbus(nullptr)); // Contact GPService daemon via dbus
|
||||
GPClient w(nullptr, vpn);
|
||||
|
||||
parser.isSet("start-minimized") ? w.showMinimized() : w.show();
|
||||
if (parser.isSet("reset")) {
|
||||
w.reset();
|
||||
}
|
||||
|
||||
if (positional.size() > 0) {
|
||||
w.portal(positional.at(0));
|
||||
|
Loading…
Reference in New Issue
Block a user