This patch adds support for truncation for FileJob via creation of a
FileJob->truncate(KIO::filesize_t length) method.
It also implements this function in the file slave.
The patch also adds a "truncating" field to the protocol file, thus making it
possible to determine if a protocol supports this new feature.
Currently within the FileJob class there is no native way to truncate an
open file. To achieve truncation, one has to do a FileJob->read() until the
truncation point and then do a KIO::put() to truncate accordingly. This brings
two undesirable issues:
- Incredibly wasteful and non-performant.
- One has to do IO outside of the FileJob interface. One has to make sure that
during the KIO::put(), there are no open file descriptors (created via
KIO::open()), as they would be invalidated by the KIO::put().
Adding native supports allows cleaner, more performant code and means that
the FileJob class is functionally complete in providing random-access I/O.