Use HLM to store strictMode flag

This commit is contained in:
Mykola Baibuz
2025-02-18 22:26:56 +02:00
parent 7a3520cb20
commit 84d95477cb
10 changed files with 24 additions and 12 deletions
+1 -1
View File
@@ -457,7 +457,7 @@ void AmneziaApplication::initControllers()
QTimer::singleShot(1000, this, [this]() { m_connectionController->openConnection(); });
}
connect(m_settingsController.get(), &SettingsController::amneziaDnsToggled, m_serversModel.get(), &ServersModel::toggleAmneziaDns);
connect(m_settingsController.get(), &SettingsController::strictKillSwitchEnabledChanged, m_vpnConnection.get(), &VpnConnection::onKillswitchModeChanged);
connect(m_settingsController.get(), &SettingsController::strictKillSwitchEnabledChanged, m_vpnConnection.get(), &VpnConnection::onKillSwitchModeChanged);
m_sitesController.reset(new SitesController(m_settings, m_vpnConnection, m_sitesModel));
m_engine->rootContext()->setContextProperty("SitesController", m_sitesController.get());
+1 -1
View File
@@ -256,7 +256,7 @@ bool SettingsController::isStrictKillSwitchEnabled()
void SettingsController::toggleStrictKillSwitch(bool enable)
{
m_settings->setStrictKillSwitchEnabled(enable);
emit strictKillSwitchEnabledChanged();
emit strictKillSwitchEnabledChanged(enable);
}
bool SettingsController::isNotificationPermissionGranted()
+1 -1
View File
@@ -104,7 +104,7 @@ signals:
void secondaryDnsChanged();
void loggingStateChanged();
void killSwitchEnabledChanged();
void strictKillSwitchEnabledChanged();
void strictKillSwitchEnabledChanged(bool enabled);
void restoreBackupFinished();
void changeSettingsFinished(const QString &finishedMessage);
+4 -2
View File
@@ -52,10 +52,12 @@ void VpnConnection::onBytesChanged(quint64 receivedBytes, quint64 sentBytes)
emit bytesChanged(receivedBytes, sentBytes);
}
void VpnConnection::onKillswitchModeChanged()
void VpnConnection::onKillSwitchModeChanged(bool enabled)
{
#ifdef AMNEZIA_DESKTOP
IpcClient::Interface()->refreshKillSwitch();
if (IpcClient::Interface()) {
IpcClient::Interface()->refreshKillSwitch(enabled);
}
#endif
}
+1 -1
View File
@@ -55,7 +55,7 @@ public slots:
void addRoutes(const QStringList &ips);
void deleteRoutes(const QStringList &ips);
void flushDns();
void onKillswitchModeChanged();
void onKillSwitchModeChanged(bool enabled);
signals:
void bytesChanged(quint64 receivedBytes, quint64 sentBytes);