Add first VTODO support

This commit is contained in:
Lennart
2024-09-30 20:20:32 +02:00
parent b3a7806139
commit eeacbc888d
4 changed files with 23 additions and 10 deletions

View File

@@ -1,6 +1,7 @@
pub mod calendar;
pub mod event;
pub mod object;
pub mod todo;
pub use calendar::Calendar;
pub use object::CalendarObject;

View File

@@ -1,7 +1,6 @@
use super::event::EventObject;
use super::{event::EventObject, todo::TodoObject};
use crate::Error;
use anyhow::Result;
use ical::parser::ical::component::IcalTodo;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::io::BufReader;
@@ -14,11 +13,6 @@ pub enum CalendarObjectType {
Todo,
}
#[derive(Debug, Clone)]
pub struct TodoObject {
todo: IcalTodo,
}
#[derive(Debug, Clone)]
pub enum CalendarObjectComponent {
Event(EventObject),
@@ -126,4 +120,11 @@ impl CalendarObject {
pub fn get_ics(&self) -> &str {
&self.ics
}
pub fn get_component_name(&self) -> &str {
match self.data {
CalendarObjectComponent::Todo(_) => "VTODO",
CalendarObjectComponent::Event(_) => "VEVENT",
}
}
}

View File

@@ -0,0 +1,6 @@
use ical::parser::ical::component::IcalTodo;
#[derive(Debug, Clone)]
pub struct TodoObject {
pub(crate) todo: IcalTodo,
}