[Hotplug Engine] Update actions at runtime and listen for added/removed
ClosedPublic

Authored by broulik on Sep 20 2018, 8:29 AM.

Details

Summary

It would only detect changes to existing device actions but not adding or removing them.
Moreover, the list of actions was never updated at runtime, only the list of predicates for the device.
This causes Device Notifier to pick up added, removed, or modified device actions only on startup.

Test Plan
  • Added a device action, would show up in device notifier right away
  • Renamed a device action, change would be reflected in device notifier right away
  • Removed a device action, would disappear in device notifier right away
  • Changed the predicate of an action to no longer match storage devices, it disappeared right away
  • Invoking actions like "Open in file manager" still works

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.Sep 20 2018, 8:29 AM
Restricted Application added a project: Plasma. · View Herald TranscriptSep 20 2018, 8:29 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Sep 20 2018, 8:29 AM
apol added a subscriber: apol.Sep 20 2018, 8:57 AM

Sorry, very naif review.

dataengines/hotplug/hotplugengine.cpp
152–153

Don't we need to pass the icon and emblems here too?

broulik added inline comments.Sep 20 2018, 9:26 AM
dataengines/hotplug/hotplugengine.cpp
152–153

I don't think so, the icon and emblem don't depend on the predicate but the device's state.

Granted, we currently don't update them *at all* in this dataengine but that's a separate issue. Device Notifier actually queries those from the Solid Device data engine which does seem to update everything correctly.

apol added a comment.Sep 20 2018, 3:22 PM

+1

dataengines/hotplug/hotplugengine.cpp
152–153

Ok, makes sense to me.

bruns added a subscriber: bruns.Sep 20 2018, 11:35 PM
mart accepted this revision.Sep 21 2018, 9:39 AM
This revision is now accepted and ready to land.Sep 21 2018, 9:39 AM
This revision was automatically updated to reflect the committed changes.