diff --git a/Userland/Applications/Mail/InboxModel.cpp b/Userland/Applications/Mail/InboxModel.cpp index be1577c9ed..657d472a2a 100644 --- a/Userland/Applications/Mail/InboxModel.cpp +++ b/Userland/Applications/Mail/InboxModel.cpp @@ -6,6 +6,7 @@ */ #include "InboxModel.h" +#include InboxModel::InboxModel(Vector entries) : m_entries(move(entries)) @@ -46,5 +47,9 @@ GUI::Variant InboxModel::data(GUI::ModelIndex const& index, GUI::ModelRole role) if (index.column() == Column::Date) return Gfx::TextAlignment::CenterRight; } + if (role == GUI::ModelRole::Font) { + if (!value.seen) + return Gfx::FontDatabase::default_font().bold_variant(); + } return {}; } diff --git a/Userland/Applications/Mail/InboxModel.h b/Userland/Applications/Mail/InboxModel.h index 4ce4cc3351..b8c0c0e2e3 100644 --- a/Userland/Applications/Mail/InboxModel.h +++ b/Userland/Applications/Mail/InboxModel.h @@ -14,6 +14,7 @@ struct InboxEntry { DeprecatedString from; DeprecatedString subject; DeprecatedString date; + bool seen; }; class InboxModel final : public GUI::Model { diff --git a/Userland/Applications/Mail/MailWidget.cpp b/Userland/Applications/Mail/MailWidget.cpp index 9ff75e240f..7024b8bc63 100644 --- a/Userland/Applications/Mail/MailWidget.cpp +++ b/Userland/Applications/Mail/MailWidget.cpp @@ -290,6 +290,9 @@ void MailWidget::selected_mailbox() .headers = { { "Date", "Subject", "From" } }, }, }, + IMAP::FetchCommand::DataItem { + .type = IMAP::FetchCommand::DataItemType::Flags, + }, }, }; @@ -309,6 +312,8 @@ void MailWidget::selected_mailbox() auto& response_data = fetch_data.get(); auto& body_data = response_data.body_data(); + auto seen = !response_data.flags().find_if([](StringView value) { return value.equals_ignoring_ascii_case("\\Seen"sv); }).is_end(); + auto data_item_has_header = [](IMAP::FetchCommand::DataItem const& data_item, DeprecatedString const& search_header) { if (!data_item.section.has_value()) return false; @@ -415,7 +420,7 @@ void MailWidget::selected_mailbox() if (from.is_empty()) from = "(Unknown sender)"; - InboxEntry inbox_entry { from, subject, date }; + InboxEntry inbox_entry { from, subject, date, seen }; m_statusbar->set_text(String::formatted("[{}]: Loading entry {}", mailbox.name, ++i).release_value_but_fixme_should_propagate_errors()); active_inbox_entries.append(inbox_entry);