Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

删除后移除扫描结果 #39

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/confirmation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub fn handle_delete_confirmation(
confirm_delete: &mut Option<(String, bool)>,
selected_appdata_folder: &str,
status: &mut Option<String>,
folder_data: &mut Vec<(String, u64)>, // 新增参数
) {
if let Some((folder_name, _)) = confirm_delete.clone() {
let message = format!("确定要彻底删除文件夹 {} 吗?", folder_name);
Expand All @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down Expand Up @@ -229,4 +229,4 @@ impl eframe::App for AppDataCleaner {
// 显示移动窗口
self.move_module.show_move_window(ctx);
}
}
}