Commit af9a67cf authored by blammit's avatar blammit

Merge pull request #80 from nemomobile/configure-name-spacing

[libcontacts] Check whether spacing should be used between name parts
parents 00ec0ba8 b5b90ce1
......@@ -1085,6 +1085,15 @@ bool SeasideCache::isPopulated(FilterType filterType)
return instancePtr->m_populated & (1 << filterType);
}
static bool needsSpaceBetweenNames(const QString &first, const QString &second)
{
if (first.isEmpty() || second.isEmpty()) {
return false;
}
return first[first.length()-1].script() != QChar::Script_Han
|| second[0].script() != QChar::Script_Han;
}
// small helper to avoid inconvenience
QString SeasideCache::generateDisplayLabel(const QContact &contact, DisplayLabelOrder order)
{
......@@ -1106,8 +1115,9 @@ QString SeasideCache::generateDisplayLabel(const QContact &contact, DisplayLabel
displayLabel.append(nameStr1);
if (!nameStr2.isEmpty()) {
if (!displayLabel.isEmpty())
if (needsSpaceBetweenNames(nameStr1, nameStr2)) {
displayLabel.append(" ");
}
displayLabel.append(nameStr2);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment