Avoid nested event processing waiting for DBus queries.
If a plasma-activity-stats queries can reference the current activity
which involves loading from the running daemon. This is typically async
and cached.
If the daemon has not yet loaded or no event loop is running the current
code blocks to wait for a response.
The current code could work processEvents only handles the main thread
not the DBus thread. If we need to wait for a DBus result the right
action in this situation is a blocking DBus call.
Nested event processing is always a terrible anti-pattern and even if it
did work properly can lead to all sorts of issues elsewhere.
To avoid blocking calls in long-running applications which will re-run
queries when the activity changes anyway, it is guarded to only make
blocking calls for headless apps.
BUG: 495974
Edited by David Edmundson