meli: implement flag set/unset action in UI
Also document it in manpages meli.1 and meli.7 Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>pull/339/head
parent
8185f2cf7d
commit
148f0433d9
|
@ -265,6 +265,13 @@ Sqlite3 on the contrary at reasonable mailbox sizes should have a non noticable
|
|||
.It
|
||||
.Li flags = \&"flags:\&" flag | \&"tags:\&" flag | \&"is:\&" flag
|
||||
.El
|
||||
.Sh FLAGS
|
||||
.Nm
|
||||
supports the basic maildir flags: passed, replied, seen, trashed, draft and flagged.
|
||||
Flags can be searched with the `flags:` prefix in a search query, and can be modified by
|
||||
.Command flag set FLAG
|
||||
and
|
||||
.Command flag unset FLAG
|
||||
.Sh TAGS
|
||||
.Nm
|
||||
supports tagging in notmuch and IMAP/JMAP backends.
|
||||
|
|
|
@ -445,6 +445,10 @@ which also has its complement
|
|||
.sp
|
||||
action.
|
||||
.Pp
|
||||
For e-mail backends that support flags you can use the following commands on entries and selections to modify them:
|
||||
.Command flag set FLAG
|
||||
.Command flag unset FLAG
|
||||
.Pp
|
||||
For e-mail backends that support tags
|
||||
.Po
|
||||
like
|
||||
|
|
|
@ -524,7 +524,7 @@ pub trait MailListingTrait: ListingTrait {
|
|||
};
|
||||
let account = &mut context.accounts[&account_hash];
|
||||
match a {
|
||||
ListingAction::SetSeen => {
|
||||
ListingAction::Flag(FlagAction::Set(Flag::SEEN)) | ListingAction::SetSeen => {
|
||||
if let Err(err) = account.set_flags(
|
||||
env_hashes,
|
||||
mailbox_hash,
|
||||
|
@ -535,7 +535,7 @@ pub trait MailListingTrait: ListingTrait {
|
|||
));
|
||||
}
|
||||
}
|
||||
ListingAction::SetUnseen => {
|
||||
ListingAction::Flag(FlagAction::Unset(Flag::SEEN)) | ListingAction::SetUnseen => {
|
||||
if let Err(err) = account.set_flags(
|
||||
env_hashes,
|
||||
mailbox_hash,
|
||||
|
@ -546,6 +546,28 @@ pub trait MailListingTrait: ListingTrait {
|
|||
));
|
||||
}
|
||||
}
|
||||
ListingAction::Flag(FlagAction::Set(flag)) => {
|
||||
if let Err(err) = account.set_flags(
|
||||
env_hashes,
|
||||
mailbox_hash,
|
||||
smallvec::smallvec![FlagOp::Set(*flag)],
|
||||
) {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(err.to_string()),
|
||||
));
|
||||
}
|
||||
}
|
||||
ListingAction::Flag(FlagAction::Unset(flag)) => {
|
||||
if let Err(err) = account.set_flags(
|
||||
env_hashes,
|
||||
mailbox_hash,
|
||||
smallvec::smallvec![FlagOp::UnSet(*flag)],
|
||||
) {
|
||||
context.replies.push_back(UIEvent::StatusEvent(
|
||||
StatusEvent::DisplayMessage(err.to_string()),
|
||||
));
|
||||
}
|
||||
}
|
||||
ListingAction::Tag(TagAction::Add(ref tag_str)) => {
|
||||
if let Err(err) = account.set_flags(
|
||||
env_hashes,
|
||||
|
@ -1635,6 +1657,7 @@ impl Component for Listing {
|
|||
| Action::Listing(a @ ListingAction::CopyToOtherAccount(_, _))
|
||||
| Action::Listing(a @ ListingAction::MoveToOtherAccount(_, _))
|
||||
| Action::Listing(a @ ListingAction::ExportMbox(_, _))
|
||||
| Action::Listing(a @ ListingAction::Flag(_))
|
||||
| Action::Listing(a @ ListingAction::Tag(_)) => {
|
||||
let focused = self.component.get_focused_items(context);
|
||||
self.component.perform_action(context, focused, a);
|
||||
|
|
|
@ -941,6 +941,7 @@ impl CompactListing {
|
|||
) -> EntryStrings {
|
||||
let thread = threads.thread_ref(hash);
|
||||
let mut tags_string = String::new();
|
||||
let flags = root_envelope.flags();
|
||||
let mut colors: SmallVec<[_; 8]> = SmallVec::new();
|
||||
let account = &context.accounts[&self.cursor_pos.0];
|
||||
if account.backend_capabilities.supports_tags {
|
||||
|
@ -1004,7 +1005,26 @@ impl CompactListing {
|
|||
SubjectString(subject)
|
||||
},
|
||||
flag: FlagString(format!(
|
||||
"{selected}{snoozed}{unseen}{attachments}{whitespace}",
|
||||
"{flag_passed}{flag_replied}{flag_seen}{flag_trashed}{flag_draft}{flag_flagged} \
|
||||
{selected}{snoozed}{unseen}{attachments}{whitespace}",
|
||||
flag_passed = Some("P")
|
||||
.filter(|_| flags.contains(Flag::PASSED))
|
||||
.unwrap_or_default(),
|
||||
flag_replied = Some("R")
|
||||
.filter(|_| flags.contains(Flag::REPLIED))
|
||||
.unwrap_or_default(),
|
||||
flag_seen = Some("S")
|
||||
.filter(|_| flags.contains(Flag::SEEN))
|
||||
.unwrap_or_default(),
|
||||
flag_trashed = Some("T")
|
||||
.filter(|_| flags.contains(Flag::TRASHED))
|
||||
.unwrap_or_default(),
|
||||
flag_draft = Some("D")
|
||||
.filter(|_| flags.contains(Flag::DRAFT))
|
||||
.unwrap_or_default(),
|
||||
flag_flagged = Some("F")
|
||||
.filter(|_| flags.contains(Flag::FLAGGED))
|
||||
.unwrap_or_default(),
|
||||
selected = if self
|
||||
.rows
|
||||
.selection
|
||||
|
|
Loading…
Reference in New Issue