From c279d858e62bb7d6dbca8e3686e22a5bf88c79f8 Mon Sep 17 00:00:00 2001 From: jishengjie Date: Wed, 14 Dec 2022 15:38:30 +0800 Subject: fix: Encrypted documents in. 7z format cannot delete locked files and folders --- src/fr-window.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src/fr-window.c') diff --git a/src/fr-window.c b/src/fr-window.c index 3c71431..8061a39 100644 --- a/src/fr-window.c +++ b/src/fr-window.c @@ -6317,14 +6317,34 @@ fr_window_archive_add_dropped_items (FrWindow *window, window->priv->volume_size); } +static void +remove_data_free (GList *rdata) +{ + g_list_free_full(rdata, g_free); +} + void fr_window_archive_remove (FrWindow *window, GList *file_list) { + char *password; + GList *remove_list; + fr_window_clipboard_remove_file_list (window, file_list); fr_process_clear (window->archive->process); - fr_archive_remove (window->archive, file_list, window->priv->compression); + + remove_list = g_list_copy_deep (file_list, (GCopyFunc) g_strdup, NULL); + fr_window_set_current_batch_action (window, + FR_BATCH_ACTION_DELETE, + remove_list, + (GFreeFunc) remove_data_free); + + password = window->priv->password; + if (password != NULL && password[0] != '\0') + g_object_set (window->archive->command, "password", password, NULL); + + fr_archive_remove (window->archive, remove_list, window->priv->compression); fr_process_start (window->archive->process); } @@ -8529,6 +8549,12 @@ fr_window_exec_batch_action (FrWindow *window, fr_window_archive_add_dropped_items (window, (GList*) action->data, FALSE); break; + case FR_BATCH_ACTION_DELETE: + debug (DEBUG_INFO, "[BATCH] DELETE\n"); + + fr_window_archive_remove (window, (GList*) action->data); + break; + case FR_BATCH_ACTION_OPEN: debug (DEBUG_INFO, "[BATCH] OPEN\n"); -- cgit v1.2.1