Ticket #4563: support reget in file move operation.

* (file_op_context_new): change default value of file_op_context_t::do_reget.
  * (overwrite_query_dialog): show the "Reget" button in query dialog for
    move operation.
  * (copy_file_file): keep non-default value of file_op_context_t::do_reget
    that was set before.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2024-07-27 12:19:08 +03:00
parent cd8355bfa8
commit cc34729f45
3 changed files with 8 additions and 4 deletions

View File

@ -2274,8 +2274,12 @@ copy_file_file (file_op_total_context_t *tctx, file_op_context_t *ctx,
vfs_path_t *src_vpath = NULL, *dst_vpath = NULL;
char *buf = NULL;
/* FIXME: We should not be using global variables! */
ctx->do_reget = 0;
/* Keep the non-default value applied in chain of calls:
move_file_file() -> file_progress_real_query_replace()
move_file_file() -> copy_file_file() */
if (ctx->do_reget < 0)
ctx->do_reget = 0;
return_status = FILE_RETRY;
dst_vpath = vfs_path_from_str (dst_path);

View File

@ -569,7 +569,7 @@ overwrite_query_dialog (file_op_context_t *ctx, enum OperationMode mode)
/* will "Append" and "Reget" buttons be in the dialog? */
do_append = !S_ISDIR (ui->dst_stat->st_mode);
do_reget = do_append && ctx->operation == OP_COPY && ui->dst_stat->st_size != 0
do_reget = do_append && ui->dst_stat->st_size != 0
&& ui->src_stat->st_size > ui->dst_stat->st_size;
NEW_LABEL (8, dlg_widgets[8].text);

View File

@ -74,7 +74,7 @@ file_op_context_new (FileOperation op)
ctx->operation = op;
ctx->eta_secs = 0.0;
ctx->progress_bytes = 0;
ctx->do_reget = 1;
ctx->do_reget = -1;
ctx->stat_func = mc_lstat;
ctx->preserve = TRUE;
ctx->preserve_uidgid = (geteuid () == 0);