Commit b91f05b7 authored by Jan Grulich's avatar Jan Grulich
Browse files

Use QPointer for captive portal notification

parent 1ffef126
...@@ -61,9 +61,6 @@ void PortalMonitor::connectivityChanged(NetworkManager::Connectivity connectivit ...@@ -61,9 +61,6 @@ void PortalMonitor::connectivityChanged(NetworkManager::Connectivity connectivit
connect(m_notification, &KNotification::action1Activated, this, [this] () { connect(m_notification, &KNotification::action1Activated, this, [this] () {
QDesktopServices::openUrl(QUrl("http://networkcheck.kde.org")); QDesktopServices::openUrl(QUrl("http://networkcheck.kde.org"));
}); });
connect(m_notification, &KNotification::closed, this, [this] () {
m_notification = nullptr;
});
} }
if (primaryConnection) { if (primaryConnection) {
...@@ -82,7 +79,6 @@ void PortalMonitor::connectivityChanged(NetworkManager::Connectivity connectivit ...@@ -82,7 +79,6 @@ void PortalMonitor::connectivityChanged(NetworkManager::Connectivity connectivit
if (m_notification) { if (m_notification) {
m_notification->close(); m_notification->close();
} }
m_notification = nullptr;
} }
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <KNotification> #include <KNotification>
#include <QObject> #include <QObject>
#include <QPointer>
class PortalMonitor : public QObject class PortalMonitor : public QObject
{ {
...@@ -39,7 +40,7 @@ private Q_SLOTS: ...@@ -39,7 +40,7 @@ private Q_SLOTS:
void checkConnectivity(); void checkConnectivity();
private: private:
KNotification *m_notification = nullptr; QPointer<KNotification> m_notification;
}; };
#endif // PLASMA_NM_PORTAL_MONITOR_H #endif // PLASMA_NM_PORTAL_MONITOR_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment