本文整理汇总了C++中kcontacts::Addressee::setEmailList方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::setEmailList方法的具体用法?C++ Addressee::setEmailList怎么用?C++ Addressee::setEmailList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kcontacts::Addressee
的用法示例。
在下文中一共展示了Addressee::setEmailList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: shouldSelectFirstEmail
void EmailEditWidgetTest::shouldSelectFirstEmail()
{
EmailEditWidget widget;
QLineEdit *lineedit = widget.findChild<QLineEdit *>(QStringLiteral("emailedit"));
KContacts::Addressee addr;
KContacts::Email::List lst;
const QString firstEmail(QStringLiteral("[email protected]"));
lst << KContacts::Email(firstEmail);
lst << KContacts::Email(QStringLiteral("[email protected]"));
addr.setEmailList(lst);
widget.loadContact(addr);
QCOMPARE(lineedit->text(), firstEmail);
}
示例2: storeContact
void MailWidgetLister::storeContact(KContacts::Addressee &contact) const
{
const QList<QWidget *> widgetList = widgets();
KContacts::Email::List emailList;
emailList.reserve(widgetList.count());
for (QWidget *widget : widgetList) {
MailWidget *w = qobject_cast<MailWidget *>(widget);
KContacts::Email newEmail = w->email();
if (newEmail.isValid()) {
emailList << newEmail;
}
}
contact.setEmailList(emailList);
}
示例3: shouldChangeEmail
void EmailEditWidgetTest::shouldChangeEmail()
{
EmailEditWidget widget;
QLineEdit *lineedit = widget.findChild<QLineEdit *>(QStringLiteral("emailedit"));
KContacts::Addressee addr;
KContacts::Email::List lst;
const QString firstEmail(QStringLiteral("[email protected]"));
lst << KContacts::Email(firstEmail);
lst << KContacts::Email(QStringLiteral("[email protected]"));
addr.setEmailList(lst);
widget.loadContact(addr);
const QString changedEmail(QStringLiteral("[email protected]"));
lineedit->setText(changedEmail);
KContacts::Addressee result;
widget.storeContact(result);
QVERIFY(!result.emailList().isEmpty());
QCOMPARE(result.emailList().first().mail(), changedEmail);
}