Also drop some unused once, and fix minor code style issues. This is backportable to KF5.
mentioned in commit ce082e7c