+void ContactManager::stringToName(QString const& strname, ContactManager::Name& name)
+{
+ EContactName* ename = e_contact_name_from_string(strname.toUtf8().data());
+
+ 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() && check.indexIn(firstname, 1) == -1 && check.indexIn(surname, 1) == -1)
+ {
+ name.firstname = firstname;
+ name.surname = surname;
+ }
+ else
+ {
+ name.surname = strname;
+ }
+
+ e_contact_name_free(ename);
+ }
+ else
+ {
+ name.surname = strname;
+ }
+}
+
+