X-Git-Url: http://git.maemo.org/git/?p=jenirok;a=blobdiff_plain;f=src%2Fcommon%2Fcontactmanager.cpp;fp=src%2Fcommon%2Fcontactmanager.cpp;h=fc0c62d783846c73b0899b9afb74dfd3681ee737;hp=f9047b59cdc07eb4d8f09df5fcfbb2cf38a1d8b3;hb=d93782e7a5ae0fc072d094fd645cf415a34a2244;hpb=395da8664c99ec244e746de156217bbba96dea7b diff --git a/src/common/contactmanager.cpp b/src/common/contactmanager.cpp index f9047b5..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) { + 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::fromUtf8(ename->given); - name.surname = QString::fromUtf8(ename->family); + name.firstname = firstname; + name.surname = surname; } else {