Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

LR-IMP-DRAGDROP: a web drop whose files could not be read says so

Nathaniel Ledford222925c7d591
diff --git a/apps/lightcraft-web/src/web.rs b/apps/lightcraft-web/src/web.rs
index 1a490061f..1e258a524 100644
--- a/apps/lightcraft-web/src/web.rs
+++ b/apps/lightcraft-web/src/web.rs
@@ -528,15 +528,17 @@ impl WebApp {
if !paths.is_empty() {
match self.app.run("library.import", json!({"paths": paths})) {
// what the import did, not what was submitted: duplicates and unsupported files add nothing,
- // and a drop that only finds duplicates says nothing (as the desktop import's toast does
- // when it shows where they are)
+ // a drop that only finds duplicates says nothing (as the desktop import's toast does when it
+ // shows where they are), and one whose files could not be read says so
Ok(report) => {
let count = |k: &str| report[k].as_array().map_or(0, Vec::len);
- let (added, restored) = (count("imported"), count("restored"));
+ let (added, restored, failed) = (count("imported"), count("restored"), count("failed"));
if added > 0 {
self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_added(added));
} else if restored > 0 {
self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_restored(restored));
+ } else if failed > 0 {
+ self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_unreadable(failed));
}
}
Err(e) => {
diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs
index 7fdda75f8..c92e8da27 100644
--- a/crates/ui-egui/src/i18n.rs
+++ b/crates/ui-egui/src/i18n.rs
@@ -283,6 +283,11 @@ pub fn dropped_photos_restored(n: usize) -> String {
tr_format!("Restored {} photo{} from Recently Deleted", n, if n == 1 { "" } else { "s" })
}
+/// The web build's notice for `n` dropped photos that could not be read (nothing else came of the drop).
+pub fn dropped_photos_unreadable(n: usize) -> String {
+ tr_format!("{} photo{} not readable", n, if n == 1 { "" } else { "s" })
+}
+
/// The title and text of the message box shown when the desktop app's window can't start
/// (issue #260), in the UI language: the error and, when there is one, the log file to look in.
pub fn startup_failed_message(error: &str, log_file: Option<&str>) -> (String, String) {