mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
Mail: Draw unread messages as bold
This commit is contained in:
parent
411ffb7954
commit
619b53eaca
3 changed files with 12 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "InboxModel.h"
|
#include "InboxModel.h"
|
||||||
|
#include <LibGfx/Font/FontDatabase.h>
|
||||||
|
|
||||||
InboxModel::InboxModel(Vector<InboxEntry> entries)
|
InboxModel::InboxModel(Vector<InboxEntry> entries)
|
||||||
: m_entries(move(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)
|
if (index.column() == Column::Date)
|
||||||
return Gfx::TextAlignment::CenterRight;
|
return Gfx::TextAlignment::CenterRight;
|
||||||
}
|
}
|
||||||
|
if (role == GUI::ModelRole::Font) {
|
||||||
|
if (!value.seen)
|
||||||
|
return Gfx::FontDatabase::default_font().bold_variant();
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ struct InboxEntry {
|
||||||
DeprecatedString from;
|
DeprecatedString from;
|
||||||
DeprecatedString subject;
|
DeprecatedString subject;
|
||||||
DeprecatedString date;
|
DeprecatedString date;
|
||||||
|
bool seen;
|
||||||
};
|
};
|
||||||
|
|
||||||
class InboxModel final : public GUI::Model {
|
class InboxModel final : public GUI::Model {
|
||||||
|
|
|
@ -290,6 +290,9 @@ void MailWidget::selected_mailbox()
|
||||||
.headers = { { "Date", "Subject", "From" } },
|
.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<IMAP::FetchResponseData>();
|
auto& response_data = fetch_data.get<IMAP::FetchResponseData>();
|
||||||
auto& body_data = response_data.body_data();
|
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) {
|
auto data_item_has_header = [](IMAP::FetchCommand::DataItem const& data_item, DeprecatedString const& search_header) {
|
||||||
if (!data_item.section.has_value())
|
if (!data_item.section.has_value())
|
||||||
return false;
|
return false;
|
||||||
|
@ -415,7 +420,7 @@ void MailWidget::selected_mailbox()
|
||||||
if (from.is_empty())
|
if (from.is_empty())
|
||||||
from = "(Unknown sender)";
|
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());
|
m_statusbar->set_text(String::formatted("[{}]: Loading entry {}", mailbox.name, ++i).release_value_but_fixme_should_propagate_errors());
|
||||||
|
|
||||||
active_inbox_entries.append(inbox_entry);
|
active_inbox_entries.append(inbox_entry);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue