diff --git a/notifier/DiscoverNotifier.h b/notifier/DiscoverNotifier.h --- a/notifier/DiscoverNotifier.h +++ b/notifier/DiscoverNotifier.h @@ -81,7 +81,7 @@ bool m_hasSecurityUpdates = false; bool m_hasUpdates = false; bool m_needsReboot = false; - QNetworkConfigurationManager* const m_manager; + QNetworkConfigurationManager* m_manager = nullptr; }; #endif //ABSTRACTKDEDMODULE_H diff --git a/notifier/DiscoverNotifier.cpp b/notifier/DiscoverNotifier.cpp --- a/notifier/DiscoverNotifier.cpp +++ b/notifier/DiscoverNotifier.cpp @@ -35,7 +35,6 @@ DiscoverNotifier::DiscoverNotifier(QObject * parent) : QObject(parent) - , m_manager(new QNetworkConfigurationManager(this)) { configurationChanged(); @@ -58,8 +57,6 @@ m_timer.setInterval(1000); updateStatusNotifier(); - connect(m_manager, &QNetworkConfigurationManager::onlineStateChanged, this, &DiscoverNotifier::stateChanged); - //Only fetch updates after the system is comfortably booted QTimer::singleShot(10000, this, &DiscoverNotifier::recheckSystemUpdateNeeded); } @@ -120,7 +117,7 @@ { if (m_needsReboot) return RebootRequired; - else if (!m_manager->isOnline()) + else if (m_manager && !m_manager->isOnline()) return Offline; else if (m_hasSecurityUpdates) return SecurityUpdates; @@ -166,6 +163,14 @@ void DiscoverNotifier::recheckSystemUpdateNeeded() { + if (!m_manager) { + m_manager = new QNetworkConfigurationManager(this); + connect(m_manager, &QNetworkConfigurationManager::onlineStateChanged, this, &DiscoverNotifier::stateChanged); + if (!m_manager->isOnline()) { + emit stateChanged(); + } + } + foreach(BackendNotifierModule* module, m_backends) module->recheckSystemUpdateNeeded(); }