Display error when OpenConnect was not found (#81)

This commit is contained in:
Kevin Yue
2021-08-21 19:32:13 +08:00
committed by GitHub
parent 6352e1fb2b
commit 9f9444a72b
5 changed files with 14 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ GPClient::GPClient(QWidget *parent)
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::disconnected, this, &GPClient::onVPNDisconnected);
connect(vpn, &com::yuezk::qt::GPService::error, this, &GPClient::onVPNError);
connect(vpn, &com::yuezk::qt::GPService::logAvailable, this, &GPClient::onVPNLogAvailable);
// 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)
{
PLOGI << log;

View File

@@ -45,6 +45,7 @@ private slots:
void onVPNConnected();
void onVPNDisconnected();
void onVPNError(QString errorMessage);
void onVPNLogAvailable(QString log);
private: