1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! The filename-collision confirmation flow: a cheap pre-scan of what an import
//! would replace, and the up-front Yes/No prompt shown when it would replace
//! anything at all.
use collect_import_candidates;
use crateMainWindow;
use Database;
use ;
/// Filename-only pre-scan of what `super::pipeline::import_path` would find at
/// `path` -- how many of its candidate `.asc` files already share a name with a row
/// already in `db` (returned first), out of how many candidates total (returned
/// second). Uses the same `local://<file_name>` collision test the pipeline's own
/// save step applies later, since that url is derivable from the
/// file name alone -- no file is read or parsed here, so this costs only the
/// directory listing [`collect_import_candidates`] needs regardless.
///
/// `(0, 0)` for an unreadable path/empty folder: `import_path` reports that failure
/// itself once the import actually runs, so this pre-scan does not need to duplicate
/// it.
pub
/// When `collisions` is non-zero, opens the SAME in-window write-confirm dialog
/// `gui::editor::native_io::ask_write_confirm` already gives Save Native's own
/// prompts, naming how many of `total` candidate files would replace an existing
/// catalogue row, and runs `proceed` once the cutter accepts. Declining runs
/// nothing at all -- the catalogue stays untouched, exactly like cancelling the
/// picker itself does. Runs `proceed` immediately (synchronously) when
/// `collisions == 0`, the common case with nothing to ask about.
///
/// Reuses `EditorModel.write_confirm_*` (`ui/models/editor.slint`), a plain global
/// with no notion of which part of the app is asking, so no new Slint callback is
/// needed -- only `native_io::ask_write_confirm` itself becoming reachable from here
/// (see that function's own doc comment).
pub
/// [`confirm_collisions_then`]'s pure decision -- whether ANY collision means the
/// dialog is needed at all. Pulled out so a test can call it directly, matching
/// `gui::editor::native_io::decide_write_status`'s own "pure decision, `ui`-touching
/// action kept separate" split -- `confirm_collisions_then` itself is not
/// exercised end-to-end here, since `ask_write_confirm` needs a live
/// `slint::ComponentHandle` (a real `MainWindow`) this crate's test environment
/// cannot start (the same constraint `solve_service`/`edit_intent`'s own test
/// modules document).
pub const