Commit 05d4a852 authored by mvogt's avatar mvogt

Do not add multiple instances of contact nickname.

parent 5da09cc5
......@@ -289,6 +289,19 @@ bool updateExistingContact(QContact *updateContact, const QContact &contact)
return mergeIntoExistingContact(updateContact, importedContact);
}
void setNickname(QContact &contact, const QString &text)
{
foreach (const QContactNickname &nick, contact.details<QContactNickname>()) {
if (nick.nickname() == text) {
return;
}
}
QContactNickname nick;
nick.setNickname(text);
contact.saveDetail(&nick);
}
}
QList<QContact> SeasideImport::buildImportContacts(const QList<QVersitDocument> &details, int *newCount, int *updatedCount)
......@@ -358,9 +371,7 @@ QList<QContact> SeasideImport::buildImportContacts(const QList<QVersitDocument>
importLabels.insert(label, it);
// Modify this contact to have the label as a nickname
QContactNickname nickname;
nickname.setNickname(label);
contact.saveDetail(&nickname);
setNickname(contact, label);
}
}
}
......
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