diff options
author | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-12-02 20:47:48 +0200 |
---|---|---|
committer | Manos Pitsidianakis <el13635@mail.ntua.gr> | 2020-12-02 21:01:22 +0200 |
commit | 48e7a493a92730bedccc5dfaac8242ed49d55a0d (patch) | |
tree | 0fea8098a1e5d5ced26efca389bb3e5f56157756 /src/components/contacts.rs | |
parent | e5b0ff4fe2799339076de95227b13d9755245f5f (diff) |
Add reload-config command
Closes #84 Add "reload configuration" command
Diffstat (limited to 'src/components/contacts.rs')
-rw-r--r-- | src/components/contacts.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/components/contacts.rs b/src/components/contacts.rs index 4bb1e852..9feb6e42 100644 --- a/src/components/contacts.rs +++ b/src/components/contacts.rs @@ -59,13 +59,6 @@ impl fmt::Display for ContactManager { impl ContactManager { fn new(context: &Context) -> Self { let theme_default: ThemeAttribute = crate::conf::value(context, "theme_default"); - let default_cell = { - let mut ret = Cell::with_char(' '); - ret.set_fg(theme_default.fg) - .set_bg(theme_default.bg) - .set_attrs(theme_default.attrs); - ret - }; ContactManager { id: Uuid::nil(), parent_id: Uuid::nil(), @@ -73,7 +66,7 @@ impl ContactManager { mode: ViewMode::Edit, form: FormWidget::default(), account_pos: 0, - content: CellBuffer::new(100, 1, default_cell), + content: CellBuffer::new_with_context(100, 1, None, context), theme_default, dirty: true, has_changes: false, @@ -189,6 +182,15 @@ impl Component for ContactManager { } fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool { + match event { + UIEvent::ConfigReload { old_settings: _ } => { + self.theme_default = crate::conf::value(context, "theme_default"); + self.content = CellBuffer::new_with_context(100, 1, None, context); + self.initialized = false; + self.set_dirty(true); + } + _ => {} + } match self.mode { ViewMode::Discard(ref mut selector) => { if selector.process_event(event, context) { |