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.

60 lines
1.5KB

  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::EnvelopeHash;
  28. extern crate uuid;
  29. use uuid::Uuid;
  30. #[derive(Debug)]
  31. pub enum ListingAction {
  32. SetPlain,
  33. SetThreaded,
  34. SetCompact,
  35. }
  36. #[derive(Debug)]
  37. pub enum TabAction {
  38. TabOpen(Option<Box<Component>>),
  39. NewDraft(usize),
  40. Reply((usize, usize, usize), ThreadHash), // thread coordinates (account, mailbox, root_set idx) and thread hash
  41. Close,
  42. Edit(usize, EnvelopeHash), // account_position, envelope hash
  43. Kill(Uuid),
  44. }
  45. #[derive(Debug)]
  46. pub enum Action {
  47. Listing(ListingAction),
  48. ViewMailbox(usize),
  49. Sort(SortField, SortOrder),
  50. SubSort(SortField, SortOrder),
  51. Tab(TabAction),
  52. ToggleThreadSnooze,
  53. }