summaryrefslogtreecommitdiffstats
path: root/src/components/mail
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/mail')
-rw-r--r--src/components/mail/compose.rs3
-rw-r--r--src/components/mail/listing.rs9
-rw-r--r--src/components/mail/listing/compact.rs37
-rw-r--r--src/components/mail/listing/conversations.rs28
-rw-r--r--src/components/mail/listing/plain.rs35
-rw-r--r--src/components/mail/listing/thread.rs33
-rw-r--r--src/components/mail/status.rs4
-rw-r--r--src/components/mail/view.rs4
8 files changed, 153 insertions, 0 deletions
diff --git a/src/components/mail/compose.rs b/src/components/mail/compose.rs
index 97f27945..097ce438 100644
--- a/src/components/mail/compose.rs
+++ b/src/components/mail/compose.rs
@@ -1177,6 +1177,9 @@ impl Component for Composer {
}
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.set_dirty(true);
+ }
UIEvent::Resize => {
self.set_dirty(true);
}
diff --git a/src/components/mail/listing.rs b/src/components/mail/listing.rs
index f8b0f13b..2e74dbf8 100644
--- a/src/components/mail/listing.rs
+++ b/src/components/mail/listing.rs
@@ -613,6 +613,15 @@ impl Component for Listing {
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");
+ let account_hash = context.accounts[self.cursor_pos.0].hash();
+ self.sidebar_divider =
+ *account_settings!(context[account_hash].listing.sidebar_divider);
+ self.sidebar_divider_theme = conf::value(context, "mail.sidebar_divider");
+ self.menu_content = CellBuffer::new_with_context(0, 0, None, context);
+ self.set_dirty(true);
+ }
UIEvent::Timer(n) if *n == self.menu_scrollbar_show_timer.id() => {
if self.show_menu_scrollbar == ShowMenuScrollbar::True {
self.show_menu_scrollbar = ShowMenuScrollbar::False;
diff --git a/src/components/mail/listing/compact.rs b/src/components/mail/listing/compact.rs
index 882a7743..dbc4b940 100644
--- a/src/components/mail/listing/compact.rs
+++ b/src/components/mail/listing/compact.rs
@@ -1691,6 +1691,43 @@ impl Component for CompactListing {
}
}
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.color_cache = ColorCache {
+ even_unseen: crate::conf::value(context, "mail.listing.compact.even_unseen"),
+ even_selected: crate::conf::value(
+ context,
+ "mail.listing.compact.even_selected",
+ ),
+ even_highlighted: crate::conf::value(
+ context,
+ "mail.listing.compact.even_highlighted",
+ ),
+ odd_unseen: crate::conf::value(context, "mail.listing.compact.odd_unseen"),
+ odd_selected: crate::conf::value(context, "mail.listing.compact.odd_selected"),
+ odd_highlighted: crate::conf::value(
+ context,
+ "mail.listing.compact.odd_highlighted",
+ ),
+ even: crate::conf::value(context, "mail.listing.compact.even"),
+ odd: crate::conf::value(context, "mail.listing.compact.odd"),
+ attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
+ thread_snooze_flag: crate::conf::value(
+ context,
+ "mail.listing.thread_snooze_flag",
+ ),
+ tag_default: crate::conf::value(context, "mail.listing.tag_default"),
+ theme_default: crate::conf::value(context, "theme_default"),
+ ..self.color_cache
+ };
+ if !context.settings.terminal.use_color() {
+ self.color_cache.highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.tag_default.attrs |= Attr::REVERSE;
+ self.color_cache.even_highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.odd_highlighted.attrs |= Attr::REVERSE;
+ }
+ self.refresh_mailbox(context, true);
+ self.set_dirty(true);
+ }
UIEvent::MailboxUpdate((ref idxa, ref idxf))
if (*idxa, *idxf) == (self.new_cursor_pos.0, self.cursor_pos.1) =>
{
diff --git a/src/components/mail/listing/conversations.rs b/src/components/mail/listing/conversations.rs
index 47e2570d..aeff946a 100644
--- a/src/components/mail/listing/conversations.rs
+++ b/src/components/mail/listing/conversations.rs
@@ -1616,6 +1616,34 @@ impl Component for ConversationsListing {
}
}
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.color_cache = ColorCache {
+ theme_default: crate::conf::value(context, "mail.listing.conversations"),
+ subject: crate::conf::value(context, "mail.listing.conversations.subject"),
+ from: crate::conf::value(context, "mail.listing.conversations.from"),
+ date: crate::conf::value(context, "mail.listing.conversations.date"),
+ selected: crate::conf::value(context, "mail.listing.conversations.selected"),
+ unseen: crate::conf::value(context, "mail.listing.conversations.unseen"),
+ highlighted: crate::conf::value(
+ context,
+ "mail.listing.conversations.highlighted",
+ ),
+ attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
+ thread_snooze_flag: crate::conf::value(
+ context,
+ "mail.listing.thread_snooze_flag",
+ ),
+ tag_default: crate::conf::value(context, "mail.listing.tag_default"),
+ ..self.color_cache
+ };
+
+ if !context.settings.terminal.use_color() {
+ self.color_cache.highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.tag_default.attrs |= Attr::REVERSE;
+ }
+ self.refresh_mailbox(context, true);
+ self.set_dirty(true);
+ }
UIEvent::MailboxUpdate((ref idxa, ref idxf))
if (*idxa, *idxf) == (self.new_cursor_pos.0, self.cursor_pos.1) =>
{
diff --git a/src/components/mail/listing/plain.rs b/src/components/mail/listing/plain.rs
index e0a38ea8..93b9dec6 100644
--- a/src/components/mail/listing/plain.rs
+++ b/src/components/mail/listing/plain.rs
@@ -1215,6 +1215,41 @@ impl Component for PlainListing {
}
}
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.color_cache = ColorCache {
+ even: crate::conf::value(context, "mail.listing.plain.even"),
+ odd: crate::conf::value(context, "mail.listing.plain.odd"),
+ even_unseen: crate::conf::value(context, "mail.listing.plain.even_unseen"),
+ odd_unseen: crate::conf::value(context, "mail.listing.plain.odd_unseen"),
+ even_highlighted: crate::conf::value(
+ context,
+ "mail.listing.plain.even_highlighted",
+ ),
+ odd_highlighted: crate::conf::value(
+ context,
+ "mail.listing.plain.odd_highlighted",
+ ),
+ even_selected: crate::conf::value(context, "mail.listing.plain.even_selected"),
+ odd_selected: crate::conf::value(context, "mail.listing.plain.odd_selected"),
+ attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
+ thread_snooze_flag: crate::conf::value(
+ context,
+ "mail.listing.thread_snooze_flag",
+ ),
+ tag_default: crate::conf::value(context, "mail.listing.tag_default"),
+ theme_default: crate::conf::value(context, "theme_default"),
+ ..self.color_cache
+ };
+ if !context.settings.terminal.use_color() {
+ self.color_cache.highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.tag_default.attrs |= Attr::REVERSE;
+ self.color_cache.even_highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.odd_highlighted.attrs |= Attr::REVERSE;
+ }
+
+ self.refresh_mailbox(context, true);
+ self.set_dirty(true);
+ }
UIEvent::MailboxUpdate((ref idxa, ref idxf))
if (*idxa, *idxf) == (self.new_cursor_pos.0, self.cursor_pos.1) =>
{
diff --git a/src/components/mail/listing/thread.rs b/src/components/mail/listing/thread.rs
index 705fada0..e21bfb6a 100644
--- a/src/components/mail/listing/thread.rs
+++ b/src/components/mail/listing/thread.rs
@@ -1184,6 +1184,39 @@ impl Component for ThreadListing {
}
}
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.color_cache = ColorCache {
+ even_unseen: crate::conf::value(context, "mail.listing.plain.even_unseen"),
+ even_selected: crate::conf::value(context, "mail.listing.plain.even_selected"),
+ even_highlighted: crate::conf::value(
+ context,
+ "mail.listing.plain.even_highlighted",
+ ),
+ odd_unseen: crate::conf::value(context, "mail.listing.plain.odd_unseen"),
+ odd_selected: crate::conf::value(context, "mail.listing.plain.odd_selected"),
+ odd_highlighted: crate::conf::value(
+ context,
+ "mail.listing.plain.odd_highlighted",
+ ),
+ even: crate::conf::value(context, "mail.listing.plain.even"),
+ odd: crate::conf::value(context, "mail.listing.plain.odd"),
+ attachment_flag: crate::conf::value(context, "mail.listing.attachment_flag"),
+ thread_snooze_flag: crate::conf::value(
+ context,
+ "mail.listing.thread_snooze_flag",
+ ),
+ tag_default: crate::conf::value(context, "mail.listing.tag_default"),
+ theme_default: crate::conf::value(context, "theme_default"),
+ ..self.color_cache
+ };
+ if !context.settings.terminal.use_color() {
+ self.color_cache.highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.tag_default.attrs |= Attr::REVERSE;
+ self.color_cache.even_highlighted.attrs |= Attr::REVERSE;
+ self.color_cache.odd_highlighted.attrs |= Attr::REVERSE;
+ }
+ self.set_dirty(true);
+ }
UIEvent::Input(Key::Char('\n')) if !self.unfocused => {
self.unfocused = true;
self.dirty = true;
diff --git a/src/components/mail/status.rs b/src/components/mail/status.rs
index ca5748b5..d63e5384 100644
--- a/src/components/mail/status.rs
+++ b/src/components/mail/status.rs
@@ -403,6 +403,10 @@ impl Component for AccountStatus {
fn process_event(&mut self, event: &mut UIEvent, context: &mut Context) -> bool {
let shortcuts = self.get_shortcuts(context);
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.theme_default = crate::conf::value(context, "theme_default");
+ self.set_dirty(true);
+ }
UIEvent::Resize => {
self.dirty = true;
}
diff --git a/src/components/mail/view.rs b/src/components/mail/view.rs
index bc329354..3ad73f34 100644
--- a/src/components/mail/view.rs
+++ b/src/components/mail/view.rs
@@ -1763,6 +1763,10 @@ impl Component for MailView {
let shortcuts = &self.get_shortcuts(context);
match *event {
+ UIEvent::ConfigReload { old_settings: _ } => {
+ self.theme_default = crate::conf::value(context, "theme_default");
+ self.set_dirty(true);
+ }
UIEvent::Input(ref key)
if shortcut!(key == shortcuts[MailView::DESCRIPTION]["reply"]) =>
{