Qt's foreach is deprecated and should be replaced with modern C++
range-for loops. Const qualifiers are added to variable declarations
and wrapper in std::as_const as required to prevent unnecessary
clones/detach.
And factored out some duplicated code on the way.
PlasmaQuick::Dialog has it's own WindowType which should be set instead,
otherwise once set NET::WindowType gets smashed by consequent
DialogPrivate::applyType() calls
BUG: 378694
This version is a mostly-from-scratch reimplementation of
the Plasma 1 version.
Some minor-in-scope loose ends are left, both external and
internal to the code; check TODO for whether your issue is
already known.