Skip to content

Commit

Permalink
[buteo-sync-plugins-social] Don't set Google gd:fullName as customLab…
Browse files Browse the repository at this point in the history
…el field. Fixes JB#51831

The customLabel field is used as the default display label in the
QtContacts backend, and since the customLabel for a Google contact is
only updated during a sync operation, the customLabel (and hence the
contact's display label) was not updated when the contact name changed
outside of a sync operation.

It's not necessary to set this as the customLabel field in any case,
because we need to always send the latest version of the formatted name
(according to any local name changes for the contact) in order to avoid
spurious modification notifications from the server.
  • Loading branch information
blammit committed Nov 4, 2020
1 parent 78f2a3b commit c1239f2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/google/google-contacts/googlecontactstream.cpp
Expand Up @@ -661,8 +661,6 @@ QContactDetail GoogleContactStream::handleEntryName()
name.setPrefix(mXmlReader->readElementText());
} else if (mXmlReader->qualifiedName() == "gd:nameSuffix") {
name.setSuffix(mXmlReader->readElementText());
} else if (mXmlReader->qualifiedName() == "gd:fullName") {
name.setCustomLabel(mXmlReader->readElementText());
}
}
mXmlReader->readNextStartElement();
Expand Down Expand Up @@ -1008,6 +1006,8 @@ void GoogleContactStream::encodeName(const QContactName &name)
if (!name.suffix().isEmpty())
mXmlWriter->writeTextElement("gd:nameSuffix", name.suffix());

// Send the formatted fullName to the server. Otherwise if this field is missing, the server
// detects it as a spurious modification.
const QString fullName = (QStringList()
<< name.prefix()
<< SeasideCache::primaryName(firstName, lastName)
Expand All @@ -1016,8 +1016,6 @@ void GoogleContactStream::encodeName(const QContactName &name)
<< name.suffix()).join(' ');
if (!fullName.isEmpty())
mXmlWriter->writeTextElement("gd:fullName", fullName);
else if (!name.customLabel().isEmpty())
mXmlWriter->writeTextElement("gd:fullName", name.customLabel());

mXmlWriter->writeEndElement();
}
Expand Down

0 comments on commit c1239f2

Please sign in to comment.