[evolution/gnome-3-24] Bug 783682 - Misleading start date set for Memos created inline in Calendar view



commit fb430003454fd41529d6f1a76fba23893261fa10
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 15 12:22:25 2017 +0200

    Bug 783682 - Misleading start date set for Memos created inline in Calendar view

 src/calendar/gui/e-cal-model.c             |    4 +++-
 src/modules/calendar/e-cal-shell-content.c |   16 ++++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/calendar/gui/e-cal-model.c b/src/calendar/gui/e-cal-model.c
index f9accea..582fd7f 100644
--- a/src/calendar/gui/e-cal-model.c
+++ b/src/calendar/gui/e-cal-model.c
@@ -1440,7 +1440,9 @@ cal_model_create_component_from_values_thread (EAlertSinkThreadJobData *job_data
                        time_t tt = ccd->model->priv->get_default_time (ccd->model, 
ccd->model->priv->get_default_time_user_data);
 
                        if (tt > 0) {
-                               struct icaltimetype itt = icaltime_from_timet_with_zone (tt, FALSE, 
e_cal_model_get_timezone (ccd->model));
+                               /* Store Memo DTSTART as date, not as date-time */
+                               struct icaltimetype itt = icaltime_from_timet_with_zone (tt,
+                                       icalcomponent_isa (comp_data->icalcomp) == ICAL_VJOURNAL_COMPONENT, 
e_cal_model_get_timezone (ccd->model));
                                icalproperty *prop = icalcomponent_get_first_property (comp_data->icalcomp, 
ICAL_DTSTART_PROPERTY);
 
                                if (prop) {
diff --git a/src/modules/calendar/e-cal-shell-content.c b/src/modules/calendar/e-cal-shell-content.c
index eeab5d1..dd7d521 100644
--- a/src/modules/calendar/e-cal-shell-content.c
+++ b/src/modules/calendar/e-cal-shell-content.c
@@ -1054,12 +1054,24 @@ cal_shell_content_get_default_time (ECalModel *model,
                                    gpointer user_data)
 {
        ECalShellContent *cal_shell_content = user_data;
+       icaltimezone *zone;
 
        g_return_val_if_fail (model != NULL, 0);
        g_return_val_if_fail (E_IS_CAL_SHELL_CONTENT (cal_shell_content), 0);
 
-       return cal_comp_gdate_to_timet (&cal_shell_content->priv->view_start,
-               e_cal_model_get_timezone (model));
+       if (e_cal_shell_content_get_current_view_id (cal_shell_content) != E_CAL_VIEW_KIND_LIST) {
+               ECalendarView *cal_view;
+               time_t selected_start = (time_t) 0, selected_end = (time_t) 0;
+
+               cal_view = e_cal_shell_content_get_current_calendar_view (cal_shell_content);
+
+               if (cal_view && e_calendar_view_get_selected_time_range (cal_view, &selected_start, 
&selected_end))
+                       return selected_start;
+       }
+
+       zone = e_cal_model_get_timezone (model);
+
+       return icaltime_as_timet_with_zone (icaltime_current_time_with_zone (zone), zone);
 }
 
 static void


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