From 0463fa7657b1aab4a3f5c6e7909ba1513c047968 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 23 Jun 2014 20:26:09 -0500 Subject: add support for per-alarm ringtone sounds set in EDS via E_CAL_COMPONENT_ALARM_AUDIO --- src/engine-eds.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/engine-eds.cpp') diff --git a/src/engine-eds.cpp b/src/engine-eds.cpp index 1949193..80a47da 100644 --- a/src/engine-eds.cpp +++ b/src/engine-eds.cpp @@ -443,8 +443,9 @@ private: appointment.color = subtask->color; appointment.uid = uid; - // if the component has display alarms that have a url, - // use the first one as our Appointment.url + // Look through all of this component's alarms + // for DISPLAY or AUDIO url attachments. + // If we find any, use them for appointment.url and audio_sound auto alarm_uids = e_cal_component_get_alarm_uids(component); appointment.has_alarms = alarm_uids != nullptr; for(auto walk=alarm_uids; appointment.url.empty() && walk!=nullptr; walk=walk->next) @@ -453,7 +454,7 @@ private: ECalComponentAlarmAction action; e_cal_component_alarm_get_action(alarm, &action); - if (action == E_CAL_COMPONENT_ALARM_DISPLAY) + if ((action == E_CAL_COMPONENT_ALARM_DISPLAY) || (action == E_CAL_COMPONENT_ALARM_AUDIO)) { icalattach* attach = nullptr; e_cal_component_alarm_get_attach(alarm, &attach); @@ -463,7 +464,16 @@ private: { const char* url = icalattach_get_url(attach); if (url != nullptr) - appointment.url = url; + { + if ((action == E_CAL_COMPONENT_ALARM_DISPLAY) && appointment.url.empty()) + { + appointment.url = url; + } + else if ((action == E_CAL_COMPONENT_ALARM_AUDIO) && appointment.audio_url.empty()) + { + appointment.audio_url = url; + } + } } icalattach_unref(attach); -- cgit v1.2.3