diff options
author | Harry Lu <haip@src.gnome.org> | 2004-02-09 13:55:29 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2004-02-09 13:55:29 +0800 |
commit | c4b9eb546503c11711704d88f7ffd311e6d95c74 (patch) | |
tree | e69c35b8ae0adc6ce6583ed234e4e543383d05f0 /calendar | |
parent | 803f1baab087f0f17cbcd8f8c03eae9e4cd19528 (diff) | |
download | gsoc2013-evolution-c4b9eb546503c11711704d88f7ffd311e6d95c74.tar.gz gsoc2013-evolution-c4b9eb546503c11711704d88f7ffd311e6d95c74.tar.zst gsoc2013-evolution-c4b9eb546503c11711704d88f7ffd311e6d95c74.zip |
refuse to update the task info if due date is before start date.
* gui/e-cal-model-tasks.c: (ecmt_set_value_at): refuse to update
the task info if due date is before start date.
svn path=/trunk/; revision=24676
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 5 | ||||
-rw-r--r-- | calendar/gui/e-cal-model-tasks.c | 42 |
2 files changed, 43 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index fdeb173ac3..7a5e44bb8f 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2004-02-09 Kidd Wang <kidd.wang@sun.com> + + * gui/e-cal-model-tasks.c: (ecmt_set_value_at): refuse to update + the task info if due date is before start date. + 2004-02-05 JP Rosevear <jpr@ximian.com> * Convert the calendar_config_get_timezone and diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c index 99c337905f..78ea87cf4d 100644 --- a/calendar/gui/e-cal-model-tasks.c +++ b/calendar/gui/e-cal-model-tasks.c @@ -710,6 +710,9 @@ ecmt_set_value_at (ETableModel *etm, int col, int row, const void *value) ECalModelTasksPrivate *priv; ECalModelComponent *comp_data; ECalModelTasks *model = (ECalModelTasks *) etm; + icaltimetype start_tt, due_tt; + ECellDateEditValue *dv; + GtkWidget *dialog; g_return_if_fail (E_IS_CAL_MODEL_TASKS (model)); @@ -718,15 +721,32 @@ ecmt_set_value_at (ETableModel *etm, int col, int row, const void *value) g_return_if_fail (col >= 0 && col < E_CAL_MODEL_TASKS_FIELD_LAST); g_return_if_fail (row >= 0 && row < e_table_model_row_count (etm)); + comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row); + if (!comp_data) + return; + if (col < E_CAL_MODEL_FIELD_LAST) { + if (col == E_CAL_MODEL_FIELD_DTSTART) { + dv = (ECellDateEditValue *) value; + start_tt = dv->tt; + due_tt = icalcomponent_get_due (comp_data->icalcomp); + + if (icaltime_compare (start_tt, due_tt) > 0) { + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Due date is before start date!")); + g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); + gtk_widget_show (dialog); + + return; + } + } + E_TABLE_MODEL_CLASS (parent_class)->set_value_at (etm, col, row, value); return; } - comp_data = e_cal_model_get_component_at (E_CAL_MODEL (model), row); - if (!comp_data) - return; - switch (col) { case E_CAL_MODEL_TASKS_FIELD_COMPLETED : set_completed (model, comp_data, value); @@ -735,6 +755,20 @@ ecmt_set_value_at (ETableModel *etm, int col, int row, const void *value) set_complete (comp_data, value); break; case E_CAL_MODEL_TASKS_FIELD_DUE : + dv = (ECellDateEditValue *) value; + start_tt = icalcomponent_get_dtstart (comp_data->icalcomp); + due_tt = dv->tt; + + if (icaltime_compare (start_tt, due_tt) > 0) { + dialog = gtk_message_dialog_new (NULL, 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Due date is before start date!")); + g_signal_connect (dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); + gtk_widget_show (dialog); + + return; + } set_due (comp_data, value); break; case E_CAL_MODEL_TASKS_FIELD_GEO : |