本文整理汇总了C++中kcontacts::Addressee::insertAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::insertAddress方法的具体用法?C++ Addressee::insertAddress怎么用?C++ Addressee::insertAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kcontacts::Addressee
的用法示例。
在下文中一共展示了Addressee::insertAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: itemFromEntry
Akonadi::Item ContactsHandler::itemFromEntry(const KDSoapGenerated::TNS__Entry_value &entry, const Akonadi::Collection &parentCollection, bool &deleted)
{
Akonadi::Item item;
const QList<KDSoapGenerated::TNS__Name_value> valueList = entry.name_value_list().items();
if (valueList.isEmpty()) {
qCWarning(FATCRM_SUGARCRMRESOURCE_LOG) << "Contacts entry for id=" << entry.id() << "has no values";
return item;
}
item.setRemoteId(entry.id());
item.setParentCollection(parentCollection);
item.setMimeType(KContacts::Addressee::mimeType());
KContacts::Addressee addressee;
addressee.setUid(entry.id());
KContacts::Address workAddress, homeAddress;
workAddress.setType(KContacts::Address::Work | KContacts::Address::Pref);
homeAddress.setType(KContacts::Address::Home);
const AccessorHash accessors = accessorHash();
Q_FOREACH (const KDSoapGenerated::TNS__Name_value &namedValue, valueList) {
const QString crmFieldName = sugarFieldToCrmField(namedValue.name());
const AccessorHash::const_iterator accessIt = accessors.constFind(crmFieldName);
if (accessIt == accessors.constEnd()) { // no accessor for regular field
const QString customCrmFieldName = customSugarFieldToCrmField(namedValue.name());
addressee.insertCustom(QStringLiteral("FATCRM"), QStringLiteral("X-Custom-%1").arg(customCrmFieldName), KDCRMUtils::decodeXML(namedValue.value()));
continue;
}
const QString value = KDCRMUtils::decodeXML(namedValue.value());
if (isAddressValue(crmFieldName)) {
KContacts::Address &address =
isPrimaryAddressValue(crmFieldName) ? workAddress : homeAddress;
(*accessIt).setter.aSetter(value, address);
} else {
(*accessIt).setter.vSetter(value, addressee);
}
}
addressee.insertAddress(workAddress);
addressee.insertAddress(homeAddress);
item.setPayload<KContacts::Addressee>(addressee);
item.setRemoteRevision(getDateModified(addressee));
deleted = getDeleted(addressee) == QLatin1String("1");
return item;
}