|
|
@ -5,7 +5,6 @@ |
|
|
|
|
|
|
|
namespace ical { |
|
|
|
Alarm::Alarm(icalcomponent* alarm_component, const uint32_t& event_dtstart) : m_event_dtstart(event_dtstart) { |
|
|
|
DEBUG << "Parsing ALARM"; |
|
|
|
parse(alarm_component); |
|
|
|
} |
|
|
|
|
|
|
@ -16,8 +15,12 @@ namespace ical { |
|
|
|
} |
|
|
|
|
|
|
|
void Alarm::parse_action(icalcomponent* alarm_component) { |
|
|
|
DEBUG << "TODO alarm action parsing" << std::endl; |
|
|
|
//DEBUG << icalproperty_get_value_as_string(icalcomponent_get_first_property(alarm_component, ICAL_ACTION_PROPERTY)) << std::endl;
|
|
|
|
std::string action = icalproperty_get_value_as_string(icalcomponent_get_first_property(alarm_component, ICAL_ACTION_PROPERTY)); |
|
|
|
if(action == "DISPLAY") m_action = ical::action::DISPLAY; |
|
|
|
else if(action == "AUDIO") m_action = ical::action::AUDIO; |
|
|
|
else if(action == "EMAIL") m_action = ical::action::EMAIL; |
|
|
|
else if(action == "PROC" ) m_action = ical::action::PROC; |
|
|
|
else m_action = ical::action::DISPLAY; |
|
|
|
} |
|
|
|
|
|
|
|
void Alarm::parse_description(icalcomponent* alarm_component) { |
|
|
@ -34,23 +37,21 @@ namespace ical { |
|
|
|
tr = icalproperty_get_trigger(trigger_property); |
|
|
|
if (!icaltime_is_null_time(tr.time)) { |
|
|
|
m_trigger = ical::trigger_type::ABSOLUTE; |
|
|
|
DEBUG << icaltime_as_ical_string(tr.time); |
|
|
|
} else { |
|
|
|
m_trigger = ical::trigger_type::RELATIVE; |
|
|
|
DEBUG << icaldurationtype_as_int(tr.duration); |
|
|
|
m_absolute_trigger = m_event_dtstart + icaldurationtype_as_int(tr.duration); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
std::string Alarm::get_action() const { |
|
|
|
//switch(m_action) {
|
|
|
|
// case ical::action::DISPLAY: return "display";
|
|
|
|
// case ical::action::AUDIO: return "audio";
|
|
|
|
// case ical::action::EMAIL: return "email";
|
|
|
|
// case ical::action::PROC: return "proc";
|
|
|
|
// default: return "";
|
|
|
|
//}
|
|
|
|
switch(m_action) { |
|
|
|
case ical::action::DISPLAY: return "display"; |
|
|
|
case ical::action::AUDIO: return "audio"; |
|
|
|
case ical::action::EMAIL: return "email"; |
|
|
|
case ical::action::PROC: return "proc"; |
|
|
|
default: return ""; |
|
|
|
} |
|
|
|
return ""; |
|
|
|
} |
|
|
|
|
|
|
@ -62,6 +63,10 @@ namespace ical { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//std::string Alarm::get_absolute_trigger() const {
|
|
|
|
// return m_absolute_trigger;
|
|
|
|
//}
|
|
|
|
|
|
|
|
std::vector<std::string> Alarm::get_db_row() const { |
|
|
|
return {db_safe(get_action()), |
|
|
|
db_safe(m_description), |
|
|
|