本文整理汇总了C++中kcontacts::Addressee类的典型用法代码示例。如果您正苦于以下问题:C++ Addressee类的具体用法?C++ Addressee怎么用?C++ Addressee使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Addressee类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例3: storeContact
void ImageWidget::storeContact(KContacts::Addressee &contact) const
{
if (mType == Photo) {
contact.setPhoto(mPicture);
} else {
contact.setLogo(mPicture);
}
}
示例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"));
}
示例5: emptyTest
void AddresseeTest::emptyTest()
{
KContacts::Addressee addressee;
QVERIFY(addressee.isEmpty());
KContacts::Addressee addresseeWithMail;
addresseeWithMail.insertEmail(QStringLiteral("[email protected]"));
QVERIFY(!addresseeWithMail.isEmpty());
}
示例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]>"));
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}