added logic to the connect to vpn button
This commit is contained in:
parent
35d4222c7a
commit
116fa6777b
27 changed files with 293 additions and 125 deletions
|
|
@ -11,13 +11,18 @@ ConnectionController::ConnectionController(const QSharedPointer<ServersModel> &s
|
|||
|
||||
bool ConnectionController::onConnectionButtonClicked()
|
||||
{
|
||||
if (!isConnected) {
|
||||
if (!isConnected()) {
|
||||
openVpnConnection();
|
||||
} else {
|
||||
closeVpnConnection();
|
||||
}
|
||||
}
|
||||
|
||||
bool ConnectionController::isConnected()
|
||||
{
|
||||
return m_isConnected;
|
||||
}
|
||||
|
||||
bool ConnectionController::openVpnConnection()
|
||||
{
|
||||
int serverIndex = m_serversModel->getDefaultServerIndex();
|
||||
|
|
@ -33,7 +38,7 @@ bool ConnectionController::openVpnConnection()
|
|||
//todo error handling
|
||||
qApp->processEvents();
|
||||
emit connectToVpn(serverIndex, credentials, container, containerConfig);
|
||||
isConnected = true;
|
||||
m_isConnected = true;
|
||||
|
||||
|
||||
// int serverIndex = m_settings->defaultServerIndex();
|
||||
|
|
@ -67,5 +72,6 @@ bool ConnectionController::openVpnConnection()
|
|||
bool ConnectionController::closeVpnConnection()
|
||||
{
|
||||
emit disconnectFromVpn();
|
||||
m_isConnected = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue