Replace old notification when new notification for connection appears
ClosedPublic

Authored by nicolasfella on Apr 8 2020, 11:03 PM.

Details

Summary

When a second notification appears shortly after another, e.g. a wifi network disconnects and then reconnects, replace the first notification with the second one. This avoids having a disconnected and a connected notification simultaneously.

Depends on D28691

Test Plan

dis- and reconnected my wifi

Diff Detail

Repository
R116 Plasma Network Management Applet
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
nicolasfella created this revision.Apr 8 2020, 11:03 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 8 2020, 11:03 PM
Restricted Application added a reviewer: jgrulich. · View Herald Transcript
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
nicolasfella requested review of this revision.Apr 8 2020, 11:03 PM
jgrulich accepted this revision.Apr 9 2020, 6:27 AM
This revision is now accepted and ready to land.Apr 9 2020, 6:27 AM

+1 I've been wanting to do exactly this forever

kded/notification.cpp
431

Avoid double look-up. QHash gives you a null value when not existing, so you can do:

KNotification *notify = m_notifications.value(connectionId);
if (!notify) {
    notify = new KNotification(...);
    ...
    m_notifications.insert(connectionId, notify);
}
nicolasfella marked an inline comment as done.Apr 9 2020, 12:25 PM
This revision was automatically updated to reflect the committed changes.