aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/dialogs
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-09-27 12:02:17 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-09-27 12:02:17 +0800
commitb235a79effc13b17b0bffc78189b831493bd37d6 (patch)
tree1717b8309b347b794dd05f7bfd657c57d1707f82 /calendar/gui/dialogs
parentf0c38138fa31e7e03c289f75c85d4c214ff9dcca (diff)
downloadgsoc2013-evolution-b235a79effc13b17b0bffc78189b831493bd37d6.tar.gz
gsoc2013-evolution-b235a79effc13b17b0bffc78189b831493bd37d6.tar.zst
gsoc2013-evolution-b235a79effc13b17b0bffc78189b831493bd37d6.zip
added comparison functions for these special cell types. But the date and
2001-09-26 Damon Chaplin <damon@ximian.com> * gui/e-calendar-table.c (date_compare_cb): (percent_compare_cb): (priority_compare_cb): added comparison functions for these special cell types. But the date and percent ones don't work yet due to the use of static text buffers for return cell values. (e_calendar_table_init): added the comparison functions to the ETableExtras. NOTE: task_compare_cb() never seems to be called. I'm not sure why it is there. * gui/e-calendar-table.etspec: set the comparison function names for the date/percent/priority fields. * cal-util/cal-util.c (cal_util_priority_to_string): (cal_util_priority_from_string): new utility functions. * gui/calendar-model.c (get_priority): (set_priority): used above utility functions, and removed the warning dialog which isn't useful now that the field isn't editable. * gui/dialogs/event-page.c (times_updated): handle timezones and for all-day events make sure it stays an all-day event after adjusting. Fixes bugs #5945 and #10222. * gui/calendar-commands.c (pixmaps): fixed the E_PIXMAP paths - the edit items were moved beneath 'EditPlaceholder'. This gets rid of those long Bonobo warnings! (and we get the icons back) * gui/dialogs/comp-editor.c (pixmaps): removed the PrintPreview toolbar icon, since it doesn't appear in the xml file. Gets rid of warning. * gui/dialogs/event-page.c (notify_dates_changed): new function to emit the notification signal when the dates are changed. It also handles timezones now. * gui/dialogs/comp-editor-page.h (CompEditorPageDates): used CalComponentDateTime for start/end/due so we have the timezone as well as the time. * gui/dialogs/comp-editor-util.c (comp_editor_dates): updated to get the timezones as well as the times. (comp_editor_free_dates): new function needed to free all the structs. * gui/dialogs/recurrence-page.c (recurrence_page_set_dates): added call to preview_recur() to make sure the preview gets updated. * gui/dialogs/alarm-page.c (alarm_page_fill_widgets): free the CompEditorPageDates struct after use. * gui/tag-calendar.c (tag_calendar_by_comp): added 'comp_is_on_server' argument. If FALSE, we try to use builtin timezones first. This is needed for the recurrence page of the event editor, because the timezones may not have been added to the server yet. This and the changes to the notification stuff should fix bug #5034. * gui/gnome-cal.c (dn_query_obj_updated_cb): call above tag_calendar_by_comp() with TRUE since the events will be on the server in this case. * gui/e-day-view-layout.c: * gui/e-day-view.c: made sure an event always takes up at least one row, even when the start & end times are the same. Fixes bug #5944. I don't know if we should try to also handle events with the end time before the start time. * gui/e-week-view.c (e_week_view_style_set): check that the small font is actually smaller than the normal font. If it isn't, don't use it. Hopefully fixes bug #6876. (e_week_view_on_new_appointment): if only one day is selected, then we set the initial time of the event to 1/2-hour from the start of the working day, to differentiate 'New Appointment' from 'New All Day Event'. Fixes bug #8892. * gui/e-day-view.c (e_day_view_on_new_appointment): do the same as the above. svn path=/trunk/; revision=13186
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r--calendar/gui/dialogs/alarm-page.c1
-rw-r--r--calendar/gui/dialogs/comp-editor-page.h6
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c70
-rw-r--r--calendar/gui/dialogs/comp-editor-util.h2
-rw-r--r--calendar/gui/dialogs/comp-editor.c1
-rw-r--r--calendar/gui/dialogs/event-page.c188
-rw-r--r--calendar/gui/dialogs/recurrence-page.c28
-rw-r--r--calendar/gui/dialogs/task-page.c21
8 files changed, 199 insertions, 118 deletions
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index 811760eb6f..649a86f025 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -506,6 +506,7 @@ alarm_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Dates */
comp_editor_dates (&dates, comp);
alarm_page_set_dates (page, &dates);
+ comp_editor_free_dates (&dates);
/* List */
if (!cal_component_has_alarms (comp))
diff --git a/calendar/gui/dialogs/comp-editor-page.h b/calendar/gui/dialogs/comp-editor-page.h
index 6565d9888e..af8fe1f389 100644
--- a/calendar/gui/dialogs/comp-editor-page.h
+++ b/calendar/gui/dialogs/comp-editor-page.h
@@ -39,9 +39,9 @@ BEGIN_GNOME_DECLS
#define IS_COMP_EDITOR_PAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), TYPE_COMP_EDITOR_PAGE))
typedef struct {
- struct icaltimetype *start;
- struct icaltimetype *end;
- struct icaltimetype *due;
+ CalComponentDateTime *start;
+ CalComponentDateTime *end;
+ CalComponentDateTime *due;
struct icaltimetype *complete;
} CompEditorPageDates;
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 375d51918f..5d10942a5e 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -46,20 +46,13 @@
* @comp: The component to extract the dates from
*
* Extracts the dates from the calendar component into the
- * CompEditorPageDates structure. Note that it returns pointers to static
- * structs, so these will be overwritten in the next call.
+ * CompEditorPageDates structure. Call comp_editor_free_dates() to free the
+ * results.
**/
void
comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
{
- static struct icaltimetype start;
- static struct icaltimetype end;
- static struct icaltimetype due;
- static struct icaltimetype complete;
-
CalComponentDateTime dt;
- struct icaltimetype *comp_complete;
-
dates->start = NULL;
dates->end = NULL;
@@ -68,33 +61,46 @@ comp_editor_dates (CompEditorPageDates *dates, CalComponent *comp)
cal_component_get_dtstart (comp, &dt);
if (dt.value) {
- start = *dt.value;
- dates->start = &start;
+ dates->start = g_new (CalComponentDateTime, 1);
+ *dates->start = dt;
}
- cal_component_free_datetime (&dt);
cal_component_get_dtend (comp, &dt);
if (dt.value) {
- end = *dt.value;
- dates->end = &end;
+ dates->end = g_new (CalComponentDateTime, 1);
+ *dates->end = dt;
}
- cal_component_free_datetime (&dt);
cal_component_get_due (comp, &dt);
if (dt.value) {
- due = *dt.value;
- dates->due = &due;
+ dates->due = g_new (CalComponentDateTime, 1);
+ *dates->due = dt;
}
- cal_component_free_datetime (&dt);
- cal_component_get_completed (comp, &comp_complete);
- if (comp_complete) {
- complete = *comp_complete;
- dates->complete = &complete;
- cal_component_free_icaltimetype (comp_complete);
- }
+ cal_component_get_completed (comp, &dates->complete);
}
+
+/* This frees the dates in the CompEditorPageDates struct. But it doesn't free
+ * the struct (as that is usually static).
+ */
+void
+comp_editor_free_dates (CompEditorPageDates *dates)
+{
+ if (dates->start)
+ cal_component_free_datetime (dates->start);
+
+ if (dates->end)
+ cal_component_free_datetime (dates->end);
+
+ if (dates->due)
+ cal_component_free_datetime (dates->due);
+
+ if (dates->complete)
+ cal_component_free_icaltimetype (dates->complete);
+}
+
+
static void
write_label_piece (struct icaltimetype *tt, char *buffer, int size,
char *stext, char *etext)
@@ -143,20 +149,22 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label)
buffer[0] = '\0';
- if (dates->start && !icaltime_is_null_time (*dates->start))
+ if (dates->start && !icaltime_is_null_time (*dates->start->value))
start_set = TRUE;
- if (dates->end && !icaltime_is_null_time (*dates->end))
+ if (dates->end && !icaltime_is_null_time (*dates->end->value))
end_set = TRUE;
if (dates->complete && !icaltime_is_null_time (*dates->complete))
complete_set = TRUE;
- if (dates->due && !icaltime_is_null_time (*dates->due))
+ if (dates->due && !icaltime_is_null_time (*dates->due->value))
due_set = TRUE;
if (start_set)
- write_label_piece (dates->start, buffer, 1024, NULL, NULL);
+ write_label_piece (dates->start->value, buffer, 1024,
+ NULL, NULL);
if (start_set && end_set)
- write_label_piece (dates->end, buffer, 1024, _(" to "), NULL);
+ write_label_piece (dates->end->value, buffer, 1024,
+ _(" to "), NULL);
if (complete_set) {
if (start_set)
@@ -167,9 +175,9 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label)
if (due_set && dates->complete == NULL) {
if (start_set)
- write_label_piece (dates->due, buffer, 1024, _(" (Due "), ")");
+ write_label_piece (dates->due->value, buffer, 1024, _(" (Due "), ")");
else
- write_label_piece (dates->due, buffer, 1024, _("Due "), NULL);
+ write_label_piece (dates->due->value, buffer, 1024, _("Due "), NULL);
}
gtk_label_set_text (GTK_LABEL (label), buffer);
diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h
index 23f3937a9a..37c1c0d5f7 100644
--- a/calendar/gui/dialogs/comp-editor-util.h
+++ b/calendar/gui/dialogs/comp-editor-util.h
@@ -28,6 +28,8 @@
#include "comp-editor-page.h"
void comp_editor_dates (CompEditorPageDates *date, CalComponent *comp);
+void comp_editor_free_dates (CompEditorPageDates *dates);
+
void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label);
GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time,
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index dcec6bb251..593544c11f 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -116,7 +116,6 @@ static EPixmap pixmaps [] =
E_PIXMAP ("/Toolbar/FileSaveAndClose", "buttons/save-24.png"),
E_PIXMAP ("/Toolbar/FilePrint", "buttons/print.png"),
- E_PIXMAP ("/Toolbar/FilePrintPreview", "buttons/print-preview-24.png"),
E_PIXMAP ("/Toolbar/FileDelete", "buttons/delete-message.png"),
E_PIXMAP_END
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 74fdecb6ee..8a1415b9d2 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -561,7 +561,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
char *cat, *str;
CalComponentClassification classif;
CalComponentTransparency transparency;
- icaltimezone *zone = NULL;
+ icaltimezone *start_zone, *end_zone;
epage = EVENT_PAGE (page);
priv = epage->priv;
@@ -619,13 +619,13 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
all_day_event = e_dialog_toggle_get (priv->all_day_event);
if (all_day_event) {
- char *location;
-
- location = calendar_config_get_timezone ();
- zone = icaltimezone_get_builtin_timezone (location);
+ char *location = calendar_config_get_timezone ();
+ start_zone = end_zone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
}
-
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
&icaltime.year,
&icaltime.month,
@@ -634,10 +634,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
&icaltime.hour,
&icaltime.minute);
g_assert (date_set);
- if (!all_day_event)
- zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
- if (zone)
- date.tzid = icaltimezone_get_tzid (zone);
+ date.tzid = icaltimezone_get_tzid (start_zone);
cal_component_set_dtstart (comp, &date);
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->end_time),
@@ -656,10 +653,7 @@ event_page_fill_component (CompEditorPage *page, CalComponent *comp)
icaltime_adjust (&icaltime, 1, 0, 0, 0);
}
- if (!all_day_event)
- zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
- if (zone)
- date.tzid = icaltimezone_get_tzid (zone);
+ date.tzid = icaltimezone_get_tzid (end_zone);
cal_component_set_dtend (comp, &date);
@@ -787,27 +781,79 @@ summary_changed_cb (GtkEditable *editable, gpointer data)
g_free (summary);
}
-/* Callback used when the start or end date widgets change. We check that the
- * start date < end date and we set the "all day event" button as appropriate.
- */
+
static void
-date_changed_cb (EDateEdit *dedit, gpointer data)
+notify_dates_changed (EventPage *epage, struct icaltimetype *start_tt,
+ struct icaltimetype *end_tt)
{
- EventPage *epage;
EventPagePrivate *priv;
CompEditorPageDates dates;
+ CalComponentDateTime start_dt, end_dt;
+ gboolean all_day_event;
+ icaltimezone *start_zone, *end_zone;
+
+ priv = epage->priv;
+
+ all_day_event = e_dialog_toggle_get (priv->all_day_event);
+
+ start_dt.value = start_tt;
+ end_dt.value = end_tt;
+
+ if (all_day_event) {
+ /* FIXME: When we switch to using DATE values we'll set the
+ TZIDs to NULL. */
+ char *location;
+
+ location = calendar_config_get_timezone ();
+ start_zone = end_zone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
+ }
+
+ start_dt.tzid = start_zone ? icaltimezone_get_tzid (start_zone) : NULL;
+ end_dt.tzid = end_zone ? icaltimezone_get_tzid (end_zone) : NULL;
+
+ dates.start = &start_dt;
+ dates.end = &end_dt;
+
+ dates.due = NULL;
+ dates.complete = NULL;
+ comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage),
+ &dates);
+}
+
+
+/*
+ * This is called whenever the start or end dates or timezones is changed.
+ * It makes sure that the start date < end date, and currently sets the
+ * "all day event" checkbox as appropriate (but won't when we use DATE values).
+ * It also emits the notification signals so the other event editor pages
+ * update their labels etc.
+ *
+ * If adjust_end_time is TRUE, if the start time < end time it will adjust
+ * the end time. If FALSE it will adjust the start time. If the user sets the
+ * start or end time, the other time is adjusted to make it valid.
+ */
+static void
+times_updated (EventPage *epage, gboolean adjust_end_time)
+{
+ EventPagePrivate *priv;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype end_tt = icaltime_null_time();
+ struct icaltimetype end_tt_copy;
int cmp;
- gboolean date_set;
+ gboolean date_set, all_day_event;
+ icaltimezone *start_zone, *end_zone;
- epage = EVENT_PAGE (data);
priv = epage->priv;
if (priv->updating)
return;
- /* Ensure that start < end */
+ /* Fetch the start and end times and timezones from the widgets. */
+ all_day_event = e_dialog_toggle_get (priv->all_day_event);
+
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_time),
&start_tt.year,
&start_tt.month,
@@ -826,25 +872,34 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
&end_tt.minute);
g_assert (date_set);
- /* FIXME: TIMEZONES. */
- cmp = icaltime_compare (start_tt, end_tt);
- if (cmp >= 0) {
- if (cmp == 0 && start_tt.hour == 0
- && start_tt.minute == 0
- && start_tt.second == 0) {
- /* If the start and end times are the same, but both
- * are on day boundaries, then that is OK since it
- * means we have an all-day event lasting 1 day. So
- * we do nothing here.
- */
- } else if (GTK_WIDGET (dedit) == priv->start_time) {
- /* Modify the end time, to be the start + 1 hour. */
-
- /* FIXME: TIMEZONES - Probably want to leave the
- timezone as it is, so we need to convert the time.*/
+ if (all_day_event) {
+ char *location = calendar_config_get_timezone ();
+ start_zone = end_zone = icaltimezone_get_builtin_timezone (location);
+ } else {
+ start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
+ }
+
+ /* Convert the end time to the same timezone as the start time. */
+ end_tt_copy = end_tt;
+ icaltimezone_convert_time (&end_tt_copy, end_zone, start_zone);
+
+ /* Now check if the start time is after the end time. If it is, we need
+ to modify one of the times. */
+ cmp = icaltime_compare (start_tt, end_tt_copy);
+ if (cmp > 0) {
+ if (adjust_end_time) {
+ /* Modify the end time, to be the start + 1 hour,
+ or the same as the start time for all-day events.
+ We copy the start time, add on one hour, then
+ convert it to the original end timezone. */
end_tt = start_tt;
- icaltime_adjust (&end_tt, 0, 1, 0, 0);
+ if (!all_day_event) {
+ icaltime_adjust (&end_tt, 0, 1, 0, 0);
+ icaltimezone_convert_time (&end_tt, start_zone,
+ end_zone);
+ }
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->end_time), epage);
@@ -857,14 +912,17 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
end_tt.minute);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->end_time), epage);
- } else if (GTK_WIDGET (dedit) == priv->end_time) {
- /* Modify the start time, to be the end - 1 hour. */
-
- /* FIXME: TIMEZONES - Probably want to leave the
- timezone as it is, so we need to convert the time.*/
-
+ } else {
+ /* Modify the start time, to be the end - 1 hour,
+ or the same as the start time for all-day events.
+ We copy the end time, subtract one hour, then
+ convert it to the original start timezone. */
start_tt = end_tt;
- icaltime_adjust (&start_tt, 0, -1, 0, 0);
+ if (!all_day_event) {
+ icaltime_adjust (&start_tt, 0, -1, 0, 0);
+ icaltimezone_convert_time (&start_tt, end_zone,
+ start_zone);
+ }
gtk_signal_handler_block_by_data (GTK_OBJECT (priv->start_time), epage);
@@ -877,22 +935,30 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
start_tt.minute);
gtk_signal_handler_unblock_by_data (GTK_OBJECT (priv->start_time), epage);
- } else
- g_assert_not_reached ();
+ }
}
/* Set the "all day event" button as appropriate */
check_all_day (epage);
/* Notify upstream */
- dates.start = &start_tt;
- dates.end = &end_tt;
- dates.due = NULL;
- dates.complete = NULL;
- comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage),
- &dates);
+ notify_dates_changed (epage, &start_tt, &end_tt);
}
+/* Callback used when the start or end date widgets change. We check that the
+ * start date < end date and we set the "all day event" button as appropriate.
+ */
+static void
+date_changed_cb (GtkWidget *dedit, gpointer data)
+{
+ EventPage *epage;
+
+ epage = EVENT_PAGE (data);
+
+ times_updated (epage, dedit == epage->priv->start_time);
+}
+
+
/* Callback used when the start timezone is changed. If sync_timezones is set,
* we set the end timezone to the same value. It also updates the start time
* labels on the other notebook pages.
@@ -909,8 +975,12 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data)
if (priv->sync_timezones) {
zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ priv->updating = TRUE;
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone);
+ priv->updating = FALSE;
}
+
+ times_updated (epage, TRUE);
}
@@ -931,6 +1001,8 @@ end_timezone_changed_cb (GtkWidget *widget, gpointer data)
end_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->end_timezone));
priv->sync_timezones = (start_zone == end_zone) ? TRUE : FALSE;
+
+ times_updated (epage, TRUE);
}
/* Callback: all day event button toggled.
@@ -944,7 +1016,6 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data)
EventPage *epage;
EventPagePrivate *priv;
gboolean all_day;
- CompEditorPageDates dates;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype end_tt = icaltime_null_time();
gboolean date_set;
@@ -1061,12 +1132,7 @@ all_day_event_toggled_cb (GtkWidget *toggle, gpointer data)
}
/* Notify upstream */
- dates.start = &start_tt;
- dates.end = &end_tt;
- dates.due = NULL;
- dates.complete = NULL;
- comp_editor_page_notify_dates_changed (COMP_EDITOR_PAGE (epage),
- &dates);
+ notify_dates_changed (epage, &start_tt, &end_tt);
}
/* Callback used when the contacts button is clicked; we must bring up the
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 7a1982da17..10946805ed 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -886,7 +886,7 @@ preview_recur (RecurrencePage *rpage)
fill_component (rpage, comp);
tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp,
- COMP_EDITOR_PAGE (rpage)->client, TRUE);
+ COMP_EDITOR_PAGE (rpage)->client, TRUE, FALSE);
gtk_object_unref (GTK_OBJECT (comp));
}
@@ -1405,6 +1405,7 @@ recurrence_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Dates */
comp_editor_dates (&dates, comp);
recurrence_page_set_dates (page, &dates);
+ comp_editor_free_dates (&dates);
/* Exceptions */
fill_exception_widgets (rpage, comp);
@@ -1741,7 +1742,7 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
{
RecurrencePage *rpage;
RecurrencePagePrivate *priv;
- CalComponentDateTime dt, old_dt;
+ CalComponentDateTime dt;
struct icaltimetype icaltime;
guint8 mask;
@@ -1758,27 +1759,15 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
dt.value = &icaltime;
if (dates->start) {
- icaltime = *dates->start;
-
- /* Copy the TZID from the old property.
- FIXME: Should get notified when the TZID changes.*/
- cal_component_get_dtstart (priv->comp, &old_dt);
- dt.tzid = old_dt.tzid;
-
+ icaltime = *dates->start->value;
+ dt.tzid = dates->start->tzid;
cal_component_set_dtstart (priv->comp, &dt);
- cal_component_free_datetime (&old_dt);
}
if (dates->end) {
- icaltime = *dates->end;
-
- /* Copy the TZID from the old property.
- FIXME: Should get notified when the TZID changes.*/
- cal_component_get_dtend (priv->comp, &old_dt);
- dt.tzid = old_dt.tzid;
-
+ icaltime = *dates->end->value;
+ dt.tzid = dates->end->tzid;
cal_component_set_dtend (priv->comp, &dt);
- cal_component_free_datetime (&old_dt);
}
/* Update the weekday picker if necessary */
@@ -1795,6 +1784,9 @@ recurrence_page_set_dates (CompEditorPage *page, CompEditorPageDates *dates)
weekday_picker_set_blocked_days (WEEKDAY_PICKER (priv->weekday_picker),
priv->weekday_blocked_day_mask);
}
+
+ /* Make sure the preview gets updated. */
+ preview_recur (rpage);
}
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 048adf31ad..2c3f8d18ec 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -676,6 +676,7 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
TaskPagePrivate *priv;
CompEditorPageDates dates;
gboolean date_set;
+ CalComponentDateTime start_dt, due_dt;
struct icaltimetype start_tt = icaltime_null_time();
struct icaltimetype due_tt = icaltime_null_time();
@@ -692,8 +693,13 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_date),
&start_tt.hour,
&start_tt.minute);
- if (!date_set)
+ if (date_set) {
+ icaltimezone *zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
+ start_dt.tzid = icaltimezone_get_tzid (zone);
+ } else {
start_tt = icaltime_null_time ();
+ start_dt.tzid = NULL;
+ }
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->due_date),
&due_tt.year,
@@ -702,12 +708,19 @@ date_changed_cb (EDateEdit *dedit, gpointer data)
e_date_edit_get_time_of_day (E_DATE_EDIT (priv->due_date),
&due_tt.hour,
&due_tt.minute);
- if (!date_set)
+ if (date_set) {
+ icaltimezone *zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone));
+ due_dt.tzid = icaltimezone_get_tzid (zone);
+ } else {
due_tt = icaltime_null_time ();
+ due_dt.tzid = NULL;
+ }
- dates.start = &start_tt;
+ start_dt.value = &start_tt;
+ dates.start = &start_dt;
dates.end = NULL;
- dates.due = &due_tt;
+ due_dt.value = &due_tt;
+ dates.due = &due_dt;
dates.complete = NULL;
/* Notify upstream */