aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-07-08 08:33:43 +0200
committerMontel Laurent <[email protected]>2016-07-08 08:33:43 +0200
commitee98321a1f4ab94726c734fd508bcd54e4fc9c68 (patch)
tree7e7d51b0cef46eedfdc40f9eef7f978f79d30498
parent166de982de7d977dfdc10262e63fe2c910943502 (diff)
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
-rw-r--r--autotests/data/vcard15.vcf.ref7
-rw-r--r--autotests/relatedtest.cpp1
-rw-r--r--autotests/testroundtrip.cpp2
-rw-r--r--autotests/testroundtrip.qrc2
-rw-r--r--src/vcardtool.cpp22
5 files changed, 17 insertions, 17 deletions
diff --git a/autotests/data/vcard15.vcf.ref b/autotests/data/vcard15.vcf.ref
index 7fa66c1..e305dd4 100644
--- a/autotests/data/vcard15.vcf.ref
+++ b/autotests/data/vcard15.vcf.ref
@@ -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
+
diff --git a/autotests/relatedtest.cpp b/autotests/relatedtest.cpp
index 0ff8032..fbc7b8b 100644
--- a/autotests/relatedtest.cpp
+++ b/autotests/relatedtest.cpp
@@ -235,6 +235,7 @@ void RelatedTest::shouldNotExportInVcard3()
"VERSION:3.0\r\n"
"EMAIL:[email protected]\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);
diff --git a/autotests/testroundtrip.cpp b/autotests/testroundtrip.cpp
index 55ec1a9..90639aa 100644
--- a/autotests/testroundtrip.cpp
+++ b/autotests/testroundtrip.cpp
@@ -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];
diff --git a/autotests/testroundtrip.qrc b/autotests/testroundtrip.qrc
index fdb4844..0887c25 100644
--- a/autotests/testroundtrip.qrc
+++ b/autotests/testroundtrip.qrc
@@ -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 -->
diff --git a/src/vcardtool.cpp b/src/vcardtool.cpp
index f0156ba..fd254f1 100644
--- a/src/vcardtool.cpp
+++ b/src/vcardtool.cpp
@@ -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) {