dmitrio created this revision.
dmitrio added a project: Frameworks.
dmitrio requested review of this revision.

REVISION SUMMARY
  BUG: 383764
  
  Remove a partially copied file if copyjob was cancelled in the middle of file 
copying.
  
  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.

TEST PLAN
  While I am not sure about automated testing, various manual testing scenarios 
can be suggested:
  
  I.
  
  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 
destination.
  
  II.
  
  1. Start copying a large file(s) to the directory with existing files with 
colliding names
  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.
  For example:
  
  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.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D10663

AFFECTED FILES
  src/core/copyjob.cpp
  src/core/copyjob.h

To: dmitrio
Cc: #frameworks, michaelh

Reply via email to