*/
#include <QtCore/QDebug>
+#include <QtCore/QRegExp>
#include "contactmanager.h"
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(ename)
{
- name.firstname = QString(ename->given);
- name.surname = QString(ename->family);
-
- 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 && firstname != surname)
+ {
+ name.firstname = firstname;
+ name.surname = surname;
+ }
+ else
{
- name.firstname += " " + additional;
+ name.surname = strname;
}
e_contact_name_free(ename);