From: Olaf Wintermann Date: Tue, 14 Jul 2026 20:03:44 +0000 (+0200) Subject: prepare FileNote actions X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=HEAD;p=note.git prepare FileNote actions --- diff --git a/application/note/src/file.rs b/application/note/src/file.rs index 916f320..36068f9 100644 --- a/application/note/src/file.rs +++ b/application/note/src/file.rs @@ -42,10 +42,13 @@ pub struct FileNote { pub collection_id: i32, pub id: NoteId, - pub nodename: Option, + pub nodename: String, #[bind("note_type")] pub note_type: UiInteger, + + #[bind("note_nodename")] + pub note_nodename: UiString, } #[ui_actions] @@ -58,16 +61,53 @@ impl FileNote { collection_id, id, - nodename: None, + nodename: String::default(), note_type: Default::default(), + note_nodename: Default::default(), } } pub fn into_doc(self, model: &entity::note::Model) -> UiDoc { UiDoc::new2(self, |n,d| { n.doc = d.doc_ref(); + n.nodename = model.nodename.clone(); + n.note_type.set(NoteTypeTabView::File as i64); + n.note_nodename.set(model.nodename.as_str()); }) } + + #[action] + pub fn open_extern(&mut self, _event: &ActionEvent) { + // TODO: request open from backend + } + + #[action] + pub fn save(&mut self, _event: &ActionEvent) { + self.save_note(); + } + + pub fn save_note(&mut self) { + // TODO + } + + #[action] + pub fn notebook_view_changed(&mut self, event: &mut ActionEvent) { + // TODO: duplicated code in note.rs + // maybe move this code to the notebook + + // This action is for the toolbar button, to change the notebook view + // (dual view or maximized note), however, the view status variable is stored + // in the notebook. + let Some(obj) = &mut event.obj else { + return; + }; + let Some(doc) = self.doc.get_doc() else { + return; + }; + + obj.splitview_set_visible(0, event.intval == 0); + doc.ctx.set_state(AppStates::NoteMaximized as i32); + } }