本文整理汇总了C++中kcontacts::Addressee::insertCalendarUrl方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::insertCalendarUrl方法的具体用法?C++ Addressee::insertCalendarUrl怎么用?C++ Addressee::insertCalendarUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kcontacts::Addressee
的用法示例。
在下文中一共展示了Addressee::insertCalendarUrl方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: shouldGenerateVCard
void CalendarUrlTest::shouldGenerateVCard()
{
QFETCH(KContacts::CalendarUrl::CalendarType, type);
QFETCH(QByteArray, value);
KContacts::AddresseeList lst;
KContacts::Addressee addr;
addr.setEmails(QStringList() << QStringLiteral("[email protected]"));
addr.setUid(QStringLiteral("testuid"));
CalendarUrl url;
url.setType(type);
url.setUrl(QUrl(QStringLiteral("https://sherlockholmes.com/calendar/sherlockholmes")));
addr.insertCalendarUrl(url);
lst << addr;
KContacts::VCardTool vcard;
const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v4_0);
QByteArray expected;
// Different order
if (type == KContacts::CalendarUrl::FBUrl) {
expected = QByteArray("BEGIN:VCARD\r\n"
"VERSION:4.0\r\n"
"EMAIL:[email protected]\r\n");
expected += value + QByteArray(":https://sherlockholmes.com/calendar/sherlockholmes\r\n"
"N:;;;;\r\n"
"UID:testuid\r\n"
"END:VCARD\r\n\r\n");
} else {
expected = QByteArray("BEGIN:VCARD\r\n"
"VERSION:4.0\r\n");
expected += value + QByteArray(":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);
}