X-Git-Url: http://git.maemo.org/git/?p=jenirok;a=blobdiff_plain;f=src%2Fcommon%2Fcontactmanager.cpp;h=bb8c6750dc7e7ec9144356d6ba8f4e587817d346;hp=cf459b43dcf872dcded754ab0a612ac60c59c31c;hb=5b03daed5d035b510b97a440959bffc8d7445967;hpb=e40e77e82cb5d34ad45221cefe89327b89e30c18 diff --git a/src/common/contactmanager.cpp b/src/common/contactmanager.cpp index cf459b4..bb8c675 100644 --- a/src/common/contactmanager.cpp +++ b/src/common/contactmanager.cpp @@ -75,11 +75,10 @@ bool ContactManager::addContact(Contact const& contact) GError* error = NULL; EContactAddress* addr = NULL; - if(!contact.name.isEmpty()) - { - char* name = contact.name.toUtf8().data(); - e_contact_set(newContact, E_CONTACT_FULL_NAME, (gpointer)name); - } + char* firstname = contact.name.firstname.toUtf8().data(); + char* surname = contact.name.surname.toUtf8().data(); + e_contact_set(newContact, E_CONTACT_GIVEN_NAME, (gpointer)firstname); + e_contact_set(newContact, E_CONTACT_FAMILY_NAME, (gpointer)surname); if(!contact.city.isEmpty() || !contact.street.isEmpty()) { @@ -118,6 +117,31 @@ bool ContactManager::addContact(Contact const& contact) return ret; } +void ContactManager::stringToName(QString const& strname, ContactManager::Name& name) +{ + EContactName* ename = e_contact_name_from_string(strname.toUtf8().data()); + + if(ename) + { + name.firstname = QString(ename->given); + name.surname = QString(ename->family); + + QString additional = QString(ename->additional); + + if(!additional.isEmpty()) + { + name.firstname += " " + additional; + } + + e_contact_name_free(ename); + } + else + { + name.surname = strname; + } +} + + bool ContactManager::load() { if(book_)