mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 12:52:27 +00:00
Add first VTODO support
This commit is contained in:
@@ -115,9 +115,14 @@ impl Resource for CalendarResource {
|
|||||||
CalendarPropName::CalendarOrder => CalendarProp::CalendarOrder(Some(self.0.order)),
|
CalendarPropName::CalendarOrder => CalendarProp::CalendarOrder(Some(self.0.order)),
|
||||||
CalendarPropName::SupportedCalendarComponentSet => {
|
CalendarPropName::SupportedCalendarComponentSet => {
|
||||||
CalendarProp::SupportedCalendarComponentSet(SupportedCalendarComponentSet {
|
CalendarProp::SupportedCalendarComponentSet(SupportedCalendarComponentSet {
|
||||||
comp: vec![SupportedCalendarComponent {
|
comp: vec![
|
||||||
|
SupportedCalendarComponent {
|
||||||
name: "VEVENT".to_owned(),
|
name: "VEVENT".to_owned(),
|
||||||
}],
|
},
|
||||||
|
SupportedCalendarComponent {
|
||||||
|
name: "VTODO".to_owned(),
|
||||||
|
},
|
||||||
|
],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
CalendarPropName::SupportedCalendarData => {
|
CalendarPropName::SupportedCalendarData => {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
pub mod calendar;
|
pub mod calendar;
|
||||||
pub mod event;
|
pub mod event;
|
||||||
pub mod object;
|
pub mod object;
|
||||||
|
pub mod todo;
|
||||||
|
|
||||||
pub use calendar::Calendar;
|
pub use calendar::Calendar;
|
||||||
pub use object::CalendarObject;
|
pub use object::CalendarObject;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
use super::event::EventObject;
|
use super::{event::EventObject, todo::TodoObject};
|
||||||
use crate::Error;
|
use crate::Error;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use ical::parser::ical::component::IcalTodo;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
@@ -14,11 +13,6 @@ pub enum CalendarObjectType {
|
|||||||
Todo,
|
Todo,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct TodoObject {
|
|
||||||
todo: IcalTodo,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub enum CalendarObjectComponent {
|
pub enum CalendarObjectComponent {
|
||||||
Event(EventObject),
|
Event(EventObject),
|
||||||
@@ -126,4 +120,11 @@ impl CalendarObject {
|
|||||||
pub fn get_ics(&self) -> &str {
|
pub fn get_ics(&self) -> &str {
|
||||||
&self.ics
|
&self.ics
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_component_name(&self) -> &str {
|
||||||
|
match self.data {
|
||||||
|
CalendarObjectComponent::Todo(_) => "VTODO",
|
||||||
|
CalendarObjectComponent::Event(_) => "VEVENT",
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6
crates/store/src/model/todo.rs
Normal file
6
crates/store/src/model/todo.rs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
use ical::parser::ical::component::IcalTodo;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct TodoObject {
|
||||||
|
pub(crate) todo: IcalTodo,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user