diff options
Diffstat (limited to 'addressbook/importers/evolution-vcard-importer.c')
-rw-r--r-- | addressbook/importers/evolution-vcard-importer.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/addressbook/importers/evolution-vcard-importer.c b/addressbook/importers/evolution-vcard-importer.c index 5719dce51c..eedacef874 100644 --- a/addressbook/importers/evolution-vcard-importer.c +++ b/addressbook/importers/evolution-vcard-importer.c @@ -60,6 +60,30 @@ typedef struct { gboolean ready; } VCardImporter; +static void +add_to_notes (EContact *contact, EContactField field) +{ + const gchar *old_text; + const gchar *field_text; + gchar *new_text; + + old_text = e_contact_get_const (contact, E_CONTACT_NOTE); + if (old_text && strstr (old_text, e_contact_pretty_name (field))) + return; + + field_text = e_contact_get_const (contact, field); + if (!field_text || !*field_text) + return; + + new_text = g_strdup_printf ("%s%s%s: %s", + old_text ? old_text : "", + old_text && *old_text && + *(old_text + strlen (old_text) - 1) != '\n' ? "\n" : "", + e_contact_pretty_name (field), field_text); + e_contact_set (contact, E_CONTACT_NOTE, new_text); + g_free (new_text); +} + /* EvolutionImporter methods */ static void process_item_fn (EvolutionImporter *importer, @@ -125,6 +149,11 @@ process_item_fn (EvolutionImporter *importer, } e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs); + /* Work around the fact that these fields no longer show up in the UI */ + add_to_notes (contact, E_CONTACT_OFFICE); + add_to_notes (contact, E_CONTACT_SPOUSE); + add_to_notes (contact, E_CONTACT_BLOG_URL); + /* FIXME Error checking */ e_book_add_contact (gci->book, contact, NULL); |