kcms/users: refactor cropping
Original commit message(s)
- kcms/users: forward cropping errors
this surfaces errors in the UI through the KJob infrastructure
- kcms/users: refactor cropping
this makes it so cropping works more consistently and more efficiently
at the heart of the cropping we now hold a qtemporaryfile into which we write the cropped image. lifetime of the file is managed through a unique_ptr so they get cleaned up consistently. by using qtemporaryfile we avoid general TOCTOU problems.
when the face doesn't change we don't change anything.
the crop value gets reset after applying a crop so later image changes get the correct new (possibly null) crop rather than the old (possibly not null) crop
cropping still happens inside the User class. this is necessary so the preview before applying is actually crop.
Reason for the change
The previous code was subject to file name clashing, file name stealing, didn't crop correctly in all scenarios, didn't surface errors
Test plan
- set character avatar
- set konqi avatar
- set picture avatar without changing crop
- set picture avatar with changing crop
- set character avatar