2018-08-07 15:01:15 +03:00
|
|
|
/*
|
|
|
|
* meli - ui crate.
|
|
|
|
*
|
|
|
|
* Copyright 2017-2018 Manos Pitsidianakis
|
|
|
|
*
|
|
|
|
* This file is part of meli.
|
|
|
|
*
|
|
|
|
* meli is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* meli is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with meli. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-08-06 22:20:34 +03:00
|
|
|
/*!
|
|
|
|
* User actions that need to be handled by the UI
|
|
|
|
*/
|
|
|
|
|
2019-06-18 21:13:58 +03:00
|
|
|
use crate::components::Component;
|
2019-08-26 19:44:05 +03:00
|
|
|
use melib::backends::FolderOperation;
|
2019-05-14 21:47:47 +03:00
|
|
|
use melib::thread::ThreadHash;
|
2019-09-08 11:05:25 +03:00
|
|
|
pub use melib::thread::{SortField, SortOrder};
|
2019-06-18 22:13:54 +03:00
|
|
|
use melib::{Draft, EnvelopeHash};
|
2018-08-07 11:47:26 +03:00
|
|
|
|
2018-09-04 01:49:29 +03:00
|
|
|
extern crate uuid;
|
|
|
|
use uuid::Uuid;
|
|
|
|
|
2019-12-01 17:12:41 +02:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum TagAction {
|
|
|
|
Add(String),
|
|
|
|
Remove(String),
|
|
|
|
}
|
|
|
|
|
2019-03-14 12:19:25 +02:00
|
|
|
#[derive(Debug)]
|
2018-09-04 01:49:29 +03:00
|
|
|
pub enum ListingAction {
|
2018-09-07 09:44:37 +03:00
|
|
|
SetPlain,
|
|
|
|
SetThreaded,
|
|
|
|
SetCompact,
|
2019-09-14 12:43:19 +03:00
|
|
|
SetConversations,
|
2019-06-22 16:13:40 +03:00
|
|
|
Filter(String),
|
2019-07-18 20:23:02 +03:00
|
|
|
SetSeen,
|
|
|
|
SetUnseen,
|
2019-06-23 11:42:48 +03:00
|
|
|
Delete,
|
2019-09-15 14:10:06 +03:00
|
|
|
OpenInNewTab,
|
2019-12-01 17:12:41 +02:00
|
|
|
Tag(TagAction),
|
2018-08-05 16:26:42 +03:00
|
|
|
}
|
|
|
|
|
2019-03-14 12:19:25 +02:00
|
|
|
#[derive(Debug)]
|
2018-09-04 01:49:29 +03:00
|
|
|
pub enum TabAction {
|
2019-09-09 11:54:47 +03:00
|
|
|
New(Option<Box<dyn Component>>),
|
2019-06-18 22:13:54 +03:00
|
|
|
NewDraft(usize, Option<Draft>),
|
2019-05-14 21:47:47 +03:00
|
|
|
Reply((usize, usize, usize), ThreadHash), // thread coordinates (account, mailbox, root_set idx) and thread hash
|
2018-09-04 01:49:29 +03:00
|
|
|
Close,
|
2019-05-26 02:34:03 +03:00
|
|
|
Edit(usize, EnvelopeHash), // account_position, envelope hash
|
2018-09-04 01:49:29 +03:00
|
|
|
Kill(Uuid),
|
|
|
|
}
|
|
|
|
|
2019-06-18 22:01:02 +03:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum MailingListAction {
|
|
|
|
ListPost,
|
|
|
|
ListArchive,
|
|
|
|
ListUnsubscribe,
|
|
|
|
}
|
|
|
|
|
2019-07-15 00:04:00 +03:00
|
|
|
#[derive(Debug)]
|
2019-11-10 13:33:22 +02:00
|
|
|
pub enum ViewAction {
|
2019-07-15 00:04:00 +03:00
|
|
|
Pipe(String, Vec<String>),
|
2019-11-10 13:33:22 +02:00
|
|
|
SaveAttachment(usize, String),
|
2019-07-15 00:04:00 +03:00
|
|
|
}
|
|
|
|
|
2019-08-01 12:28:36 +03:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum ComposeAction {
|
|
|
|
AddAttachment(String),
|
|
|
|
RemoveAttachment(usize),
|
2019-09-28 10:46:49 +03:00
|
|
|
ToggleSign,
|
2019-08-01 12:28:36 +03:00
|
|
|
}
|
|
|
|
|
2019-10-30 21:09:48 +02:00
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum AccountAction {
|
|
|
|
ReIndex,
|
|
|
|
}
|
|
|
|
|
2019-03-14 12:19:25 +02:00
|
|
|
#[derive(Debug)]
|
2018-08-05 16:26:42 +03:00
|
|
|
pub enum Action {
|
2018-09-04 01:49:29 +03:00
|
|
|
Listing(ListingAction),
|
2018-08-05 16:26:42 +03:00
|
|
|
ViewMailbox(usize),
|
2018-08-07 11:47:26 +03:00
|
|
|
Sort(SortField, SortOrder),
|
|
|
|
SubSort(SortField, SortOrder),
|
2018-09-04 01:49:29 +03:00
|
|
|
Tab(TabAction),
|
2019-05-15 20:58:59 +03:00
|
|
|
ToggleThreadSnooze,
|
2019-06-18 22:01:02 +03:00
|
|
|
MailingListAction(MailingListAction),
|
2019-11-10 13:33:22 +02:00
|
|
|
View(ViewAction),
|
2019-06-26 18:56:29 +03:00
|
|
|
SetEnv(String, String),
|
|
|
|
PrintEnv(String),
|
2019-08-01 12:28:36 +03:00
|
|
|
Compose(ComposeAction),
|
2019-08-26 19:44:05 +03:00
|
|
|
Folder(AccountName, FolderPath, FolderOperation),
|
2019-10-30 21:09:48 +02:00
|
|
|
AccountAction(AccountName, AccountAction),
|
2018-08-05 16:26:42 +03:00
|
|
|
}
|
2019-08-26 19:44:05 +03:00
|
|
|
|
|
|
|
type AccountName = String;
|
|
|
|
type FolderPath = String;
|