From 9ef4e0a1c9809e153306a68971081db387ea1ade Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Tue, 30 Oct 2001 01:49:59 +0000 Subject: use libical-evolution.la 2001-10-29 Damon Chaplin * importers/Makefile.am (evolution_calendar_importer_LDADD): * gui/Makefile.am (evolution_calendar_LDADD): * cal-util/Makefile.am (test_recur_LDADD): * cal-client/Makefile.am (client_test_LDADD): use libical-evolution.la * gui/dialogs/schedule-page.c: save the timezone passed in for the start time, so if our times are changed we use this. Also, if the end time was passed in in a different timezone, convert it. Also hide the time fields for DATE values. Note that DATE values still do not work. * gui/dialogs/meeting-page.glade: changed "Invite Others" to "Invite Others..." to be consistent with the other page. * gui/dialogs/event-page.c (times_updated): (all_day_event_toggled_cb): set is_date if appropriate. * gui/e-itip-control.c (write_label_piece): convert all UTC times to the current timezone. Outlook sends simple, non-recurring, events as UTC times, which isn't very useful. svn path=/trunk/; revision=14397 --- calendar/gui/dialogs/event-page.c | 5 +++ calendar/gui/dialogs/meeting-page.glade | 2 +- calendar/gui/dialogs/schedule-page.c | 57 ++++++++++++++++++++++++++------- 3 files changed, 51 insertions(+), 13 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 44b6c0e711..72b6fe9871 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -930,6 +930,9 @@ times_updated (EventPage *epage, gboolean adjust_end_time) set_start_date = TRUE; } } + + start_tt.is_date = TRUE; + end_tt.is_date = TRUE; } else { /* For DATE-TIME events, we have to convert to the same timezone before comparing. */ @@ -1099,6 +1102,7 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data) start_tt.hour = 0; start_tt.minute = 0; start_tt.second = 0; + start_tt.is_date = TRUE; /* Round down to the start of the day, or the start of the previous day if it is midnight. */ @@ -1106,6 +1110,7 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data) end_tt.hour = 0; end_tt.minute = 0; end_tt.second = 0; + end_tt.is_date = TRUE; } else { icaltimezone *start_zone, *end_zone; diff --git a/calendar/gui/dialogs/meeting-page.glade b/calendar/gui/dialogs/meeting-page.glade index 3aabf95102..f06f457d16 100644 --- a/calendar/gui/dialogs/meeting-page.glade +++ b/calendar/gui/dialogs/meeting-page.glade @@ -291,7 +291,7 @@ GtkButton invite True - + GTK_RELIEF_NORMAL 0 diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index e2bda140cd..08cc57e48b 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -66,6 +66,11 @@ struct _SchedulePagePrivate { /* Selector */ EMeetingTimeSelector *sel; + /* The timezone we use. Note that we use the same timezone for the + start and end date. We convert the end date if it is passed in in + another timezone. */ + icaltimezone *zone; + gboolean updating; }; @@ -155,6 +160,8 @@ schedule_page_init (SchedulePage *spage) priv->main = NULL; + priv->zone = NULL; + priv->updating = FALSE; } @@ -218,9 +225,10 @@ static void update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponentDateTime *end_date) { SchedulePagePrivate *priv; - struct icaltimetype *start_tt, *end_tt; + struct icaltimetype start_tt, end_tt; icaltimezone *start_zone = NULL, *end_zone = NULL; CalClientGetStatus status; + gboolean all_day; priv = spage->priv; @@ -249,18 +257,32 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent end_date->tzid ? end_date->tzid : ""); } - start_tt = start_date->value; - end_tt = end_date->value; + start_tt = *start_date->value; + end_tt = *end_date->value; - e_date_edit_set_date (E_DATE_EDIT (priv->sel->start_date_edit), start_tt->year, - start_tt->month, start_tt->day); + /* If the end zone is not the same as the start zone, we convert it. */ + priv->zone = start_zone; + if (start_zone != end_zone) { + icaltimezone_convert_time (&end_tt, end_zone, start_zone); + } + + all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE; + + /* For All-Day events, we set the time field to empty. */ + e_date_edit_set_date (E_DATE_EDIT (priv->sel->start_date_edit), start_tt.year, + start_tt.month, start_tt.day); e_date_edit_set_time_of_day (E_DATE_EDIT (priv->sel->start_date_edit), - start_tt->hour, start_tt->minute); + start_tt.hour, start_tt.minute); - e_date_edit_set_date (E_DATE_EDIT (priv->sel->end_date_edit), end_tt->year, - end_tt->month, end_tt->day); + e_date_edit_set_date (E_DATE_EDIT (priv->sel->end_date_edit), end_tt.year, + end_tt.month, end_tt.day); e_date_edit_set_time_of_day (E_DATE_EDIT (priv->sel->end_date_edit), - end_tt->hour, end_tt->minute); + end_tt.hour, end_tt.minute); + + e_date_edit_set_show_time (E_DATE_EDIT (priv->sel->start_date_edit), + !all_day); + e_date_edit_set_show_time (E_DATE_EDIT (priv->sel->end_date_edit), + !all_day); } @@ -460,7 +482,9 @@ time_changed_cb (GtkWidget *widget, gpointer data) SchedulePagePrivate *priv; CompEditorPageDates dates; CalComponentDateTime start_dt, end_dt; - struct icaltimetype start_tt, end_tt; + struct icaltimetype start_tt = icaltime_null_time (); + struct icaltimetype end_tt = icaltime_null_time (); + gboolean start_time_set, end_time_set; priv = spage->priv; @@ -485,8 +509,17 @@ time_changed_cb (GtkWidget *widget, gpointer data) start_dt.value = &start_tt; end_dt.value = &end_tt; - start_dt.tzid = NULL; - end_dt.tzid = NULL; + if (e_date_edit_get_show_time (E_DATE_EDIT (priv->sel->start_date_edit))) { + /* We set the start and end to the same timezone. */ + start_dt.tzid = icaltimezone_get_tzid (priv->zone); + end_dt.tzid = start_dt.tzid; + } else { + /* For All-Day Events, we set the timezone to NULL. */ + start_dt.value->is_date = TRUE; + start_dt.tzid = NULL; + end_dt.value->is_date = TRUE; + end_dt.tzid = NULL; + } dates.start = &start_dt; dates.end = &end_dt; -- cgit v1.2.3