本文整理汇总了C++中kcontacts::Addressee::preferredEmail方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::preferredEmail方法的具体用法?C++ Addressee::preferredEmail怎么用?C++ Addressee::preferredEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kcontacts::Addressee
的用法示例。
在下文中一共展示了Addressee::preferredEmail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contactMatchesFilter
static bool contactMatchesFilter(const KContacts::Addressee& contact, const QString &filter)
{
if (contact.assembledName().contains(filter, Qt::CaseInsensitive)) {
return true;
}
if (contact.organization().contains(filter, Qt::CaseInsensitive)) {
return true;
}
if (contact.preferredEmail().contains(filter, Qt::CaseInsensitive)) {
return true;
}
if (contact.phoneNumber(KContacts::PhoneNumber::Work).number().contains(filter, Qt::CaseInsensitive)) {
return true;
}
if (contact.phoneNumber(KContacts::PhoneNumber::Cell).number().contains(filter, Qt::CaseInsensitive)) {
return true;
}
if (contact.givenName().contains(filter, Qt::CaseInsensitive)) {
return true;
}
if (ItemsTreeModel::countryForContact(contact).contains(filter, Qt::CaseInsensitive)) {
return true;
}
return false;
}
示例2: exec
void CheckGravatarPluginInterface::exec()
{
if (mListItems.isEmpty()) {
KMessageBox::sorry(parentWidget(), i18n("You have not selected any contacts."));
} else {
if (mListItems.count() == 1) {
Akonadi::Item item = mListItems.first();
if (item.hasPayload<KContacts::Addressee>()) {
KContacts::Addressee address = item.payload<KContacts::Addressee>();
const QString email = address.preferredEmail();
if (email.isEmpty()) {
KMessageBox::error(parentWidget(), i18n("No email found for this contact."));
return;
}
QPointer<KABGravatar::GravatarUpdateDialog> dlg = new KABGravatar::GravatarUpdateDialog(parentWidget());
dlg->setEmail(email);
if (!address.photo().isEmpty()) {
if (address.photo().isIntern()) {
const QPixmap pix = QPixmap::fromImage(address.photo().data());
dlg->setOriginalPixmap(pix);
} else {
dlg->setOriginalUrl(QUrl(address.photo().url()));
}
}
if (dlg->exec()) {
KContacts::Picture picture = address.photo();
bool needToSave = false;
if (dlg->saveUrl()) {
const QUrl url = dlg->resolvedUrl();
if (!url.isEmpty()) {
picture.setUrl(url.toString());
needToSave = true;
}
} else {
const QPixmap pix = dlg->pixmap();
if (!pix.isNull()) {
picture.setData(pix.toImage());
needToSave = true;
}
}
if (needToSave) {
address.setPhoto(picture);
item.setPayload<KContacts::Addressee>(address);
Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item, this);
connect(modifyJob, &Akonadi::ItemModifyJob::result, this, &CheckGravatarPluginInterface::slotModifyContactFinished);
}
}
delete dlg;
} else {
KMessageBox::information(parentWidget(), i18n("A contact group was selected."));
}
} else {
KMessageBox::information(parentWidget(), i18n("Too many contacts selected."));
}
}
}
示例3: QString
static QString getEmail2(const KContacts::Addressee &addressee)
{
// preferred might not be the first one, so remove it and take the first of
// the remaining instead of always taking the second one
QStringList emails = addressee.emails();
emails.removeAll(addressee.preferredEmail());
if (!emails.isEmpty()) {
return emails.at( 0 );
}
return QString();
}
示例4: 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() ) );
}
示例5:
static QString getEmail1(const KContacts::Addressee &addressee)
{
return addressee.preferredEmail();
}