[evolution] Bug 793104 - COMPLETED in libical 3.0+ is DATE-TIME only



commit 2db72dd4ff4ccff307fcd803c3140679d6d1fb84
Author: Milan Crha <mcrha redhat com>
Date:   Tue Feb 6 18:18:55 2018 +0100

    Bug 793104 - COMPLETED in libical 3.0+ is DATE-TIME only

 src/calendar/gui/e-comp-editor-property-parts.c |   34 +++++++++++++++++++++-
 src/calendar/gui/e-to-do-pane.c                 |    5 +++
 2 files changed, 37 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/gui/e-comp-editor-property-parts.c b/src/calendar/gui/e-comp-editor-property-parts.c
index 7027537..3b2cc71 100644
--- a/src/calendar/gui/e-comp-editor-property-parts.c
+++ b/src/calendar/gui/e-comp-editor-property-parts.c
@@ -1092,6 +1092,36 @@ GType e_comp_editor_property_part_completed_get_type (void) G_GNUC_CONST;
 G_DEFINE_TYPE (ECompEditorPropertyPartCompleted, e_comp_editor_property_part_completed, 
E_TYPE_COMP_EDITOR_PROPERTY_PART_DATETIME_LABELED)
 
 static void
+e_comp_editor_property_part_completed_ensure_date_time (struct icaltimetype *pvalue)
+{
+       if (!pvalue || !pvalue->is_date)
+               return;
+
+       pvalue->is_date = 0;
+       pvalue->hour = 0;
+       pvalue->minute = 0;
+       pvalue->second = 0;
+       pvalue->zone = icaltimezone_get_utc_timezone ();
+}
+
+static icalproperty *
+e_comp_editor_property_part_completed_new_func_wrapper (struct icaltimetype value)
+{
+       e_comp_editor_property_part_completed_ensure_date_time (&value);
+
+       return icalproperty_new_completed (value);
+}
+
+static void
+e_comp_editor_property_part_completed_set_func_wrapper (icalproperty *prop,
+                                                       struct icaltimetype value)
+{
+       e_comp_editor_property_part_completed_ensure_date_time (&value);
+
+       return icalproperty_set_completed (prop, value);
+}
+
+static void
 e_comp_editor_property_part_completed_init (ECompEditorPropertyPartCompleted *part_completed)
 {
 }
@@ -1103,8 +1133,8 @@ e_comp_editor_property_part_completed_class_init (ECompEditorPropertyPartComplet
 
        part_datetime_class = E_COMP_EDITOR_PROPERTY_PART_DATETIME_CLASS (klass);
        part_datetime_class->ical_prop_kind = ICAL_COMPLETED_PROPERTY;
-       part_datetime_class->ical_new_func = icalproperty_new_completed;
-       part_datetime_class->ical_set_func = icalproperty_set_completed;
+       part_datetime_class->ical_new_func = e_comp_editor_property_part_completed_new_func_wrapper;
+       part_datetime_class->ical_set_func = e_comp_editor_property_part_completed_set_func_wrapper;
        part_datetime_class->ical_get_func = icalproperty_get_completed;
 }
 
diff --git a/src/calendar/gui/e-to-do-pane.c b/src/calendar/gui/e-to-do-pane.c
index 2473223..d45e9a9 100644
--- a/src/calendar/gui/e-to-do-pane.c
+++ b/src/calendar/gui/e-to-do-pane.c
@@ -407,6 +407,11 @@ etdp_get_component_data (EToDoPane *to_do_pane,
 
                        *out_is_completed = TRUE;
                        e_cal_component_free_icaltimetype (completed);
+               } else {
+                       icalproperty_status status = ICAL_STATUS_NONE;
+
+                       e_cal_component_get_status (comp, &status);
+                       *out_is_completed = *out_is_completed || status == ICAL_STATUS_COMPLETED;
                }
        } else {
                /* Events first */


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