[evolution-data-server] Contacts calendar - consider also other than only file-as field



commit 9341f357b104e79d70981954fe0380814011ad32
Author: Milan Crha <mcrha redhat com>
Date:   Tue Dec 13 13:23:25 2011 +0100

    Contacts calendar - consider also other than only file-as field

 .../backends/contacts/e-cal-backend-contacts.c     |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c
index dff1004..67b838f 100644
--- a/calendar/backends/contacts/e-cal-backend-contacts.c
+++ b/calendar/backends/contacts/e-cal-backend-contacts.c
@@ -132,7 +132,12 @@ book_record_new (ECalBackendContacts *cbc,
 	}
 
 	query = e_book_query_andv (
-		e_book_query_field_exists (E_CONTACT_FILE_AS),
+		e_book_query_orv (
+			e_book_query_field_exists (E_CONTACT_FILE_AS),
+			e_book_query_field_exists (E_CONTACT_FULL_NAME),
+			e_book_query_field_exists (E_CONTACT_GIVEN_NAME),
+			e_book_query_field_exists (E_CONTACT_NICKNAME),
+			NULL),
 		e_book_query_orv (
 			e_book_query_field_exists (E_CONTACT_BIRTH_DATE),
 			e_book_query_field_exists (E_CONTACT_ANNIVERSARY),
@@ -796,6 +801,12 @@ create_birthday (ECalBackendContacts *cbc,
 
 	cdate = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
 	name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
+	if (!name || !*name)
+		name = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
+	if (!name || !*name)
+		name = e_contact_get_const (contact, E_CONTACT_NICKNAME);
+	if (!name)
+		name = "";
 
 	uid = g_strdup_printf ("%s%s", (gchar *) e_contact_get_const (contact, E_CONTACT_UID), BIRTHDAY_UID_EXT);
 	summary = g_strdup_printf (_("Birthday: %s"), name);
@@ -821,6 +832,12 @@ create_anniversary (ECalBackendContacts *cbc,
 
 	cdate = e_contact_get (contact, E_CONTACT_ANNIVERSARY);
 	name = e_contact_get_const (contact, E_CONTACT_FILE_AS);
+	if (!name || !*name)
+		name = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
+	if (!name || !*name)
+		name = e_contact_get_const (contact, E_CONTACT_NICKNAME);
+	if (!name)
+		name = "";
 
 	uid = g_strdup_printf ("%s%s", (gchar *) e_contact_get_const (contact, E_CONTACT_UID), ANNIVERSARY_UID_EXT);
 	summary = g_strdup_printf (_("Anniversary: %s"), name);



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