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

Make sure that we don't lose some data. When some server export as vcard3

they export all vcard4 variable too.
So export them too.

CCBUG: 365192
parent 166de982
......@@ -3,8 +3,9 @@ VERSION:3.0
FN:Test Tester
N:Tester;Test;;;
RELATED;TYPE=child;VALUE=text:Child Tester
item1.URL:http://www.example.com
item1.X-ABLABEL:random_label
TEL;TYPE=home:+1-800-123456
TEL;TYPE=HOME:+1-800-123456
UID:40f8971c-1d3a-466f-8cf5-55aad2021e1a
URL:http://www.example.com
X-ABLABEL-ABLABEL:random_label
END:VCARD
......@@ -235,6 +235,7 @@ void RelatedTest::shouldNotExportInVcard3()
"VERSION:3.0\r\n"
"EMAIL:foo@kde.org\r\n"
"N:;;;;\r\n"
"RELATED;FOO1=bla1,blo1;FOO2=bla2,blo2:friend\r\n"
"UID:testuid\r\n"
"END:VCARD\r\n\r\n");
QCOMPARE(ba, expected);
......
......@@ -153,11 +153,9 @@ void RoundtripTest::testVCardRoundtrip()
const QByteArray outputRefData = outputFile.readAll();
QCOMPARE(outputData.size(), outputRefData.size());
const QList<QByteArray> outputLines = outputData.split('\n');
const QList<QByteArray> outputRefLines = outputRefData.split('\n');
QCOMPARE(outputLines.count(), outputRefLines.count());
for (int i = 0; i < outputLines.count(); ++i) {
const QByteArray actual = outputLines[i];
const QByteArray expect = outputRefLines[i];
......
......@@ -15,6 +15,7 @@
<file>data/vcard12.vcf</file>
<file>data/vcard13.vcf</file>
<file>data/vcard14.vcf</file>
<file>data/vcard15.vcf</file>
</qresource>
<!-- output files formatted for vcard version 2.1 -->
......@@ -44,6 +45,7 @@
<file>data/vcard12.vcf.ref</file>
<file>data/vcard13.vcf.ref</file>
<file>data/vcard14.vcf.ref</file>
<file>data/vcard15.vcf.ref</file>
</qresource>
<!-- output files formatted for vcard version 4.0 -->
......
......@@ -221,19 +221,17 @@ QByteArray VCardTool::createVCards(const Addressee::List &list,
card.addLine(line);
}
if (version == VCard::v4_0) {
const Related::List relatedList = (*addrIt).relationShips();
Related::List::ConstIterator relatedIt;
Related::List::ConstIterator relatedEnd(relatedList.end());
for (relatedIt = relatedList.begin(); relatedIt != relatedEnd; ++relatedIt) {
VCardLine line(QStringLiteral("RELATED"), (*relatedIt).related());
QMapIterator<QString, QStringList> i((*relatedIt).parameters());
while (i.hasNext()) {
i.next();
line.addParameter(i.key(), i.value().join(QStringLiteral(",")));
}
card.addLine(line);
const Related::List relatedList = (*addrIt).relationShips();
Related::List::ConstIterator relatedIt;
Related::List::ConstIterator relatedEnd(relatedList.end());
for (relatedIt = relatedList.begin(); relatedIt != relatedEnd; ++relatedIt) {
VCardLine line(QStringLiteral("RELATED"), (*relatedIt).related());
QMapIterator<QString, QStringList> i((*relatedIt).parameters());
while (i.hasNext()) {
i.next();
line.addParameter(i.key(), i.value().join(QStringLiteral(",")));
}
card.addLine(line);
}
// CLASS only for version == 3.0
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