[evolution/gnome-3-32] I#339 - Include SUMMARY property in email reminders



commit 41594a87aa7da2215dee7a2f8703a54178e42b84
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 11 12:02:03 2019 +0100

    I#339 - Include SUMMARY property in email reminders
    
    Closes https://gitlab.gnome.org/GNOME/evolution/issues/339

 src/calendar/gui/e-comp-editor-page-reminders.c | 35 +++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
---
diff --git a/src/calendar/gui/e-comp-editor-page-reminders.c b/src/calendar/gui/e-comp-editor-page-reminders.c
index 5a2933b4a3..47a21457c7 100644
--- a/src/calendar/gui/e-comp-editor-page-reminders.c
+++ b/src/calendar/gui/e-comp-editor-page-reminders.c
@@ -1455,6 +1455,7 @@ ecep_reminders_fill_component (ECompEditorPage *page,
             valid_iter;
             valid_iter = gtk_tree_model_iter_next (model, &iter)) {
                ECalComponentAlarm *alarm, *alarm_copy;
+               ECalComponentAlarmAction action = E_CAL_COMPONENT_ALARM_UNKNOWN;
                icalcomponent *icalcomp;
                icalproperty *prop;
 
@@ -1486,6 +1487,40 @@ ecep_reminders_fill_component (ECompEditorPage *page,
                        }
                }
 
+               e_cal_component_alarm_get_action (alarm, &action);
+
+               prop = icalcomponent_get_first_property (icalcomp, ICAL_SUMMARY_PROPERTY);
+               if (action == E_CAL_COMPONENT_ALARM_EMAIL) {
+                       ECalComponentText summary = { NULL, NULL };
+
+                       e_cal_component_get_summary (comp, &summary);
+
+                       if (prop) {
+                               icalproperty_set_summary (prop, summary.value ? summary.value : "");
+                       } else {
+                               prop = icalproperty_new_summary (summary.value ? summary.value : "");
+                               icalcomponent_add_property (icalcomp, prop);
+                       }
+               } else if (prop) {
+                       icalcomponent_remove_property (icalcomp, prop);
+                       icalproperty_free (prop);
+               }
+
+               prop = icalcomponent_get_first_property (icalcomp, ICAL_DESCRIPTION_PROPERTY);
+               if (action == E_CAL_COMPONENT_ALARM_EMAIL || action == E_CAL_COMPONENT_ALARM_DISPLAY) {
+                       if (!prop) {
+                               const gchar *description;
+
+                               description = icalcomponent_get_description 
(e_cal_component_get_icalcomponent (comp));
+
+                               prop = icalproperty_new_description (description ? description : "");
+                               icalcomponent_add_property (icalcomp, prop);
+                       }
+               } else if (prop) {
+                       icalcomponent_remove_property (icalcomp, prop);
+                       icalproperty_free (prop);
+               }
+
                /* We clone the alarm to maintain the invariant that the alarm
                 * structures in the list did *not* come from the component.
                 */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]