@@ -40,7 +40,7 @@ pub enum EditAttachmentMode {
4040#[ derive( Debug ) ]
4141pub struct EditAttachments {
4242 /// For shortcut setting retrieval.
43- pub account_hash : Option < AccountHash > ,
43+ pub account_hash : AccountHash ,
4444 pub mode : EditAttachmentMode ,
4545 pub buttons : ButtonWidget < FormButtonAction > ,
4646 pub cursor : EditAttachmentCursor ,
@@ -49,7 +49,7 @@ pub struct EditAttachments {
4949}
5050
5151impl EditAttachments {
52- pub fn new ( account_hash : Option < AccountHash > ) -> Self {
52+ pub fn new ( account_hash : AccountHash ) -> Self {
5353 //ButtonWidget::new(("Add".into(), FormButtonAction::Other("add")));
5454 let mut buttons = ButtonWidget :: new ( ( "Go Back" . into ( ) , FormButtonAction :: Cancel ) ) ;
5555 buttons. set_focus ( true ) ;
@@ -63,6 +63,16 @@ impl EditAttachments {
6363 id : ComponentId :: default ( ) ,
6464 }
6565 }
66+
67+ pub fn shortcuts ( & self , context : & Context ) -> ShortcutMaps {
68+ let mut map = self . buttons . shortcuts ( context) ;
69+
70+ let our_map: ShortcutMap =
71+ account_settings ! ( context[ self . account_hash] . shortcuts. composing) . key_values ( ) ;
72+ map. insert ( Shortcuts :: COMPOSING , our_map) ;
73+
74+ map
75+ }
6676}
6777
6878impl EditAttachmentsRefMut < ' _ , ' _ > {
@@ -319,16 +329,7 @@ impl Component for EditAttachmentsRefMut<'_, '_> {
319329 fn kill ( & mut self , _uuid : ComponentId , _context : & mut Context ) { }
320330
321331 fn shortcuts ( & self , context : & Context ) -> ShortcutMaps {
322- let mut map = ShortcutMaps :: default ( ) ;
323-
324- let our_map: ShortcutMap = self
325- . inner
326- . account_hash
327- . map ( |acc| account_settings ! ( context[ acc] . shortcuts. composing) . key_values ( ) )
328- . unwrap_or_else ( || context. settings . shortcuts . composing . key_values ( ) ) ;
329- map. insert ( Shortcuts :: COMPOSING , our_map) ;
330-
331- map
332+ self . inner . shortcuts ( context)
332333 }
333334
334335 fn id ( & self ) -> ComponentId {
0 commit comments