X-Git-Url: http://git.maemo.org/git/?p=jenirok;a=blobdiff_plain;f=src%2Fcommon%2Fcontactmanager.cpp;h=fc0c62d783846c73b0899b9afb74dfd3681ee737;hp=caf360c8ad114c9249b08445e4ad217db3b41acc;hb=40f8e10e1efc5019011df940328cdc734576143d;hpb=42490c37aa0b584fd6c664939090e17d1181b879 diff --git a/src/common/contactmanager.cpp b/src/common/contactmanager.cpp index caf360c..fc0c62d 100644 --- a/src/common/contactmanager.cpp +++ b/src/common/contactmanager.cpp @@ -17,6 +17,7 @@ */ #include +#include #include "contactmanager.h" @@ -77,6 +78,7 @@ bool ContactManager::addContact(Contact const& contact) 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); @@ -123,12 +125,15 @@ void ContactManager::stringToName(QString const& strname, ContactManager::Name& if(ename) { - QString additional = QString(ename->additional); + static QRegExp check("([A-Z]+)"); + QString additional = QString::fromUtf8(ename->additional); + QString firstname = QString::fromUtf8(ename->given); + QString surname = QString::fromUtf8(ename->family); - if(additional.isEmpty()) + if(additional.isEmpty() && check.indexIn(firstname, 1) == -1 && check.indexIn(surname, 1) == -1) { - name.firstname = QString(ename->given); - name.surname = QString(ename->family); + name.firstname = firstname; + name.surname = surname; } else {