本文整理汇总了C++中kcontacts::Addressee::address方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::address方法的具体用法?C++ Addressee::address怎么用?C++ Addressee::address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kcontacts::Addressee
的用法示例。
在下文中一共展示了Addressee::address方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contactToTemplate
void ReportGenerator::contactToTemplate( TextTemplate *tmpl, const QString& prefix, const KContacts::Addressee& contact )
{
if( contact.isEmpty() ) return;
tmpl->setValue( ADDRESS_TAG( prefix, "NAME" ), escapeTrml2pdfXML( contact.realName() ) );
QString co = contact.organization();
if( co.isEmpty() ) {
co = contact.realName();
}
tmpl->setValue( ADDRESS_TAG( prefix, "ORGANISATION" ), escapeTrml2pdfXML( co ) );
tmpl->setValue( ADDRESS_TAG( prefix, "URL" ), escapeTrml2pdfXML( contact.url().toString() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "EMAIL" ), escapeTrml2pdfXML( contact.preferredEmail() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "PHONE" ), escapeTrml2pdfXML( contact.phoneNumber( KContacts::PhoneNumber::Work ).number() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "FAX" ), escapeTrml2pdfXML( contact.phoneNumber( KContacts::PhoneNumber::Fax ).number() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "CELL" ), escapeTrml2pdfXML( contact.phoneNumber( KContacts::PhoneNumber::Cell ).number() ) );
KContacts::Address address;
address = contact.address( KContacts::Address::Pref );
if( address.isEmpty() )
address = contact.address(KContacts::Address::Work );
if( address.isEmpty() )
address = contact.address(KContacts::Address::Home );
if( address.isEmpty() )
address = contact.address(KContacts::Address::Postal );
tmpl->setValue( ADDRESS_TAG( prefix, "POSTBOX" ),
escapeTrml2pdfXML( address.postOfficeBox() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "EXTENDED" ),
escapeTrml2pdfXML( address.extended() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "STREET" ),
escapeTrml2pdfXML( address.street() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "LOCALITY" ),
escapeTrml2pdfXML( address.locality() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "REGION" ),
escapeTrml2pdfXML( address.region() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "POSTCODE" ),
escapeTrml2pdfXML( address.postalCode() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "COUNTRY" ),
escapeTrml2pdfXML( address.country() ) );
tmpl->setValue( ADDRESS_TAG( prefix, "REGION" ),
escapeTrml2pdfXML( address.region() ) );
tmpl->setValue( ADDRESS_TAG( prefix,"LABEL" ),
escapeTrml2pdfXML( address.label() ) );
}
示例2: compare
void ContactsHandler::compare(Akonadi::AbstractDifferencesReporter *reporter,
const Akonadi::Item &leftItem, const Akonadi::Item &rightItem)
{
Q_ASSERT(leftItem.hasPayload<KContacts::Addressee>());
Q_ASSERT(rightItem.hasPayload<KContacts::Addressee>());
const KContacts::Addressee leftContact = leftItem.payload<KContacts::Addressee>();
const KContacts::Addressee rightContact = rightItem.payload<KContacts::Addressee>();
const QString modifiedBy = mSession->userName();
const QString modifiedOn = formatDate(getDateModified(rightContact));
reporter->setLeftPropertyValueTitle(i18nc("@title:column", "My Contact"));
reporter->setRightPropertyValueTitle(
i18nc("@title:column", "Their Contact: modified by %1 on %2",
modifiedBy, modifiedOn));
bool seenPrimaryAddress = false;
bool seenOtherAddress = false;
const AccessorHash accessors = accessorHash();
AccessorHash::const_iterator it = accessors.constBegin();
AccessorHash::const_iterator endIt = accessors.constEnd();
for (; it != endIt; ++it) {
// check if this is a read-only field
if ((*it).getter == nullptr) {
continue;
}
QString leftValue = (*it).getter(leftContact);
QString rightValue = (*it).getter(rightContact);
QString diffName = (*it).diffName;
if (diffName.isEmpty()) {
// check for special fields
if (isAddressValue(it.key())) {
if (isPrimaryAddressValue(it.key())) {
if (!seenPrimaryAddress) {
diffName = i18nc("item:intable", "Primary Address");
seenPrimaryAddress = true;
const KContacts::Address leftAddress =
leftContact.address(KContacts::Address::Work | KContacts::Address::Pref);
const KContacts::Address rightAddress =
rightContact.address(KContacts::Address::Work | KContacts::Address::Pref);
leftValue = leftAddress.formattedAddress();
rightValue = rightAddress.formattedAddress();
} else {
// already printed, skip
continue;
}
} else {
if (!seenOtherAddress) {
seenOtherAddress = true;
diffName = i18nc("item:intable", "Other Address");
const KContacts::Address leftAddress =
leftContact.address(KContacts::Address::Home);
const KContacts::Address rightAddress =
rightContact.address(KContacts::Address::Home);
leftValue = leftAddress.formattedAddress();
rightValue = rightAddress.formattedAddress();
} else {
// already printed, skip
continue;
}
}
} else if (it.key() == QLatin1String("do_not_call")) {
diffName = i18nc("@item:intable", "Do Not Call");
leftValue = getDoNotCall(leftContact) == QLatin1String("1")
? QStringLiteral("Yes") : QStringLiteral("No");
rightValue = getDoNotCall(rightContact) == QLatin1String("1")
? QStringLiteral("Yes") : QStringLiteral("No");
} else {
// internal field, skip
continue;
}
}
if (leftValue.isEmpty() && rightValue.isEmpty()) {
continue;
}
if (leftValue.isEmpty()) {
reporter->addProperty(Akonadi::AbstractDifferencesReporter::AdditionalRightMode,
diffName, leftValue, rightValue);
} else if (rightValue.isEmpty()) {
reporter->addProperty(Akonadi::AbstractDifferencesReporter::AdditionalLeftMode,
diffName, leftValue, rightValue);
} else if (leftValue != rightValue) {
reporter->addProperty(Akonadi::AbstractDifferencesReporter::ConflictMode,
diffName, leftValue, rightValue);
}
}
}
示例3: getOtherPostalcode
static QString getOtherPostalcode(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Home).postalCode();
}
示例4: getOtherCountry
static QString getOtherCountry(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Home).country();
}
示例5: getOtherCity
static QString getOtherCity(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Home).locality();
}
示例6: getOtherState
static QString getOtherState(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Home).region();
}
示例7: getOtherStreet
static QString getOtherStreet(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Home).street();
}
示例8: getPrimaryCountry
static QString getPrimaryCountry(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Work | KContacts::Address::Pref).country();
}
示例9: getPrimaryPostalcode
static QString getPrimaryPostalcode(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Work | KContacts::Address::Pref).postalCode();
}
示例10: getPrimaryState
static QString getPrimaryState(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Work | KContacts::Address::Pref).region();
}
示例11: getPrimaryStreet
static QString getPrimaryStreet(const KContacts::Addressee &addressee)
{
return addressee.address(KContacts::Address::Work).street();
}