pub collection_id: i32,
pub id: NoteId,
- pub nodename: Option<String>,
+ pub nodename: String,
#[bind("note_type")]
pub note_type: UiInteger,
+
+ #[bind("note_nodename")]
+ pub note_nodename: UiString,
}
#[ui_actions]
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<FileNote> {
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);
+ }
}