Web version: «Allow reading» checked, a kept copy lets the handle go, dropped files told apart in Chrome; docs: §9, the checks in Chromium
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f694bc768b
commit
bda92c5675
8 changed files with 117 additions and 14 deletions
|
|
@ -2884,6 +2884,7 @@ impl App {
|
|||
*d = copy.clone();
|
||||
}
|
||||
self.library.forget(&path);
|
||||
crate::platform::files::forget(&path);
|
||||
self.library.select_db(©, ctx);
|
||||
self.settings_dirty = true;
|
||||
let ctx2 = ctx.clone();
|
||||
|
|
|
|||
|
|
@ -217,6 +217,17 @@ pub fn trf(key: &'static str, args: &[(&str, &dyn Display)]) -> String {
|
|||
// Uzbek o‘ and g‘ are written with ‘ (U+2018): the interface font has no U+02BB.
|
||||
const ROWS: &[[&str; 9]] = &[
|
||||
// --- the web version ---
|
||||
[
|
||||
"A dropped file is not remembered: after a reload, choose the file again or keep a copy in the browser.",
|
||||
"Перетащенный файл не запоминается: после перезагрузки выберите его снова или сохраните копию в браузере.",
|
||||
"Un fichier déposé n'est pas mémorisé : après un rechargement, choisissez-le à nouveau ou gardez-en une copie dans le navigateur.",
|
||||
"Eine hineingezogene Datei wird nicht gemerkt: Wählen Sie sie nach dem Neuladen erneut oder behalten Sie eine Kopie im Browser.",
|
||||
"Un archivo arrastrado no se recuerda: tras recargar, elíjalo de nuevo o guarde una copia en el navegador.",
|
||||
"Un file trascinato non viene ricordato: dopo il ricaricamento sceglilo di nuovo o conserva una copia nel browser.",
|
||||
"Um arquivo arrastado não é lembrado: após recarregar, escolha-o novamente ou guarde uma cópia no navegador.",
|
||||
"Sudrab tashlangan fayl eslab qolinmaydi: qayta yuklangandan keyin uni yana tanlang yoki brauzerda nusxasini saqlang.",
|
||||
"Сүйреп әкелінген файл есте сақталмайды: қайта жүктегеннен кейін оны қайта таңдаңыз немесе браузерде көшірмесін сақтаңыз.",
|
||||
],
|
||||
[
|
||||
"🔒 Allow reading",
|
||||
"🔒 Разрешить чтение",
|
||||
|
|
|
|||
|
|
@ -1304,7 +1304,12 @@ impl Library {
|
|||
// A browser keeps no way back to a file the user chose (Firefox, Safari).
|
||||
ui.vertical_centered(|ui| {
|
||||
ui.add_space(40.0);
|
||||
ui.label(tr("This browser doesn't remember files: after a reload, choose the file again or keep a copy in the browser."));
|
||||
// Chrome and Edge remember chosen files, not dropped ones.
|
||||
ui.label(if crate::platform::files::remembers_chosen() {
|
||||
tr("A dropped file is not remembered: after a reload, choose the file again or keep a copy in the browser.")
|
||||
} else {
|
||||
tr("This browser doesn't remember files: after a reload, choose the file again or keep a copy in the browser.")
|
||||
});
|
||||
ui.add_space(8.0);
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button(tr("↻ Choose the file again")).clicked() {
|
||||
|
|
|
|||
|
|
@ -113,6 +113,15 @@ pub fn pick_databases(then: impl FnOnce(Picked) + Send + 'static) {
|
|||
}
|
||||
}
|
||||
|
||||
/// The browser remembers the files chosen in its dialog for the next visit (Chrome,
|
||||
/// Edge); the others, and a computer, have no need or no way.
|
||||
pub fn remembers_chosen() -> bool {
|
||||
#[cfg(web)]
|
||||
return super::web::remembered::supported();
|
||||
#[cfg(not(web))]
|
||||
false
|
||||
}
|
||||
|
||||
/// The browser remembers the file `path` of an earlier visit and asks the user before
|
||||
/// the page reads it again ([`allow_reading`]). Never on a computer.
|
||||
pub fn waiting_to_read(path: &std::path::Path) -> bool {
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ pub fn allow(path: &Path, then: impl FnOnce(bool) + 'static) {
|
|||
};
|
||||
let back = bytes.is_some();
|
||||
if let Some(bytes) = bytes {
|
||||
log::info!("remembered file allowed again: {}", path.display());
|
||||
WAITING.with_borrow_mut(|w| w.remove(&path));
|
||||
super::vfs::put_opened(&path, bytes);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue