[evolution-ews/gnome-3-28] I#5 - Cannot set/change task priority



commit 7093af2308dbb42e2e736d472428bc257e6daf6f
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 26 08:26:49 2018 +0200

    I#5 - Cannot set/change task priority
    
    Closes https://gitlab.gnome.org/GNOME/evolution-ews/issues/5

 src/calendar/e-cal-backend-ews-utils.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/src/calendar/e-cal-backend-ews-utils.c b/src/calendar/e-cal-backend-ews-utils.c
index 34eee8d3..2c4574af 100644
--- a/src/calendar/e-cal-backend-ews-utils.c
+++ b/src/calendar/e-cal-backend-ews-utils.c
@@ -1227,6 +1227,18 @@ convert_vevent_calcomp_to_xml (ESoapMessage *msg,
        g_object_unref (comp);
 }
 
+static const gchar *
+ews_priority_to_string (gint priority)
+{
+       if (priority <= 3)
+               return "High";
+
+       if (priority >= 7)
+               return "Low";
+
+       return "Normal";
+}
+
 static void
 convert_vtodo_calcomp_to_xml (ESoapMessage *msg,
                               gpointer user_data)
@@ -1248,6 +1260,14 @@ convert_vtodo_calcomp_to_xml (ESoapMessage *msg,
 
        convert_categories_calcomp_to_xml (msg, NULL, icalcomp);
 
+       prop = icalcomponent_get_first_property (icalcomp, ICAL_PRIORITY_PROPERTY);
+       if (prop) {
+               gint priority;
+
+               priority = icalproperty_get_priority (prop);
+               e_ews_message_write_string_parameter (msg, "Importance", NULL, ews_priority_to_string 
(priority));
+       }
+
        prop = icalcomponent_get_first_property (icalcomp, ICAL_DUE_PROPERTY);
        if (prop) {
                dt = icalproperty_get_due (prop);
@@ -1791,6 +1811,14 @@ convert_vtodo_component_to_updatexml (ESoapMessage *msg,
        /* Categories */
        convert_component_categories_to_updatexml (convert_data->comp, msg, "Task");
 
+       prop = icalcomponent_get_first_property (icalcomp, ICAL_PRIORITY_PROPERTY);
+       if (prop) {
+               gint priority;
+
+               priority = icalproperty_get_priority (prop);
+               convert_vtodo_property_to_updatexml (msg, "Importance", ews_priority_to_string (priority), 
"item", NULL, NULL);
+       }
+
        e_ews_message_end_item_change (msg);
 }
 


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