[evolution] Upstreamed patch from MeeGo Bugzilla: 22945



commit e749abc966ea945d1aa34e6b975d3f2612d3536e
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Thu Dec 1 10:02:16 2011 +0200

    Upstreamed patch from MeeGo Bugzilla: 22945
    
    Check for birthdays which can't be set to future dates.

 addressbook/gui/contact-editor/e-contact-editor.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 9ad6fc0..6f4597a 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -3732,6 +3732,7 @@ e_contact_editor_is_valid (EABEditor *editor)
 	gboolean validation_error = FALSE;
 	GSList *iter;
 	GString *errmsg = g_string_new (_("The contact data is invalid:\n\n"));
+	time_t bday, now = time (NULL);
 
 	widget = e_builder_get_widget (ce->builder, "dateedit-birthday");
 	if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) {
@@ -3740,6 +3741,13 @@ e_contact_editor_is_valid (EABEditor *editor)
 			e_contact_pretty_name (E_CONTACT_BIRTH_DATE));
 		validation_error = TRUE;
 	}
+	/* If valid, see if the birthday is a future date */
+	bday = e_date_edit_get_time (E_DATE_EDIT (widget));
+	if (bday > now) {
+		g_string_append_printf (errmsg, _("'%s' cannot be a future date"),
+					e_contact_pretty_name (E_CONTACT_BIRTH_DATE));
+		validation_error = TRUE;
+	}
 
 	widget = e_builder_get_widget (ce->builder, "dateedit-anniversary");
 	if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]