From: Olaf Wintermann Date: Thu, 16 Jul 2026 16:42:35 +0000 (+0200) Subject: add check to open_extern if the task is already running in the background X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fmain;p=note.git add check to open_extern if the task is already running in the background --- diff --git a/application/note/src/file.rs b/application/note/src/file.rs index f5622c2..560c2c1 100644 --- a/application/note/src/file.rs +++ b/application/note/src/file.rs @@ -44,6 +44,7 @@ pub struct FileNote { pub local_path: Option, pub is_tmp_file: bool, + pub is_opening: bool, #[bind("note_type")] pub note_type: UiInteger, @@ -65,6 +66,7 @@ impl FileNote { nodename: String::default(), local_path: None, is_tmp_file: false, + is_opening: false, note_type: Default::default(), note_nodename: Default::default(), @@ -83,6 +85,10 @@ impl FileNote { #[action] pub fn open_extern(&mut self, _event: &ActionEvent) { + if self.is_opening { + return; + } + let Some(doc) = self.doc.get_doc() else { return; }; @@ -91,9 +97,11 @@ impl FileNote { println!("open file: {}", path); open_file(path.as_str()); } else if let NoteId::Id(note_id) = self.id { + self.is_opening = true; let proxy = doc.doc_proxy(); self.backend.open_extern(note_id, |result|{ proxy.call_mainthread(move |_doc, note|{ + note.is_opening = false; match result { OpenExternResult::Ok((path, istmp)) => { println!("open file: {}", path);