Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c6770c2 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Add the flag "FLAG_APPEND_TYPE_PARAM" to VCardConfig, which

enables vCard composer to append "TYPE=" to type param/attribute
everytime possible, which should fix the issue 2180800.

issue number: 2180800
parent d48e25d4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -288,6 +288,7 @@ public class VCardComposer {
    private final boolean mUsesUtf8;
    private final boolean mUsesShiftJis;
    private final boolean mUsesQPToPrimaryProperties;
    private final boolean mAppendTypeParamName;

    private Cursor mCursor;
    private int mIdColumn;
@@ -353,6 +354,7 @@ public class VCardComposer {
        mUsesUtf8 = VCardConfig.usesUtf8(vcardType);
        mUsesShiftJis = VCardConfig.usesShiftJis(vcardType);
        mUsesQPToPrimaryProperties = VCardConfig.usesQPToPrimaryProperties(vcardType);
        mAppendTypeParamName = VCardConfig.appendTypeParamName(vcardType);
        mHandlerList = new ArrayList<OneEntryHandler>();

        if (mIsDoCoMo) {
@@ -1756,7 +1758,7 @@ public class VCardComposer {

    private void appendTypeAttribute(final StringBuilder builder, final String type) {
        // Note: In vCard 3.0, Type strings also can be like this: "TYPE=HOME,PREF"
        if (mIsV30) {
        if (mIsV30 || mAppendTypeParamName) {
            builder.append(Constants.ATTR_TYPE).append(VCARD_ATTR_EQUAL);
        }
        builder.append(type);
+19 −0
Original line number Diff line number Diff line
@@ -106,6 +106,21 @@ public class VCardConfig {
     */
    public static final int FLAG_USE_QP_TO_PRIMARY_PROPERTIES = 0x10000000;

    /**
     * The flag indicating the vCard composer "for 2.1" emits "TYPE=" string every time
     * possible. The default behavior does not emit it and is valid, while adding "TYPE="
     * is also valid. In vCrad 3.0, this flag is unnecessary, since "TYPE=" is MUST in
     * vCard 3.0 specification.
     *
     * If you are targeting to some importer which cannot accept type attributes (params)
     * without "TYPE=" string (which should be rare though), please use this flag.
     *
     * XXX: Really rare?
     *
     * e.g. int vcardType = (VCARD_TYPE_V21_GENERIC | FLAG_APPEND_TYPE_PARAM);
     */
    public static final int FLAG_APPEND_TYPE_PARAM = 0x08000000;

    //// The followings are VCard types available from importer/exporter. ////

    /**
@@ -300,6 +315,10 @@ public class VCardConfig {
               ((vcardType & FLAG_USE_QP_TO_PRIMARY_PROPERTIES) != 0));
    }

    public static boolean appendTypeParamName(int vcardType) {
        return (vcardType & FLAG_APPEND_TYPE_PARAM) != 0;
    }

    private VCardConfig() {
    }
}
 No newline at end of file