src/xcardconversions.h tests/bindingstest.cpp

Christian Mollekopf mollekopf at kolabsys.com
Mon May 20 15:52:35 CEST 2013


 src/xcardconversions.h |    6 ++++--
 tests/bindingstest.cpp |    3 ++-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit c17d24338b5960b77614a46d4e95c9a29b9d6e25
Author: Christian Mollekopf <mollekopf at kolabsys.com>
Date:   Mon May 20 15:52:25 2013 +0200

    Also store preferred parameter if there is no type.

diff --git a/src/xcardconversions.h b/src/xcardconversions.h
index ffd7804..4919382 100644
--- a/src/xcardconversions.h
+++ b/src/xcardconversions.h
@@ -682,13 +682,15 @@ void writeCard<Kolab::Contact>(vcard_4_0::vcard &vcard, const Kolab::Contact &co
                 emailTypeParam.text().push_back(TypeValueType::work);
             } 
             vcard::tel_type::parameters_type params;
+            if (!emailTypeParam.text().empty()) {
+                params.baseParameter().push_back(emailTypeParam);
+            }
             if(contact.emailAddressPreferredIndex() == index) {
                 params.baseParameter().push_back(vcard_4_0::prefParamType(vcard_4_0::prefParamType::integer_default_value()));
             }
             index++;
 
-            if (!emailTypeParam.text().empty()) {
-                params.baseParameter().push_back(emailTypeParam);
+            if (!params.baseParameter().empty()) {
                 email.parameters(params);
             }
             seq.push_back(email);
diff --git a/tests/bindingstest.cpp b/tests/bindingstest.cpp
index 04a748c..c0a63c0 100644
--- a/tests/bindingstest.cpp
+++ b/tests/bindingstest.cpp
@@ -570,7 +570,7 @@ void BindingsTest::contactCompletness()
     emails.push_back(Kolab::Email("email1 at example.org", Kolab::Email::NoType));
     emails.push_back(Kolab::Email("email2 at example.org", Kolab::Email::Work));
     emails.push_back(Kolab::Email("email3 at example.org", Kolab::Email::Work|Kolab::Email::Home));
-    c.setEmailAddresses(emails,1);
+    c.setEmailAddresses(emails,0);
     c.setTitles(stringlist);
     
     std::vector<Kolab::Affiliation> list;
@@ -676,6 +676,7 @@ void BindingsTest::contactCompletness()
     QCOMPARE(e.imAddressPreferredIndex(), c.imAddressPreferredIndex());
     QCOMPARE(e.emailAddresses(), c.emailAddresses());
     QCOMPARE(e.emailAddressPreferredIndex(), c.emailAddressPreferredIndex());
+    QCOMPARE(e.emailAddressPreferredIndex(), 0);
     QCOMPARE(e.gpsPos(), c.gpsPos());
     QCOMPARE(e.keys(), c.keys());
     QCOMPARE(e.crypto(), c.crypto());





More information about the commits mailing list