[Purpose Plugin] Detect cancelling the prompt more reliable
ClosedPublic

Authored by broulik on Apr 10 2020, 10:18 AM.

Details

Summary

aboutToHide is emitted before an action is triggered and activeAction() is the action currently hovered.
This means we can't properly tell that the prompt got canceled, when hovering an action and then hitting Escape to close the menu.
This patch sets a property in response to triggered and then does a delayed check for that in aboutToHide.

Test Plan

5.18 please
Used https://alligator.io/js/web-share-api/ for testing

  • Clicked "Share me!" button, got purpose prompt, clicked Email, shared correctly
  • Clicked "Share me!" button, got purpose prompt, clicked outside, canceled correctly

With this patch

  • Clicked "Share me!" button, hovered an action, then hit Escape to cancel it. Now cancels properly.

Previously it would effectively break the plugin as it would never reset its pending reply state.

Diff Detail

Repository
R856 Plasma Browser Integration
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.Apr 10 2020, 10:18 AM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 10 2020, 10:18 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Apr 10 2020, 10:18 AM
broulik updated this revision to Diff 79754.
broulik edited the test plan for this revision. (Show Details)
  • Use QMetaObject::invokeMethod with lambda. It's older than I thought it was :)
fvogt accepted this revision.Apr 10 2020, 10:29 AM

Looks fragile, but I don't have a better idea either.

https://bugreports.qt.io/browse/QTBUG-56761 sigh

This revision is now accepted and ready to land.Apr 10 2020, 10:29 AM
This revision was automatically updated to reflect the committed changes.