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.

62 lines
1.9 KiB

  1. /*
  2. * meli - listing conf module
  3. *
  4. * Copyright 2020 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. use super::{default_vals::*, IndexStyle};
  22. use melib::search::Query;
  23. /// Settings for mail listings
  24. #[derive(Debug, Deserialize, Clone, Serialize)]
  25. pub struct ListingSettings {
  26. /// Number of context lines when going to next page.
  27. /// Default: 0
  28. #[serde(default = "zero_val", alias = "context-lines")]
  29. pub context_lines: usize,
  30. /// Datetime formatting passed verbatim to strftime(3).
  31. /// Default: %Y-%m-%d %T
  32. #[serde(default = "none", alias = "datetime-fmt")]
  33. pub datetime_fmt: Option<String>,
  34. /// Show recent dates as `X {minutes,hours,days} ago`, up to 7 days.
  35. /// Default: true
  36. #[serde(default = "true_val", alias = "recent-dates")]
  37. pub recent_dates: bool,
  38. /// Show only envelopes that match this query
  39. /// Default: None
  40. #[serde(default = "none")]
  41. pub filter: Option<Query>,
  42. #[serde(default, alias = "index-style")]
  43. pub index_style: IndexStyle,
  44. }
  45. impl Default for ListingSettings {
  46. fn default() -> Self {
  47. Self {
  48. context_lines: 0,
  49. datetime_fmt: None,
  50. recent_dates: true,
  51. filter: None,
  52. index_style: IndexStyle::default(),
  53. }
  54. }
  55. }