本文整理汇总了C++中kcontacts::Addressee类的典型用法代码示例。如果您正苦于以下问题:C++ Addressee类的具体用法?C++ Addressee怎么用?C++ Addressee使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Addressee类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: shouldGenerateVCardWithParameter
void CalendarUrlTest::shouldGenerateVCardWithParameter()
{
KContacts::AddresseeList lst;
KContacts::Addressee addr;
addr.setEmails(QStringList() << QStringLiteral("[email protected]"));
addr.setUid(QStringLiteral("testuid"));
CalendarUrl url;
url.setType(CalendarUrl::CALUri);
url.setUrl(QUrl(QStringLiteral("https://sherlockholmes.com/calendar/sherlockholmes")));
QMap<QString, QStringList> params;
params.insert(QStringLiteral("Foo2"), QStringList() << QStringLiteral("bla2") << QStringLiteral("blo2"));
url.setParameters(params);
addr.insertCalendarUrl(url);
lst << addr;
KContacts::VCardTool vcard;
const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v4_0);
QByteArray expected = QByteArray("BEGIN:VCARD\r\n"
"VERSION:4.0\r\n"
"CALURI;FOO2=bla2,blo2:https://sherlockholmes.com/calendar/sherlockholmes\r\n"
"EMAIL:[email protected]\r\n"
"N:;;;;\r\n"
"UID:testuid\r\n"
"END:VCARD\r\n\r\n");
QCOMPARE(ba, expected);
}
开发者ID:KDE,项目名称:kcontacts,代码行数:25,代码来源:calendarurltest.cpp
示例2: getErrorItem
Akonadi::Item getErrorItem(Kolab::FolderType folderType, const QString &remoteId)
{
//TODO set title, text and icon
Akonadi::Item item;
item.setRemoteId(remoteId);
switch (folderType) {
case Kolab::EventType: {
KCalCore::Event::Ptr event(new KCalCore::Event);
//FIXME Use message creation date time
event->setDtStart(KDateTime::currentUtcDateTime());
event->setSummary(i18n("Corrupt Event"));
event->setDescription(i18n("Event could not be read. Delete this event to remove it from the server."));
item.setMimeType(KCalCore::Event::eventMimeType());
item.setPayload(event);
}
break;
case Kolab::TaskType: {
KCalCore::Todo::Ptr task(new KCalCore::Todo);
//FIXME Use message creation date time
task->setDtStart(KDateTime::currentUtcDateTime());
task->setSummary(i18n("Corrupt Task"));
task->setDescription(i18n("Task could not be read. Delete this task to remove it from the server."));
item.setMimeType(KCalCore::Todo::todoMimeType());
item.setPayload(task);
}
break;
case Kolab::JournalType: {
KCalCore::Journal::Ptr journal(new KCalCore::Journal);
//FIXME Use message creation date time
journal->setDtStart(KDateTime::currentUtcDateTime());
journal->setSummary(i18n("Corrupt journal"));
journal->setDescription(i18n("Journal could not be read. Delete this journal to remove it from the server."));
item.setMimeType(KCalCore::Journal::journalMimeType());
item.setPayload(journal);
}
break;
case Kolab::ContactType: {
KContacts::Addressee addressee;
addressee.setName(i18n("Corrupt Contact"));
addressee.setNote(i18n("Contact could not be read. Delete this contact to remove it from the server."));
item.setMimeType(KContacts::Addressee::mimeType());
item.setPayload(addressee);
}
break;
case Kolab::NoteType: {
Akonadi::NoteUtils::NoteMessageWrapper note;
note.setTitle(i18n("Corrupt Note"));
note.setText(i18n("Note could not be read. Delete this note to remove it from the server."));
item.setPayload(Akonadi::NoteUtils::noteMimeType());
item.setPayload(note.message());
}
break;
case Kolab::MailType:
//We don't convert mails, so that should never fail.
default:
qCWarning(KOLABRESOURCE_LOG) << "unhandled folder type: " << folderType;
}
return item;
}
开发者ID:KDE,项目名称:kdepim-runtime,代码行数:59,代码来源:kolabhelpers.cpp
示例3: storeContact
void ImageWidget::storeContact(KContacts::Addressee &contact) const
{
if (mType == Photo) {
contact.setPhoto(mPicture);
} else {
contact.setLogo(mPicture);
}
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:8,代码来源:imagewidget.cpp
示例4: nameFromStringTest
void AddresseeTest::nameFromStringTest()
{
KContacts::Addressee a;
a.setNameFromString(QStringLiteral("Firstname Lastname"));
QCOMPARE(a.givenName(), QStringLiteral("Firstname"));
QCOMPARE(a.familyName(), QStringLiteral("Lastname"));
QCOMPARE(a.formattedName(), QStringLiteral("Firstname Lastname"));
}
开发者ID:KDE,项目名称:kcontacts,代码行数:8,代码来源:addresseetest.cpp
示例5: emptyTest
void AddresseeTest::emptyTest()
{
KContacts::Addressee addressee;
QVERIFY(addressee.isEmpty());
KContacts::Addressee addresseeWithMail;
addresseeWithMail.insertEmail(QStringLiteral("[email protected]"));
QVERIFY(!addresseeWithMail.isEmpty());
}
开发者ID:KDE,项目名称:kcontacts,代码行数:9,代码来源:addresseetest.cpp
示例6: fullEmailTest
void AddresseeTest::fullEmailTest()
{
KContacts::Addressee a;
QStringList emails;
emails << QStringLiteral("[email protected]");
a.setEmails(emails);
a.setFormattedName(QStringLiteral("firstname \"nickname\" lastname"));
QCOMPARE(a.fullEmail(),
QStringLiteral("\"firstname \\\"nickname\\\" lastname\" <[email protected]>"));
}
开发者ID:KDE,项目名称:kcontacts,代码行数:10,代码来源:addresseetest.cpp
示例7: loadContact
void ImageWidget::loadContact(const KContacts::Addressee &contact)
{
mPicture = (mType == Photo ? contact.photo() : contact.logo());
if (mPicture.isIntern() && !mPicture.data().isNull()) {
mHasImage = true;
} else if (!mPicture.isIntern() && !mPicture.url().isEmpty()) {
mHasImage = true;
}
updateView();
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:11,代码来源:imagewidget.cpp
示例8: shouldExportEmptyGender
void GenderTest::shouldExportEmptyGender()
{
KContacts::AddresseeList lst;
KContacts::Addressee addr;
addr.setEmails(QStringList() << QStringLiteral("[email protected]"));
addr.setUid(QStringLiteral("testuid"));
lst << addr;
KContacts::VCardTool vcard;
const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v4_0);
QByteArray expected = createCard(QByteArray());
QCOMPARE(ba, expected);
}
开发者ID:KDE,项目名称:kcontacts,代码行数:12,代码来源:gendertest.cpp
示例9: 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();
}
开发者ID:KDAB,项目名称:FatCRM,代码行数:12,代码来源:contactshandler.cpp
示例10: itemName
QString MergeContactWidgetList::itemName(const KContacts::Addressee &address) const
{
const QString realName = address.realName();
if (!realName.isEmpty()) {
return realName;
}
const QString name = address.name();
if (!name.isEmpty()) {
return name;
}
return address.fullEmail();
}
开发者ID:KDE,项目名称:kdepim-addons,代码行数:12,代码来源:mergecontactwidgetlist.cpp
示例11: 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);
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:13,代码来源:emaileditwidgettest.cpp
示例12: 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;
}
开发者ID:KDAB,项目名称:FatCRM,代码行数:51,代码来源:contactshandler.cpp
示例13: loadContact
void BusinessEditorWidget::loadContact(const KContacts::Addressee &contact)
{
mLogoWidget->loadContact(contact);
mOrganizationWidget->setText(contact.organization());
mProfessionWidget->setText(Akonadi::Utils::loadCustom(contact, QStringLiteral("X-Profession")));
mTitleWidget->setText(contact.title());
mDepartmentWidget->setText(contact.department());
mOfficeWidget->setText(Akonadi::Utils::loadCustom(contact, QStringLiteral("X-Office")));
mManagerWidget->setText(Akonadi::Utils::loadCustom(contact, QStringLiteral("X-ManagersName")));
mAssistantWidget->setText(Akonadi::Utils::loadCustom(contact, QStringLiteral("X-AssistantsName")));
// groupware group
mFreeBusyWidget->loadContact(contact);
}
开发者ID:KDE,项目名称:kdepimlibs,代码行数:15,代码来源:businesseditorwidget.cpp
示例14: shouldExportOnlyGenderWithoutTypeCommentGender
void GenderTest::shouldExportOnlyGenderWithoutTypeCommentGender()
{
KContacts::AddresseeList lst;
KContacts::Addressee addr;
addr.setEmails(QStringList() << QStringLiteral("[email protected]"));
addr.setUid(QStringLiteral("testuid"));
KContacts::Gender gender;
gender.setComment(QStringLiteral("comment"));
addr.setGender(gender);
lst << addr;
KContacts::VCardTool vcard;
const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v4_0);
QByteArray expected = createCard(QByteArray("GENDER:;comment"));
QCOMPARE(ba, expected);
}
开发者ID:KDE,项目名称:kcontacts,代码行数:15,代码来源:gendertest.cpp
示例15: storeContact
void BusinessEditorWidget::storeContact(KContacts::Addressee &contact)
{
// general group
mLogoWidget->storeContact(contact);
contact.setOrganization(mOrganizationWidget->text());
Akonadi::Utils::storeCustom(contact, QStringLiteral("X-Profession"), mProfessionWidget->text().trimmed());
contact.setTitle(mTitleWidget->text().trimmed());
contact.setDepartment(mDepartmentWidget->text().trimmed());
Akonadi::Utils::storeCustom(contact, QStringLiteral("X-Office"), mOfficeWidget->text().trimmed());
Akonadi::Utils::storeCustom(contact, QStringLiteral("X-ManagersName"), mManagerWidget->text().trimmed());
Akonadi::Utils::storeCustom(contact, QStringLiteral("X-AssistantsName"), mAssistantWidget->text().trimmed());
// groupware group
mFreeBusyWidget->storeContact(contact);
}
开发者ID:KDE,项目名称:kdepimlibs,代码行数:15,代码来源:businesseditorwidget.cpp
示例16: storeContact
void SecrecyEditWidget::storeContact(KContacts::Addressee &contact) const
{
KContacts::Secrecy secrecy;
secrecy.setType((KContacts::Secrecy::Type)mSecrecyCombo->currentIndex());
contact.setSecrecy(secrecy);
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:7,代码来源:secrecyeditwidget.cpp
示例17: 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."));
}
}
}
开发者ID:KDE,项目名称:kdepim-addons,代码行数:57,代码来源:checkgravatarplugininterface.cpp
示例18: storeContact
void CustomFieldsListWidget::storeContact(KContacts::Addressee &contact) const
{
const CustomField::List customFields = mModel->customFields();
for (const CustomField &customField : customFields) {
// write back values for local and global scope, leave external untouched
if (customField.scope() != CustomField::ExternalScope) {
if (!customField.value().isEmpty()) {
contact.insertCustom(QStringLiteral("KADDRESSBOOK"), customField.key(), customField.value());
} else {
contact.removeCustom(QStringLiteral("KADDRESSBOOK"), customField.key());
}
}
}
// Now remove all fields that were available in loadContact (these are stored in mLocalCustomFields)
// but are not part of customFields now, which means they have been removed or renamed by the user
// in the editor dialog.
for (const CustomField &oldCustomField : qAsConst(mLocalCustomFields)) {
if (oldCustomField.scope() != CustomField::ExternalScope) {
bool fieldStillExists = false;
for (const CustomField &newCustomField : qAsConst(customFields)) {
if (newCustomField.scope() != CustomField::ExternalScope) {
if (newCustomField.key() == oldCustomField.key()) {
fieldStillExists = true;
break;
}
}
}
if (!fieldStillExists) {
contact.removeCustom(QStringLiteral("KADDRESSBOOK"), oldCustomField.key());
}
}
}
// And store the global custom fields descriptions as well
CustomField::List globalCustomFields;
for (const CustomField &customField : qAsConst(customFields)) {
if (customField.scope() == CustomField::GlobalScope) {
globalCustomFields << customField;
}
}
CustomFieldManager::setGlobalCustomFieldDescriptions(globalCustomFields);
}
开发者ID:KDE,项目名称:akonadi-contacts,代码行数:45,代码来源:customfieldslistwidget.cpp
示例19: 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);
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:18,代码来源:emaileditwidgettest.cpp
示例20: loadContact
void CategoriesEditWidget::loadContact(const KContacts::Addressee &contact)
{
Akonadi::Tag::List tags;
const QStringList categories = contact.categories();
tags.reserve(categories.count());
foreach (const QString &category, categories) {
tags.append(Akonadi::Tag::fromUrl(QUrl(category)));
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:9,代码来源:categorieseditwidget.cpp
注:本文中的kcontacts::Addressee类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论