Port Thumbnail KIO Slave Away from KDELibs4Support
Review Request #122341 - Created Jan. 31, 2015 and submitted
Only major difference would be the lack of fallback to KFMI. Maybe we could implement thumbnail features in KFileMetadata?
Only tested compilation.
Why this change? It's very wrong.
The first arg is a mimetype, therefore you need KMimeTypeTrader.
It compiles with KServiceTypeTrader by stuffing the mimetype into "const QString& serviceType" and by stuffing the servicetype into "const QString &constraint"...
This (which predates this patch) is wrong, it should be QUrl::fromLocalFile(filePath).
And then I would rename this variable to fileUrl or something, to make it clearer that it's a URL.
This will be in the current dir, it should probably be QDir::tempPath() + "/kde-...." instead.
there can be one issue here, if the destination already exists (but couldn't be loaded for some reason, e.g. corrupt file).
KDE::rename would overwrite an existing dest, while QFile::rename doesn't do that.
The proper way to implement "save to temp file and then move over existing destination" is to use QSaveFile. It's a corner case so I'm ok with it being fixed in a later commit. Maybe in this one a QFile::remove on the dest is enough, with a comment "// not atomic! should use QSaveFile"....