diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2004-04-24 06:29:05 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-04-24 06:29:05 +0800 |
commit | 80c119231387cb3745117b0df792f2e39e0ffcad (patch) | |
tree | f334c7c6025c2d6a8f37a934e92f4b329c9d61be | |
parent | 34e13572841c231de83ac0d6e0a4ee16486ec476 (diff) | |
download | gsoc2013-evolution-80c119231387cb3745117b0df792f2e39e0ffcad.tar.gz gsoc2013-evolution-80c119231387cb3745117b0df792f2e39e0ffcad.tar.zst gsoc2013-evolution-80c119231387cb3745117b0df792f2e39e0ffcad.zip |
The firt EMAIL item is EMAIL_1, not EMAIL (assuming we want simple
2004-04-23 Jeffrey Stedfast <fejj@ximian.com>
* conduit/address-conduit.c (get_next_mail): The firt EMAIL item
is EMAIL_1, not EMAIL (assuming we want simple strings).
(local_record_from_ecard): Use e_contact_get() for getting the
EContactAddress. Loop from FIRST_ADDRESS_ID up to and *including*
LAST_ADDRESS_ID.
(ecard_from_remote_record): When searching for an address field,
loop from FIRST_ADDRESS_ID up to and *including* LAST_ADDRESS_ID.
(pre_sync): Use e_book_query_any_field_contains() rather than
e_book_query_from_string ("#t") which doesn't work anyway.
2004-04-20 Jeffrey Stedfast <fejj@ximian.com>
* conduit/address-conduit.c (map_name): Updated to use
~/.evolution as the evolution directory rather than ~/evolution.
svn path=/trunk/; revision=25603
-rw-r--r-- | addressbook/ChangeLog | 18 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.c | 81 |
2 files changed, 61 insertions, 38 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 84dab3bf04..3b86e9bfe4 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,20 @@ +2004-04-23 Jeffrey Stedfast <fejj@ximian.com> + + * conduit/address-conduit.c (get_next_mail): The firt EMAIL item + is EMAIL_1, not EMAIL (assuming we want simple strings). + (local_record_from_ecard): Use e_contact_get() for getting the + EContactAddress. Loop from FIRST_ADDRESS_ID up to and *including* + LAST_ADDRESS_ID. + (ecard_from_remote_record): When searching for an address field, + loop from FIRST_ADDRESS_ID up to and *including* LAST_ADDRESS_ID. + (pre_sync): Use e_book_query_any_field_contains() rather than + e_book_query_from_string ("#t") which doesn't work anyway. + +2004-04-20 Jeffrey Stedfast <fejj@ximian.com> + + * conduit/address-conduit.c (map_name): Updated to use + ~/.evolution as the evolution directory rather than ~/evolution. + 2004-04-23 Dan Winship <danw@ximian.com> * gui/component/component-factory.c (factory): Fix the addressbook @@ -159,6 +176,7 @@ * gui/contact-editor/e-contact-editor.c (new_target_cb): addressbook_show_load_error_dialog -> eab_load_error_dialog. +>>>>>>> 1.1665 2004-04-19 Rodney Dawes <dobey@ximian.com> * gui/contact-editor/contact-editor.glade: Set the default image for diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index 5d6530fd85..01a22c690e 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -73,7 +73,7 @@ static EContactField priority [] = { E_CONTACT_PHONE_BUSINESS, E_CONTACT_PHONE_HOME, E_CONTACT_PHONE_BUSINESS_FAX, - E_CONTACT_EMAIL, + E_CONTACT_EMAIL_1, E_CONTACT_PHONE_PAGER, E_CONTACT_PHONE_MOBILE, E_CONTACT_PHONE_BUSINESS_2, @@ -462,8 +462,8 @@ map_name (EAddrConduitContext *ctxt) { char *filename = NULL; - filename = g_strdup_printf ("%s/evolution/local/Contacts/pilot-map-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); - + filename = g_strdup_printf ("%s/.evolution/addressbook/local/system/pilot-map-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id); + return filename; } @@ -487,14 +487,15 @@ static EContactField get_next_mail (EContactField *field) { if (field == NULL) - return E_CONTACT_EMAIL; + return E_CONTACT_EMAIL_1; switch (*field) { - case E_CONTACT_EMAIL: + case E_CONTACT_EMAIL_1: return E_CONTACT_EMAIL_2; case E_CONTACT_EMAIL_2: return E_CONTACT_EMAIL_3; default: + break; } return E_CONTACT_FIELD_LAST; @@ -510,6 +511,7 @@ get_next_home (EContactField *field) case E_CONTACT_PHONE_HOME: return E_CONTACT_PHONE_HOME_2; default: + break; } return E_CONTACT_FIELD_LAST; @@ -525,6 +527,7 @@ get_next_work (EContactField *field) case E_CONTACT_PHONE_BUSINESS: return E_CONTACT_PHONE_BUSINESS_2; default: + break; } return E_CONTACT_FIELD_LAST; @@ -542,6 +545,7 @@ get_next_fax (EContactField *field) case E_CONTACT_PHONE_HOME_FAX: return E_CONTACT_PHONE_OTHER_FAX; default: + break; } return E_CONTACT_FIELD_LAST; @@ -781,10 +785,9 @@ local_record_to_pilot_record (EAddrLocalRecord *local, static void local_record_from_ecard (EAddrLocalRecord *local, EContact *contact, EAddrConduitContext *ctxt) { - const EContactAddress *address; - EContactField mailing_address; + EContactAddress *address = NULL; int phone = entryPhone1; - + EContactField field; gboolean syncable; int i; @@ -835,25 +838,16 @@ local_record_from_ecard (EAddrLocalRecord *local, EContact *contact, EAddrCondui local->addr->entry[entryTitle] = e_pilot_utf8_to_pchar (e_contact_get_const (contact, E_CONTACT_TITLE)); /* See if the default has something in it */ - mailing_address = -1; - if (e_contact_get_const (contact, ctxt->cfg->default_address)) - mailing_address = ctxt->cfg->default_address; - - /* If it doesn't, look for any address */ - if (mailing_address == -1) { - for (i = E_CONTACT_FIRST_LABEL_ID; i < E_CONTACT_LAST_LABEL_ID; i++) { - if (e_contact_get_const (contact, i)) { - mailing_address = i; + if ((address = e_contact_get (contact, ctxt->cfg->default_address))) { + field = ctxt->cfg->default_address; + } else { + /* Try to find a non-empty address field */ + for (field = E_CONTACT_FIRST_ADDRESS_ID; field <= E_CONTACT_LAST_ADDRESS_ID; field++) { + if ((address = e_contact_get (contact, field))) break; - } } } - /* If all else fails, use the default */ - if (mailing_address == -1) - mailing_address = ctxt->cfg->default_address; - - address = e_contact_get_const (contact, mailing_address); if (address) { char *add; @@ -869,8 +863,10 @@ local_record_from_ecard (EAddrLocalRecord *local, EContact *contact, EAddrCondui local->addr->entry[entryState] = e_pilot_utf8_to_pchar (address->region); local->addr->entry[entryZip] = e_pilot_utf8_to_pchar (address->code); local->addr->entry[entryCountry] = e_pilot_utf8_to_pchar (address->country); + + e_contact_address_free (address); } - + /* Phone numbers */ /* See if everything is syncable */ @@ -893,7 +889,7 @@ local_record_from_ecard (EAddrLocalRecord *local, EContact *contact, EAddrCondui } } for ( ; phone <= entryPhone5; phone++) - local->addr->phoneLabel[phone - entryPhone1] = phone - entryPhone1; + local->addr->phoneLabel[phone - entryPhone1] = phone - entryPhone1; local->addr->showPhone = 0; } else { EContactField next_mail, next_home, next_work, next_fax; @@ -1017,13 +1013,14 @@ ecard_from_remote_record(EAddrConduitContext *ctxt, /* Address */ mailing_address = -1; - if (e_contact_get_const (contact, ctxt->cfg->default_address)) + if ((eaddress = e_contact_get (contact, ctxt->cfg->default_address))) { mailing_address = ctxt->cfg->default_address; - - if (mailing_address == -1) { - for (i = E_CONTACT_FIRST_LABEL_ID; i < E_CONTACT_LAST_LABEL_ID; i++) { - if (e_contact_get_const (contact, i)) { - mailing_address = i; + e_contact_address_free (eaddress); + } else { + for (i = E_CONTACT_FIRST_ADDRESS_ID; i <= E_CONTACT_LAST_ADDRESS_ID; i++) { + if ((eaddress = e_contact_get (contact, i))) { + e_contact_address_free (eaddress); + mailing_address = i; break; } } @@ -1031,14 +1028,17 @@ ecard_from_remote_record(EAddrConduitContext *ctxt, if (mailing_address == -1) mailing_address = ctxt->cfg->default_address; - + eaddress = g_new0 (EContactAddress, 1); txt = get_entry_text (address, entryAddress); - if ((find = strchr (txt, '\n')) != NULL) { + if (txt && (find = strchr (txt, '\n')) != NULL) { *find = '\0'; find++; - } + } else { + find = NULL; + } + eaddress->street = txt; eaddress->ext = find != NULL ? g_strdup (find) : g_strdup (""); eaddress->locality = get_entry_text (address, entryCity); @@ -1159,13 +1159,18 @@ pre_sync (GnomePilotConduit *conduit, g_free (filename); /* Get a list of all contacts */ - query = e_book_query_from_string ("#t"); + if (!(query = e_book_query_any_field_contains (""))) { + LOG (g_warning ("Failed to get EBookQuery")); + return -1; + } + if (!e_book_get_contacts (ctxt->ebook, query, &ctxt->cards, NULL)) { - g_object_unref (query); - + LOG (g_warning ("Failed to get Contacts")); + e_book_query_unref (query); return -1; } - g_object_unref (query); + + e_book_query_unref (query); /* Count and hash the changes */ change_id = g_strdup_printf ("pilot-sync-evolution-addressbook-%d", ctxt->cfg->pilot_id); |