mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-04-02 18:31:50 -04:00
Display error when OpenConnect was not found (#81)
This commit is contained in:
parent
6352e1fb2b
commit
9f9444a72b
@ -31,6 +31,7 @@ GPClient::GPClient(QWidget *parent)
|
|||||||
vpn = new com::yuezk::qt::GPService("com.yuezk.qt.GPService", "/", QDBusConnection::systemBus(), this);
|
vpn = new com::yuezk::qt::GPService("com.yuezk.qt.GPService", "/", QDBusConnection::systemBus(), this);
|
||||||
connect(vpn, &com::yuezk::qt::GPService::connected, this, &GPClient::onVPNConnected);
|
connect(vpn, &com::yuezk::qt::GPService::connected, this, &GPClient::onVPNConnected);
|
||||||
connect(vpn, &com::yuezk::qt::GPService::disconnected, this, &GPClient::onVPNDisconnected);
|
connect(vpn, &com::yuezk::qt::GPService::disconnected, this, &GPClient::onVPNDisconnected);
|
||||||
|
connect(vpn, &com::yuezk::qt::GPService::error, this, &GPClient::onVPNError);
|
||||||
connect(vpn, &com::yuezk::qt::GPService::logAvailable, this, &GPClient::onVPNLogAvailable);
|
connect(vpn, &com::yuezk::qt::GPService::logAvailable, this, &GPClient::onVPNLogAvailable);
|
||||||
|
|
||||||
// Initiallize the context menu of system tray.
|
// Initiallize the context menu of system tray.
|
||||||
@ -477,6 +478,12 @@ void GPClient::onVPNDisconnected()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPClient::onVPNError(QString errorMessage)
|
||||||
|
{
|
||||||
|
updateConnectionStatus(VpnStatus::disconnected);
|
||||||
|
openMessageBox("Failed to connect", errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
void GPClient::onVPNLogAvailable(QString log)
|
void GPClient::onVPNLogAvailable(QString log)
|
||||||
{
|
{
|
||||||
PLOGI << log;
|
PLOGI << log;
|
||||||
|
@ -45,6 +45,7 @@ private slots:
|
|||||||
|
|
||||||
void onVPNConnected();
|
void onVPNConnected();
|
||||||
void onVPNDisconnected();
|
void onVPNDisconnected();
|
||||||
|
void onVPNError(QString errorMessage);
|
||||||
void onVPNLogAvailable(QString log);
|
void onVPNLogAvailable(QString log);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -99,7 +99,8 @@ void GPService::connect(QString server, QString username, QString passwd, QStrin
|
|||||||
|
|
||||||
QString bin = findBinary();
|
QString bin = findBinary();
|
||||||
if (bin == nullptr) {
|
if (bin == nullptr) {
|
||||||
log("Could not found openconnect binary, make sure openconnect is installed, exiting.");
|
log("Could not find openconnect binary, make sure openconnect is installed, exiting.");
|
||||||
|
emit error("The OpenConect CLI was not found, make sure it has been installed!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void connected();
|
void connected();
|
||||||
void disconnected();
|
void disconnected();
|
||||||
|
void error(QString errorMessage);
|
||||||
void logAvailable(QString log);
|
void logAvailable(QString log);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
<signal name="logAvailable">
|
<signal name="logAvailable">
|
||||||
<arg name="log" type="s" />
|
<arg name="log" type="s" />
|
||||||
</signal>
|
</signal>
|
||||||
|
<signal name="error">
|
||||||
|
<arg name="errorMessage" type="s" />
|
||||||
|
</signal>
|
||||||
<method name="connect">
|
<method name="connect">
|
||||||
<arg name="server" type="s" direction="in"/>
|
<arg name="server" type="s" direction="in"/>
|
||||||
<arg name="username" type="s" direction="in"/>
|
<arg name="username" type="s" direction="in"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user