[PassiveNotification] Don't start timer until window has focus

Authored by ngraham on Feb 6 2019, 9:12 PM.



WIth this patch, the PassiveNotification's timer only starts when its parent window
has focus. This is important on the desktop where it's common to work with multiple
windows at a time, and otherwise these notifications are very easy to miss, especially
when their parent window is minimized or behind another window.

BUG: 403809
FIXED-IN: 5.56

Thanks to @broulik for the patch!

Test Plan

Open Discover, navigate to Source page, try to remove a Flatpak repo, then cancel the
password prompt and immediately sewitch to another window before the notification fires.
It will sit there on the window as long as it's inactive, and only disappear a few
seconds after the window gets focus.

Diff Detail

R169 Kirigami
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
ngraham created this revision.Feb 6 2019, 9:12 PM
Restricted Application added a project: Kirigami. · View Herald TranscriptFeb 6 2019, 9:12 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ngraham requested review of this revision.Feb 6 2019, 9:12 PM
mart requested changes to this revision.Feb 9 2019, 10:04 AM
mart added inline comments.

this will probably mke the timer always running when the window has focus whether or not there is a notificationshown or not?
something like:

Connections {
onActiveChanged: {
if(root.opacity == 1) {

This revision now requires changes to proceed.Feb 9 2019, 10:04 AM
ngraham added inline comments.Feb 10 2019, 9:20 PM

I don't think so, because this code only runs when showNotification() is called, and the fact that the notification eventually disappears means that the timer has ended, right?

mart accepted this revision.Feb 11 2019, 3:16 PM
This revision is now accepted and ready to land.Feb 11 2019, 3:16 PM
This revision was automatically updated to reflect the committed changes.