dmitrio created this revision.
dmitrio added a project: Frameworks.
dmitrio requested review of this revision.
Remove a partially copied file if copyjob was cancelled in the middle of file
File is considered to be in the process of being copied after some data block
is actually written (or, to be more precise, slotProcessedSize is called). This
should help us avoid cleaning up by mistake files that existed before the
operation. This also means that in some very rare occasions when user cancels
copying in the very beginning of the operation cleaning up procedure may not
work — which is, I believe, the best result we can obtain without more
significant code changes.
Unlike this proposal <https://phabricator.kde.org/D10635>, my option does not
include handling of the full disk or any other errors. In its current state it
applies only to the case when job gets killed by user.
While I am not sure about automated testing, various manual testing scenarios
can be suggested:
1. Start copying a large file(s) to empty directory
2. Cancel copying
3. File which copying was cancelled should **not** be present at the
1. Start copying a large file(s) to the directory with existing files with
2. Cancel copying (not via "File exists" dialog)
3. Original file should be present at the destination
One may also want to test behavior in situation when it is not possible to
delete the file.
1. Start copying a file to some network folder
2. Turn off network connection
3. Cancel copying
4. File deletion UI should appear in the notifications area. You should now
be able to cancel deletion or wait a bit for an error message.
Cc: #frameworks, michaelh