aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-model.c
diff options
context:
space:
mode:
authorDamon Chaplin <damon@ximian.com>2001-10-30 20:59:28 +0800
committerDamon Chaplin <damon@src.gnome.org>2001-10-30 20:59:28 +0800
commit6cc1ca709616dafc050dc29e10f26686ac3e4caa (patch)
treee593984309d8f2ff05b729fd0fc1fb789b473ee3 /calendar/gui/calendar-model.c
parent6d9d0b02aab0c899742a43002116bc0caf05324f (diff)
downloadgsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.tar
gsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.tar.gz
gsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.tar.bz2
gsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.tar.lz
gsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.tar.xz
gsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.tar.zst
gsoc2013-evolution-6cc1ca709616dafc050dc29e10f26686ac3e4caa.zip
updated code to handle DATE values.
2001-10-30 Damon Chaplin <damon@ximian.com> * gui/dialogs/schedule-page.c: * gui/dialogs/event-page.c: * gui/dialogs/comp-editor-util.c: updated code to handle DATE values. * gui/gnome-cal.c (gnome_calendar_new_appointment_for): * gui/e-day-view.c (e_day_view_key_press): updated DATE code. * gui/e-cell-date-edit-text.c: * gui/calendar-model.c: updated to support DATE values. * cal-util/cal-recur.c (cal_recur_generate_instances_of_rule): updated to use DATE values in same way as Outlook - i.e. the DTEND date is not included entirely. Though I did make it so that if the DTSTART and DTEND used the same DATE value, it includes the entire day. So 1-day events should be the same. Long All-Day events will be 1 day shorter. * cal-util/cal-component.c (cal_component_get_start_plus_duration): don't subtract a day from the end date. * gui/tasks-control.c: updated the EPixmap paths for Cut/Copy etc. Removed Print & Print Preview paths, since we don't have menu commands for these any more. svn path=/trunk/; revision=14456
Diffstat (limited to 'calendar/gui/calendar-model.c')
-rw-r--r--calendar/gui/calendar-model.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index 62d04a0d70..3d62857b82 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -495,6 +495,13 @@ get_date_edit_value (CalendarModel *model, CalComponent *comp,
CalClientGetStatus status;
icaltimezone *zone;
+ /* For a DTEND with a DATE value, we subtract 1 from
+ the day to display it. */
+ if (col == CAL_COMPONENT_FIELD_DTEND
+ && dt.value->is_date) {
+ icaltime_adjust (dt.value, -1, 0, 0, 0);
+ }
+
*value = g_new (ECellDateEditValue, 1);
(*value)->tt = *dt.value;
@@ -1008,7 +1015,8 @@ set_completed (CalendarModel *model, CalComponent *comp, const void *value)
/* Sets a CalComponentDateTime value */
static void
set_datetime (CalendarModel *model, CalComponent *comp, const void *value,
- void (* set_func) (CalComponent *comp, CalComponentDateTime *dt))
+ void (* set_func) (CalComponent *comp, CalComponentDateTime *dt),
+ gboolean is_dtend)
{
ECellDateEditValue *dv = (ECellDateEditValue*) value;
@@ -1020,6 +1028,11 @@ set_datetime (CalendarModel *model, CalComponent *comp, const void *value,
dt.value = &dv->tt;
dt.tzid = icaltimezone_get_tzid (dv->zone);
+ /* For a DTEND with a DATE value, we add 1 day to it. */
+ if (is_dtend && dt.value->is_date) {
+ icaltime_adjust (dt.value, 1, 0, 0, 0);
+ }
+
(* set_func) (comp, &dt);
}
}
@@ -1242,16 +1255,19 @@ calendar_model_set_value_at (ETableModel *etm, int col, int row, const void *val
case CAL_COMPONENT_FIELD_DTEND:
/* FIXME: Need to reset dtstart if dtend happens before it */
- set_datetime (model, comp, value, cal_component_set_dtend);
+ set_datetime (model, comp, value, cal_component_set_dtend,
+ TRUE);
break;
case CAL_COMPONENT_FIELD_DTSTART:
/* FIXME: Need to reset dtend if dtstart happens after it */
- set_datetime (model, comp, value, cal_component_set_dtstart);
+ set_datetime (model, comp, value, cal_component_set_dtstart,
+ FALSE);
break;
case CAL_COMPONENT_FIELD_DUE:
- set_datetime (model, comp, value, cal_component_set_due);
+ set_datetime (model, comp, value, cal_component_set_due,
+ FALSE);
break;
case CAL_COMPONENT_FIELD_GEO:
@@ -1362,10 +1378,10 @@ calendar_model_append_row (ETableModel *etm, ETableModel *source, gint row)
set_classification (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_CLASSIFICATION, row));
set_completed (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_COMPLETED, row));
/* FIXME: Need to reset dtstart if dtend happens before it */
- set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTEND, row), cal_component_set_dtend);
+ set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTEND, row), cal_component_set_dtend, TRUE);
/* FIXME: Need to reset dtend if dtstart happens after it */
- set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTSTART, row), cal_component_set_dtstart);
- set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DUE, row), cal_component_set_due);
+ set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DTSTART, row), cal_component_set_dtstart, FALSE);
+ set_datetime (model, comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_DUE, row), cal_component_set_due, FALSE);
set_geo (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_GEO, row));
set_percent (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_PERCENT, row));
set_priority (comp, e_table_model_value_at(source, CAL_COMPONENT_FIELD_PRIORITY, row));