]> uap-core.de Git - note.git/commitdiff
add close button to the note title bar main
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 31 Jul 2026 19:36:56 +0000 (21:36 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Fri, 31 Jul 2026 19:36:56 +0000 (21:36 +0200)
application/note/src/note.rs
application/note/src/window.rs

index 175d9651a9a829098dbb542535c32319f6c73c33..305008b6f2920e8a3d5ceb662868d3105ed07ca6 100644 (file)
@@ -390,6 +390,14 @@ impl Note {
         self.fixed_title = true;
     }
 
+    #[action]
+    pub fn note_title_close(&mut self, _event: &ActionEvent) {
+        let Some(doc) = self.doc.get_doc() else {
+            return;
+        };
+        doc.ctx.unset_state(AppStates::NoteTitleInput as i32);
+    }
+
     #[action]
     pub fn note_title_changed(&mut self, event: &ActionEvent) {
         if event.set {
index 4d4ec77126d19d1afc32c39009cfb4229638ae22..3e20493a1f88a2d89bcbaff66cad7142e043d8ec 100644 (file)
@@ -257,6 +257,7 @@ pub fn create_window(app: &App, ctx: &AppContext<MainWindow>) -> UiObject<MainWi
                     hbox!(obj, visibility_states = &[AppStates::NoteTitleInput as i32], spacing = 4, margin = 4, |obj|{
                         label!(obj, label = "Title:");
                         textfield!(obj, fill = true, varname = "note_title", onchange_action = "note_title_changed");
+                        button!(obj, label = "Close", action = "note_title_close");
                     });
                     let textarea = textarea!(obj, fill = true, varname = "note_text", onchange_action = "note_text_change", ontextchanged_action = "note_text_changed");
                     obj.ctx.add_action_untyped("textarea_focus", move|_event|{