[Notifications] Improve self-closing behavior
ClosedPublic

Authored by broulik on Dec 18 2019, 10:13 PM.

Details

Summary

When a plasmoid collapses in Active state, the popup is hidden. In Passive state, however, one is returned to the hidden items list, as it cannot tell whether the plasmoid collapsed on its own or because the user clicked the same one in the hidden items list again.
When we clear notifications, plasmoid state updates immediately as a result of model signals, and when we then try to collapse the plasmoid we're already hidden and just returned to the hidden items list.
This patch addresses this by delaying the state change slightly. Futhermore, don't collapse the plasmoid when already hidden as that would just return the user to the hidden items list.

Test Plan

I tried fixing that in System Tray but as I said there's no way for it to tell whether the plasmoid hid "on its own" or because the user clicked it again as the compact rep entirely governs this behavior when expanded. :/ It's ugly but I don't really see a better way.

  • Got a notification, clicked rung bell, cleared it - system tray popup properly closed now
  • Got a notification, opened tray (to mark it as read, plasmoid became passive), closed tray, opened again, cleared it - system tray popup stayed where it was now, previously it would just pointlessly get me to the hidden items list
  • Verified that initial plasmoid state was correct (started normally is passive, started with dnd was active immediately)

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Dec 18 2019, 10:13 PM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 18 2019, 10:13 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Dec 18 2019, 10:13 PM
broulik edited the test plan for this revision. (Show Details)
mart accepted this revision.Dec 20 2019, 8:54 AM
mart added a subscriber: mart.
mart added inline comments.
applets/notifications/package/contents/ui/main.qml
153

closePassivePlasmoid()

This revision is now accepted and ready to land.Dec 20 2019, 8:54 AM
This revision was automatically updated to reflect the committed changes.