You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

actions.rs 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * meli - ui crate.
  3. *
  4. * Copyright 2017-2018 Manos Pitsidianakis
  5. *
  6. * This file is part of meli.
  7. *
  8. * meli is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * meli is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with meli. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /*!
  22. * User actions that need to be handled by the UI
  23. */
  24. use crate::components::Component;
  25. pub use melib::mailbox::{SortField, SortOrder};
  26. use melib::thread::ThreadHash;
  27. use melib::{Draft, EnvelopeHash};
  28. extern crate uuid;
  29. use uuid::Uuid;
  30. #[derive(Debug)]
  31. pub enum ListingAction {
  32. SetPlain,
  33. SetThreaded,
  34. SetCompact,
  35. Filter(String),
  36. SetSeen,
  37. SetUnseen,
  38. Delete,
  39. }
  40. #[derive(Debug)]
  41. pub enum TabAction {
  42. TabOpen(Option<Box<Component>>),
  43. NewDraft(usize, Option<Draft>),
  44. Reply((usize, usize, usize), ThreadHash), // thread coordinates (account, mailbox, root_set idx) and thread hash
  45. Close,
  46. Edit(usize, EnvelopeHash), // account_position, envelope hash
  47. Kill(Uuid),
  48. }
  49. #[derive(Debug)]
  50. pub enum MailingListAction {
  51. ListPost,
  52. ListArchive,
  53. ListUnsubscribe,
  54. }
  55. #[derive(Debug)]
  56. pub enum PagerAction {
  57. Pipe(String, Vec<String>),
  58. }
  59. #[derive(Debug)]
  60. pub enum ComposeAction {
  61. AddAttachment(String),
  62. RemoveAttachment(usize),
  63. }
  64. #[derive(Debug)]
  65. pub enum Action {
  66. Listing(ListingAction),
  67. ViewMailbox(usize),
  68. Sort(SortField, SortOrder),
  69. SubSort(SortField, SortOrder),
  70. Tab(TabAction),
  71. ToggleThreadSnooze,
  72. MailingListAction(MailingListAction),
  73. Pager(PagerAction),
  74. SetEnv(String, String),
  75. PrintEnv(String),
  76. Compose(ComposeAction),
  77. }