fix: add linux reconnection

This commit is contained in:
NickVs2015
2026-03-26 22:21:12 +03:00
parent bf3d11e5c4
commit 316e64122e
3 changed files with 10 additions and 1 deletions
@@ -44,6 +44,9 @@ void LinuxNetworkWatcher::initialize() {
connect(m_worker, &LinuxNetworkWatcherWorker::wakeup, this,
&NetworkWatcherImpl::wakeup);
connect(m_worker, &LinuxNetworkWatcherWorker::networkChanged, this,
[this]() { emit networkChanged(""); });
// Let's wait a few seconds to allow the UI to be fully loaded and shown.
// This is not strictly needed, but it's better for user experience because
// it makes the UI faster to appear, plus it gives a bit of delay between the
@@ -199,10 +199,14 @@ void LinuxNetworkWatcherWorker::checkDevices() {
void LinuxNetworkWatcherWorker::NMStateChanged(quint32 state)
{
logger.debug() << "NMStateChanged " << state;
if (state == NM_STATE_ASLEEP) {
emit wakeup();
} else if (state >= NM_STATE_CONNECTED_SITE && m_previousNMState < NM_STATE_CONNECTED_SITE) {
emit networkChanged();
}
logger.debug() << "NMStateChanged " << state;
m_previousNMState = state;
}
@@ -24,6 +24,7 @@ class LinuxNetworkWatcherWorker final : public QObject {
signals:
void unsecuredNetwork(const QString& networkName, const QString& networkId);
void wakeup();
void networkChanged();
public slots:
void initialize();
@@ -38,6 +39,7 @@ class LinuxNetworkWatcherWorker final : public QObject {
// initialization. When a property of them changes, we check if the access
// point is active and unsecure.
QStringList m_devicePaths;
quint32 m_previousNMState = 0;
};
#endif // LINUXNETWORKWATCHERWORKER_H