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

Commit 12402fef authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Add VCardExporter functionality.

There is still no test. I'll work on cleaning up VCard related code in Eclair, so tests will be added at that time.

All configurations how file name is determined is configurable.
parent 2cc7c87b
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
@@ -33,4 +33,33 @@

    <!-- Flag indicating whether Contacts app is allowed to export contacts to SDCard -->
    <bool name="config_allow_export_to_sdcard">false</bool>

    <!-- The type of VCard for export. Without specifying this, generic VCard will be emitted.
     If you want to let the app emit VCard specific to some vendor (like DoCoMo),
     please specify the type.-->
    <string name="config_export_vcard_type"></string>

    <!-- Directory in which exported VCard file is stored -->
    <string name="config_export_dir">/sdcard</string>

    <!-- Prefix of exported VCard file -->
    <string name="config_export_file_prefix"></string>

    <!-- Suffix of exported VCard file. Attached before an extension -->
    <string name="config_export_file_suffix"></string>

    <!-- Extension for exported VCard files -->
    <string name="config_export_file_extension">vcf</string>

    <!-- Minimum number of exported VCard file index -->
    <integer name="config_export_file_min_index">1</integer>

    <!-- Maximum number of exported VCard file index -->
    <integer name="config_export_file_max_index">99999</integer>

    <!-- The list (separated by ',') of extensions should be checked in addition to
     config_export_extension. e.g. If "aaa" is added to here and 00001.vcf and 00002.aaa
     exist in a target directory, 00003.vcf becomes a next file name candidate.
     Without this configuration, 00002.vcf becomes the candidate.-->
    <string name="config_export_extensions_to_consider"></string>
</resources>
+3 −0
Original line number Diff line number Diff line
@@ -689,6 +689,9 @@
    <!-- The failed reason: "Too many vcard files on the SD Card" -->
    <string name="fail_reason_too_many_vcard">Too many VCard data on the SD Card</string>

    <!-- The failed reason: "Too long filename". This error usually does not happen. -->
    <string name="fail_reason_too_long_filename">Too long filename is required (\"<xliff:g id="filename">%s</xliff:g>\")</string>

    <!-- The failed reason: "Cannot open or create the destination directory" -->
    <string name="fail_reason_cannot_open_destination_dir">Cannot open or create the destination directory\"<xliff:g id="dir_name">%s</xliff:g>\"</string>

+4 −6
Original line number Diff line number Diff line
@@ -797,11 +797,10 @@ public final class ContactsListActivity extends ListActivity
        menu.add(0, MENU_IMPORT_CONTACTS, 0, R.string.importFromSim)
                .setIcon(R.drawable.ic_menu_import_contact);

        /* Temporarily commented out
        if (getResources().getBoolean(R.bool.config_allow_export_to_sdcard)) {
            menu.add(0, MENU_EXPORT_CONTACTS, 0, R.string.export_contact_list)
                    .setIcon(R.drawable.ic_menu_export_contact);
        }*/
        }

        return super.onCreateOptionsMenu(menu);
    }
@@ -884,8 +883,8 @@ public final class ContactsListActivity extends ListActivity
                }
                return true;

            /*case MENU_EXPORT_CONTACTS:
                handleExportContacts();*/
            case MENU_EXPORT_CONTACTS:
                handleExportContacts();
        }
        return false;
    }
@@ -902,11 +901,10 @@ public final class ContactsListActivity extends ListActivity
        startActivity(intent);
    }

    /*
    private void handleExportContacts() {
        VCardExporter exporter = new VCardExporter(ContactsListActivity.this, mHandler);
        exporter.startExportVCardToSdCard();
    }*/
    }
    
    @Override
    protected void onActivityResult(int requestCode, int resultCode,
+1674 −0

File added.

Preview size limit exceeded, changes collapsed.