Fixes #46769
2003-07-29 Harry Lu <harry.lu@sun.com> Fixes #46769 * gui/dialogs/task-page.c: (task_page_fill_component): Popup a error dialog if due date time is before start datetime when saving a task. svn path=/trunk/; revision=22005
This commit is contained in:
@ -1,3 +1,11 @@
|
|||||||
|
2003-07-29 Harry Lu <harry.lu@sun.com>
|
||||||
|
|
||||||
|
Fixes #46769
|
||||||
|
|
||||||
|
* gui/dialogs/task-page.c: (task_page_fill_component): Popup a
|
||||||
|
error dialog if due date time is before start datetime when saving
|
||||||
|
a task.
|
||||||
|
|
||||||
2003-07-29 Bolian Yin <bolian.yin@sun.com>
|
2003-07-29 Bolian Yin <bolian.yin@sun.com>
|
||||||
|
|
||||||
Fixes #46847
|
Fixes #46847
|
||||||
|
@ -416,12 +416,14 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
|
|||||||
TaskPage *tpage;
|
TaskPage *tpage;
|
||||||
TaskPagePrivate *priv;
|
TaskPagePrivate *priv;
|
||||||
CalComponentDateTime date;
|
CalComponentDateTime date;
|
||||||
struct icaltimetype icaltime;
|
struct icaltimetype start_tt, due_tt;
|
||||||
char *cat, *str;
|
char *cat, *str;
|
||||||
gboolean date_set, time_set;
|
gboolean start_date_set, due_date_set, time_set;
|
||||||
icaltimezone *zone;
|
|
||||||
GtkTextBuffer *text_buffer;
|
GtkTextBuffer *text_buffer;
|
||||||
GtkTextIter text_iter_start, text_iter_end;
|
GtkTextIter text_iter_start, text_iter_end;
|
||||||
|
struct icaltimetype *due_tt2;
|
||||||
|
icaltimezone *start_zone = NULL;
|
||||||
|
icaltimezone *due_zone = NULL;
|
||||||
|
|
||||||
tpage = TASK_PAGE (page);
|
tpage = TASK_PAGE (page);
|
||||||
priv = tpage->priv;
|
priv = tpage->priv;
|
||||||
@ -469,9 +471,9 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
|
|||||||
|
|
||||||
/* Dates */
|
/* Dates */
|
||||||
|
|
||||||
icaltime = icaltime_null_time ();
|
due_tt = icaltime_null_time ();
|
||||||
|
|
||||||
date.value = &icaltime;
|
date.value = &due_tt;
|
||||||
date.tzid = NULL;
|
date.tzid = NULL;
|
||||||
|
|
||||||
/* Due Date. */
|
/* Due Date. */
|
||||||
@ -481,19 +483,19 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->due_date),
|
due_date_set = e_date_edit_get_date (E_DATE_EDIT (priv->due_date),
|
||||||
&icaltime.year,
|
&due_tt.year,
|
||||||
&icaltime.month,
|
&due_tt.month,
|
||||||
&icaltime.day);
|
&due_tt.day);
|
||||||
time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->due_date),
|
time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->due_date),
|
||||||
&icaltime.hour,
|
&due_tt.hour,
|
||||||
&icaltime.minute);
|
&due_tt.minute);
|
||||||
if (date_set) {
|
if (due_date_set) {
|
||||||
if (time_set) {
|
if (time_set) {
|
||||||
zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone));
|
due_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->due_timezone));
|
||||||
date.tzid = icaltimezone_get_tzid (zone);
|
date.tzid = icaltimezone_get_tzid (due_zone);
|
||||||
} else {
|
} else {
|
||||||
icaltime.is_date = TRUE;
|
due_tt.is_date = TRUE;
|
||||||
date.tzid = NULL;
|
date.tzid = NULL;
|
||||||
}
|
}
|
||||||
cal_component_set_due (comp, &date);
|
cal_component_set_due (comp, &date);
|
||||||
@ -508,20 +510,21 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
icaltime = icaltime_null_time ();
|
start_tt = icaltime_null_time ();
|
||||||
date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_date),
|
date.value = &start_tt;
|
||||||
&icaltime.year,
|
start_date_set = e_date_edit_get_date (E_DATE_EDIT (priv->start_date),
|
||||||
&icaltime.month,
|
&start_tt.year,
|
||||||
&icaltime.day);
|
&start_tt.month,
|
||||||
|
&start_tt.day);
|
||||||
time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_date),
|
time_set = e_date_edit_get_time_of_day (E_DATE_EDIT (priv->start_date),
|
||||||
&icaltime.hour,
|
&start_tt.hour,
|
||||||
&icaltime.minute);
|
&start_tt.minute);
|
||||||
if (date_set) {
|
if (start_date_set) {
|
||||||
if (time_set) {
|
if (time_set) {
|
||||||
zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
|
start_zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone));
|
||||||
date.tzid = icaltimezone_get_tzid (zone);
|
date.tzid = icaltimezone_get_tzid (start_zone);
|
||||||
} else {
|
} else {
|
||||||
icaltime.is_date = TRUE;
|
start_tt.is_date = TRUE;
|
||||||
date.tzid = NULL;
|
date.tzid = NULL;
|
||||||
}
|
}
|
||||||
cal_component_set_dtstart (comp, &date);
|
cal_component_set_dtstart (comp, &date);
|
||||||
@ -529,6 +532,22 @@ task_page_fill_component (CompEditorPage *page, CalComponent *comp)
|
|||||||
cal_component_set_dtstart (comp, NULL);
|
cal_component_set_dtstart (comp, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check whether due datetime is before start datetime */
|
||||||
|
if (start_date_set && due_date_set) {
|
||||||
|
due_tt2 = g_new (struct icaltimetype, 1);
|
||||||
|
memcpy (due_tt2, &due_tt, sizeof(due_tt));
|
||||||
|
icaltimezone_convert_time (due_tt2, due_zone, start_zone);
|
||||||
|
if (icaltime_compare (start_tt, *due_tt2) > 0) {
|
||||||
|
comp_editor_page_display_validation_error (page,
|
||||||
|
_("Due date is before start date!"),
|
||||||
|
priv->due_date);
|
||||||
|
g_free (due_tt2);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
g_free (due_tt2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Classification. */
|
/* Classification. */
|
||||||
cal_component_set_classification (comp, classification_get (priv->classification_public));
|
cal_component_set_classification (comp, classification_get (priv->classification_public));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user