Commit bb8c34de authored by Laurent Montel's avatar Laurent Montel 😁

Improve autotest

parent f6315bf1
......@@ -103,7 +103,6 @@ void RoleTest::shouldEqualRole()
result = role;
QVERIFY(role == result);
}
#if 0
void RoleTest::shouldParseRole()
{
......@@ -162,6 +161,7 @@ void RoleTest::shouldCreateVCard()
QCOMPARE(ba, expected);
}
void RoleTest::shouldCreateVCardWithTwoRole()
{
KContacts::AddresseeList lst;
......@@ -188,7 +188,7 @@ void RoleTest::shouldCreateVCardWithTwoRole()
QCOMPARE(ba, expected);
}
#if 0
void RoleTest::shouldCreateVCardWithParameters()
{
KContacts::AddresseeList lst;
......
......@@ -35,11 +35,11 @@ private Q_SLOTS:
void shouldAssignExternal();
void shouldSerialized();
void shouldEqualRole();
#if 0
void shouldParseRole();
void shouldParseWithoutRole();
void shouldCreateVCard();
void shouldCreateVCardWithTwoRole();
#if 0
void shouldCreateVCardWithParameters();
void shouldGenerateRoleForVCard3();
#endif
......
......@@ -431,12 +431,19 @@ QByteArray VCardTool::createVCards(const Addressee::List &list,
card.addLine(VCardLine(QStringLiteral("REV"), createDateTime((*addrIt).revision(), version)));
// ROLE
VCardLine roleLine(QStringLiteral("ROLE"), (*addrIt).role());
if (version == VCard::v2_1 && needsEncoding((*addrIt).role())) {
roleLine.addParameter(QStringLiteral("charset"), QStringLiteral("UTF-8"));
roleLine.addParameter(QStringLiteral("encoding"), QStringLiteral("QUOTED-PRINTABLE"));
Q_FOREACH (const Role &role, (*addrIt).extraRoleList()) {
VCardLine roleLine(QStringLiteral("ROLE"), role.role());
if (version == VCard::v2_1 && needsEncoding(role.role())) {
roleLine.addParameter(QStringLiteral("charset"), QStringLiteral("UTF-8"));
roleLine.addParameter(QStringLiteral("encoding"), QStringLiteral("QUOTED-PRINTABLE"));
}
QMapIterator<QString, QStringList> i(role.parameters());
while (i.hasNext()) {
i.next();
roleLine.addParameter(i.key(), i.value().join(QLatin1Char(',')));
}
card.addLine(roleLine);
}
card.addLine(roleLine);
// SORT-STRING
if (version == VCard::v3_0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment