Cleanup and fixup KConfig handling for componentchooser
Review Request #127918 - Created May 14, 2016 and submitted
Address David's issues in previous rr's regarding the code.
Default browser is correctly written in both ~/.kde4/share/config/kdeglobals and ~/.config/kdeglobals
That part fixes my bug, so it looks fine to me. But don't forget the other 5 or 6 places where similar code was introduced (in other files in this dir).
The variable name is confusing. This is not the kde4profile, but the one we just wrote, and which we want to copy over to the kde4 world, right?
I guess it could be named "simpleConfig" since that's the only difference with the other KSharedConfig::Ptr from above ("profile").
Update code touched by me in previous commits wrt SimpleConfig. Mouse.cpp is now ugly, but unfortunately necessary to avoid the kconfig bug.
Revision 2 (+26 -17)
This KConfigGroup name is still confusing IMHO. This is NOT the kde4 config. It's the config group we are about to copy to the kde4 config.
Rename to simpleConfigGroup ?
Clear names will prevent more bugs in this code next time someone touches it.
If this patch already changes all users of syncConfigGroup, then maybe it would actually be cleaner to change that to syncKdeglobals, which would take care of simpleConfig + the KConfigGroup. Less duplication + easier to read (one place for the comment that explains why this has to be SimpleConfig).
I even wonder why this is a separate method, it's only used in the sync... method, right?
I would merge it there, making it a single method that takes care of opening both source and kde4 dest, and doing the copyTo. But if what I mean is unclear to you, just ship it and I'll do the refactoring I have in mind.