@@ -7,9 +7,10 @@ use crossbeam_channel::Sender;
7
7
use czkawka_core:: common:: progress_data:: ProgressData ;
8
8
use slint:: { ComponentHandle , Weak } ;
9
9
10
+ use crate :: model_operations:: get_checked_info_from_app;
10
11
use crate :: model_operations:: model_processor:: { MessageType , ModelProcessor } ;
11
12
use crate :: simpler_model:: { SimplerMainListModel , ToSimplerVec } ;
12
- use crate :: { ActiveTab , Callabler , GuiState , MainWindow , Settings } ;
13
+ use crate :: { ActiveTab , Callabler , GuiState , MainWindow , Settings , Translations , flk } ;
13
14
14
15
pub ( crate ) fn connect_delete_button ( app : & MainWindow , progress_sender : Sender < ProgressData > , stop_flag : Arc < AtomicBool > ) {
15
16
let a = app. as_weak ( ) ;
@@ -26,13 +27,41 @@ pub(crate) fn connect_delete_button(app: &MainWindow, progress_sender: Sender<Pr
26
27
processor. delete_selected_items ( settings. get_move_to_trash ( ) , progress_sender, weak_app, stop_flag) ;
27
28
} ) ;
28
29
29
- // let a = app.as_weak();
30
- // app.on_delete_popup_dialog_show_requested(move|| {
31
- // let app = a.upgrade().expect("Failed to upgrade app :(");
32
- // let settings = app.global::<Settings>();
33
- // let active_tab = app.global::<GuiState>().get_active_tab();
34
- // let model = active_tab.get_tool_model(&app);
35
- // });
30
+ let a = app. as_weak ( ) ;
31
+ app. on_delete_popup_dialog_show_requested ( move || {
32
+ let app = a. upgrade ( ) . expect ( "Failed to upgrade app :(" ) ;
33
+ let translation = app. global :: < Translations > ( ) ;
34
+ let res = get_checked_info_from_app ( & app) ;
35
+ // TODO - items formatting should be done in GUI, not here
36
+ let mut base = flk ! ( "rust_delete_confirmation" ) ;
37
+ if let Some ( group_res) = res. groups_with_checked_items {
38
+ base. push_str (
39
+ format ! (
40
+ "\n {}" ,
41
+ flk!(
42
+ "rust_delete_confirmation_number_groups" ,
43
+ items = res. checked_items_number,
44
+ groups = group_res. groups_with_checked_items
45
+ )
46
+ )
47
+ . as_str ( ) ,
48
+ ) ;
49
+ if group_res. number_of_groups_with_all_items_checked > 0 {
50
+ base. push_str (
51
+ format ! (
52
+ "\n {}" ,
53
+ flk!( "rust_delete_confirmation_selected_all_in_group" , groups = group_res. number_of_groups_with_all_items_checked)
54
+ )
55
+ . as_str ( ) ,
56
+ ) ;
57
+ }
58
+ } else {
59
+ base. push_str ( format ! ( "\n {}" , flk!( "rust_delete_confirmation_number_simple" , items = res. checked_items_number) ) . as_str ( ) ) ;
60
+ }
61
+ translation. set_delete_confirmation_text ( base. into ( ) ) ;
62
+
63
+ app. invoke_delete_popup_dialog_configured ( ) ;
64
+ } ) ;
36
65
}
37
66
38
67
impl ModelProcessor {
0 commit comments