PreviewJob: Fix various previewjob issues with remote thumbnails
Previewjob had multiple issues that may have caused some random crashes, especially with remote thumbnails.
This patch fixes following:
Make sure path is not empty with STATE_GETORIG
Network errors etc. can cause the filepath be empty, and then createThumbnail will assert
Download remote file for only the first sequence
Due to how open/save dialog checks for thumbnail sequences, it would keep downloading the same item for every single sequence of the file. Instead, just download it for the initial sequence.
Allow caching of remote thumbnails
We did not cache these thumbnails for some reason, which added to even more unnecessary downloading.
Use ~/.cache instead of /tmp/
Remote items, before thumbnail could be made of them, were downloaded to /tmp/ folder. This is bad.
Instead we now download them to ~/.cache/app/kpreviewjob/pid/UUID.extension
file.
Clean up the temp files
We never cleaned after ourselves when the thumbnail from remote item was made.
This is now fixed by using the shared parameter tempName
instead of using QString tmp
.