Commit 1e81a529 authored by Erik Quaeghebeur's avatar Erik Quaeghebeur
Browse files

cleanup of relation/related correspondence

https://forums.bitfire.at/topic/1151
parent e6798f6c
......@@ -553,35 +553,38 @@ public class AndroidContact {
if (row.containsKey(Relation.TYPE))
switch (row.getAsInteger(Relation.TYPE)) {
case Relation.TYPE_ASSISTANT:
case Relation.TYPE_MANAGER:
case Relation.TYPE_ASSISTANT: // leads to information loss
case Relation.TYPE_MANAGER: // leads to information loss
related.getTypes().add(RelatedType.CO_WORKER);
break;
case Relation.TYPE_BROTHER:
case Relation.TYPE_SISTER:
case Relation.TYPE_BROTHER: // leads to information loss
case Relation.TYPE_SISTER: // leads to information loss
related.getTypes().add(RelatedType.SIBLING);
break;
case Relation.TYPE_CHILD:
related.getTypes().add(RelatedType.CHILD);
break;
case Relation.TYPE_DOMESTIC_PARTNER:
related.getTypes().add(RelatedType.CO_RESIDENT);
break;
case Relation.TYPE_FRIEND:
related.getTypes().add(RelatedType.FRIEND);
break;
case Relation.TYPE_FATHER:
case Relation.TYPE_MOTHER:
case Relation.TYPE_FATHER: // leads to information loss
case Relation.TYPE_MOTHER: // leads to information loss
case Relation.TYPE_PARENT:
related.getTypes().add(RelatedType.PARENT);
break;
case Relation.TYPE_PARTNER:
case Relation.TYPE_SPOUSE:
related.getTypes().add(RelatedType.SWEETHEART);
related.getTypes().add(RelatedType.SPOUSE);
break;
case Relation.TYPE_RELATIVE:
related.getTypes().add(RelatedType.KIN);
break;
case Relation.TYPE_REFERRED_BY:
// there is no corresponding RELATION value in VCARD
break;
case Relation.TYPE_PARTNER:
case Relation.TYPE_DOMESTIC_PARTNER:
// there is no good unique corresponding RELATION value in VCARD
break;
}
contact.relations.add(related);
......@@ -1217,17 +1220,20 @@ public class AndroidContact {
for (RelatedType type : related.getTypes()) {
if (type == RelatedType.CHILD)
typeCode = Relation.TYPE_CHILD;
else if (type == RelatedType.CO_RESIDENT)
typeCode = Relation.TYPE_DOMESTIC_PARTNER;
else if (type == RelatedType.CRUSH || type == RelatedType.DATE || type == RelatedType.SPOUSE || type == RelatedType.SWEETHEART)
typeCode = Relation.TYPE_PARTNER;
else if (type == RelatedType.FRIEND)
typeCode = Relation.TYPE_FRIEND;
else if (type == RelatedType.KIN)
typeCode = Relation.TYPE_RELATIVE;
else if (type == RelatedType.PARENT)
typeCode = Relation.TYPE_PARENT;
else if (type == RelatedType.SPOUSE)
typeCode = Relation.TYPE_SPOUSE;
else
// There are many other RELATION types in VCARD, they do not
// have a good (unique) correspondence in Android:
// contact, acquaintance, met, co-worker, colleague,
// co-resident, neighbor, sibling, muse, crush, date,
// sweetheart, me, agent, emergency
labels.add(type.getValue());
}
......
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