From 322ba964345d11e6d18989dbcfb8534cc03556f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=94=9F=E6=9D=82=E7=89=A9=E6=88=BF?= <88823709+TC999@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:41:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=90=8E=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/confirmation.rs | 4 ++++ src/ui.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/confirmation.rs b/src/confirmation.rs index 07887d7..774d1a8 100644 --- a/src/confirmation.rs +++ b/src/confirmation.rs @@ -42,6 +42,7 @@ pub fn handle_delete_confirmation( confirm_delete: &mut Option<(String, bool)>, selected_appdata_folder: &str, status: &mut Option, + folder_data: &mut Vec<(String, u64)>, // 新增参数 ) { if let Some((folder_name, _)) = confirm_delete.clone() { let message = format!("确定要彻底删除文件夹 {} 吗?", folder_name); @@ -55,6 +56,9 @@ pub fn handle_delete_confirmation( // 检查文件夹是否已成功删除 if !full_path.exists() { *status = Some(format!("文件夹 {} 已成功删除", folder_name)); + println!("文件夹 {} 已成功删除", folder_name); + // 从 folder_data 中移除对应项目 + folder_data.retain(|(name, _)| name != &folder_name); } else { *status = Some(format!("文件夹 {} 删除失败", folder_name)); } diff --git a/src/ui.rs b/src/ui.rs index c21c418..2343e2d 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -97,7 +97,7 @@ impl eframe::App for AppDataCleaner { } // 删除确认弹窗逻辑 - confirmation::handle_delete_confirmation(ctx, &mut self.confirm_delete, &self.selected_appdata_folder, &mut self.status); + confirmation::handle_delete_confirmation(ctx, &mut self.confirm_delete, &self.selected_appdata_folder, &mut self.status, &mut self.folder_data); // 传递 folder_data // 顶部菜单 egui::TopBottomPanel::top("menu_bar").show(ctx, |ui| { @@ -229,4 +229,4 @@ impl eframe::App for AppDataCleaner { // 显示移动窗口 self.move_module.show_move_window(ctx); } -} +} \ No newline at end of file