Discussion Board

Results 1 to 4 of 4

Thread: libebook

Hybrid View

  1. #1
    Registered User JM30's Avatar
    Join Date
    Mar 2010
    Posts
    4
    Hi,

    I need to parse a vcard and i'm using libebook/e-contact.h to do it. Now, my problem is to split the address field (or ADR in vcard).
    I do it at this way:

    GList* address_list;
    char* street;

    address_list = e_contact_get(contact, E_CONTACT_ADDRESS);
    EContactAddress* addr = (EContactAddress*) address_list->data;
    street = addr->street;

    but it isn't work, it gives me a segmentation fault.

    Can anyone help me.

    best regards,
    JM30

  2. #2
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    First of all, since this forum is about Qt. You can use Qt Mobility Contacts API.
    The proper code have to look something like this
    Code:
    GList* address_list = e_contact_get(contact, E_CONTACT_ADDRESS);
    for ( ; address_list; address_list = g_list_delete_link(address_list, address_list))
      EContactAddress* addr = (EContactAddress*)address_list->data;
      if (addr) {
        char* street = addr->street;
      }
    }
    Make sure that contact is really of a type EContact.

  3. #3
    Registered User JM30's Avatar
    Join Date
    Mar 2010
    Posts
    4
    Thank you,

    contact is a EContact, before that code i make:

    Code:
    char* user_data = "BEGIN:VCARD\nVERSION:2.1\nN:Guru2;;;;\nADR:;;Musterstrae1;;;;\nEND:VCARD";
    EContact* contact = e_contact_new_from_vcard (user_data);
    My problem is that i can't get de address, in this case "Musterstrae1".

  4. #4
    Nokia Developer Moderator gnuton's Avatar
    Join Date
    Mar 2009
    Posts
    1,024
    Hi,
    IIRC I faced the same problem some time ago.
    Your app should segfault because it fails to cast address_list->data to EContactAddress*.
    So calling addr->street is fatal!

    It sounds like a bug in the Maemo5 ebook libs..

    A workaround for this is to use the Versit cards.
    You can get the ADDRESS attributes of a contact with:
    GList* attrList = osso_abook_contact_get_attributes(eContact, EVC_ADR);

    You could also get the parameter for each attribute (Maemo5 supports NULL/HOME/WORK).
    as well as values.

    Note that you can have multiple address with the same parameter (in Qt mobility Contexts).

    If your app keeps to segfault, there could be other reasons like:
    1) running the app in scratchbox without "run-standalone.sh"
    2) running the app as root into the device... sometime it works but you cannot fetch any contact.

    If you are working with Qt I suggest you to use Mobility (>= 1.0.0).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved