The problem occurs in the following situation:
Widgets and such often change state and emit they're changed on the
initial load. This is typically a bug, but easy to hit and hard to find.
To resolve this KCModule::showEvent() queues up a
KCModule::changed(false) after loading. It hides the problem for
widgets.
This ends up causing a bigger problem for the QML side.
If during load ConfigModule::setNeedsSave(true) is called we set
d->_needsSave to true
We emit ConfigModule::changed(true) which we proxy through to
KCModule::changed(true)
We then process the queued KCModule::setChanged(false) from the earlier
KCModule::showEvent so we disable the button
But problematically any subsequent changes in the KCM which call
ConfigModule::setNeedsSave(true) now no-op and don't get proxied.
This patch resolves the issue by keeping the syncronisation between
KCModule and ConfigModule working in both directions.
It is an alternative to D27452. It's not as neat but it's safer.
BUG: 411584