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/Makefile.am | 2 +- calendar/gui/alarm-notify/Makefile.am | 2 +- calendar/gui/dialogs/event-page.c | 5 +++ calendar/gui/dialogs/meeting-page.glade | 2 +- calendar/gui/dialogs/schedule-page.c | 57 ++++++++++++++++++++++++++------- calendar/gui/e-itip-control.c | 30 +++++++++-------- calendar/gui/e-meeting-time-sel.c | 2 +- 7 files changed, 70 insertions(+), 30 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 7a22f6abc7..20567ced8a 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -166,7 +166,7 @@ evolution_calendar_LDADD = \ $(top_builddir)/calendar/cal-util/libcal-util.la \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/libical/src/libical/libical.la \ + $(top_builddir)/libical/src/libical/libical-evolution.la \ $(top_builddir)/libwombat/libwombat.la \ $(top_builddir)/addressbook/backend/ebook/libebook.la \ $(top_builddir)/camel/libcamel.la \ diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am index 5e4fb8d5ee..df2598b6bc 100644 --- a/calendar/gui/alarm-notify/Makefile.am +++ b/calendar/gui/alarm-notify/Makefile.am @@ -63,7 +63,7 @@ evolution_alarm_notify_LDADD = \ libalarm.a \ $(top_builddir)/calendar/cal-client/libcal-client.la \ $(top_builddir)/calendar/cal-util/libcal-util.la \ - $(top_builddir)/libical/src/libical/libical.la \ + $(top_builddir)/libical/src/libical/libical-evolution.la \ $(top_builddir)/libwombat/libwombat.la \ $(top_builddir)/e-util/libeutil.la \ $(BONOBO_CONF_LIBS) \ 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; diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 04615b6852..f0e89d6eec 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -450,7 +450,7 @@ set_button_status (EItipControl *itip) static void write_label_piece (EItipControl *itip, CalComponentDateTime *dt, char *buffer, int size, - const char *stext, const char *etext, gboolean is_utc) + const char *stext, const char *etext) { EItipControlPrivate *priv; struct tm tmp_tm; @@ -460,9 +460,10 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt, priv = itip->priv; - /* If we have been passed a UTC value, i.e. for the COMPLETED property, - we convert it to the current timezone to display. */ - if (is_utc) { + /* UTC times get converted to the current timezone. This is done for + the COMPLETED property, which is always in UTC, and also because + Outlook sends simple events as UTC times. */ + if (dt->value->is_utc) { char *location = calendar_config_get_timezone (); zone = icaltimezone_get_builtin_timezone (location); icaltimezone_convert_time (dt->value, icaltimezone_get_utc_timezone (), zone); @@ -482,7 +483,7 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt, strcat (buffer, time_utf8); g_free (time_utf8); - if (!is_utc && dt->tzid) { + if (!dt->value->is_utc && dt->tzid) { zone = icalcomponent_get_timezone (priv->top_level, dt->tzid); } @@ -521,20 +522,20 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, case CAL_COMPONENT_EVENT: write_label_piece (itip, &datetime, buffer, 1024, U_("Meeting begins: "), - "
", FALSE); + "
"); break; case CAL_COMPONENT_TODO: write_label_piece (itip, &datetime, buffer, 1024, U_("Task begins: "), - "
", FALSE); + "
"); break; case CAL_COMPONENT_FREEBUSY: write_label_piece (itip, &datetime, buffer, 1024, U_("Free/Busy info begins: "), - "
", FALSE); + "
"); break; default: - write_label_piece (itip, &datetime, buffer, 1024, U_("Begins: "), "
", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("Begins: "), "
"); } gtk_html_write (html, html_stream, buffer, strlen(buffer)); wrote = TRUE; @@ -546,14 +547,14 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, if (datetime.value){ switch (type) { case CAL_COMPONENT_EVENT: - write_label_piece (itip, &datetime, buffer, 1024, U_("Meeting ends: "), "
", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("Meeting ends: "), "
"); break; case CAL_COMPONENT_FREEBUSY: write_label_piece (itip, &datetime, buffer, 1024, U_("Free/Busy info ends: "), - "
", FALSE); + "
"); break; default: - write_label_piece (itip, &datetime, buffer, 1024, U_("Ends: "), "
", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("Ends: "), "
"); } gtk_html_write (html, html_stream, buffer, strlen (buffer)); wrote = TRUE; @@ -566,7 +567,8 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, if (type == CAL_COMPONENT_TODO && datetime.value) { /* Pass TRUE as is_utc, so it gets converted to the current timezone. */ - write_label_piece (itip, &datetime, buffer, 1024, U_("Task Completed: "), "
", TRUE); + datetime.value->is_utc = TRUE; + write_label_piece (itip, &datetime, buffer, 1024, U_("Task Completed: "), "
"); gtk_html_write (html, html_stream, buffer, strlen (buffer)); wrote = TRUE; task_completed = TRUE; @@ -576,7 +578,7 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream, buffer[0] = '\0'; cal_component_get_due (comp, &datetime); if (type == CAL_COMPONENT_TODO && !task_completed && datetime.value) { - write_label_piece (itip, &datetime, buffer, 1024, U_("Task Due: "), "
", FALSE); + write_label_piece (itip, &datetime, buffer, 1024, U_("Task Due: "), "
"); gtk_html_write (html, html_stream, buffer, strlen (buffer)); wrote = TRUE; } diff --git a/calendar/gui/e-meeting-time-sel.c b/calendar/gui/e-meeting-time-sel.c index e366b58378..2358ef2be8 100644 --- a/calendar/gui/e-meeting-time-sel.c +++ b/calendar/gui/e-meeting-time-sel.c @@ -608,7 +608,7 @@ e_meeting_time_selector_construct (EMeetingTimeSelector * mts, EMeetingModel *em gtk_widget_show (menuitem); /* Create the date entry fields on the right. */ - alignment = gtk_alignment_new (0.5, 0.5, 0, 0); + alignment = gtk_alignment_new (0.0, 0.5, 0, 0); gtk_table_attach (GTK_TABLE (mts), alignment, 1, 4, 5, 6, GTK_FILL, 0, 0, 0); gtk_widget_show (alignment); -- cgit v1.2.3