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

Commit fc423b40 authored by Brian Attwell's avatar Brian Attwell
Browse files

Copy display name into Organization entry

For corporate directory lookup entries, don't copy the organization name
into a structured name field. Instead, copy it into the organization field.
This way, we will still be able to guess that the contact represents an
organization.

Bug: 17309754
Change-Id: Ibdaa12e8ca357b6935a879f8875bab5785d83f43
parent d9ce069a
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -2283,12 +2283,23 @@ public class QuickContactActivity extends ContactsActivity {
                    final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
                    intent.setType(Contacts.CONTENT_ITEM_TYPE);

                    // Only pre-fill the name field if the provided display name is an organization
                    // name or better (e.g. structured name, nickname)
                    if (mContactData.getDisplayNameSource() >= DisplayNameSources.ORGANIZATION) {
                    ArrayList<ContentValues> values = mContactData.getContentValues();

                    // Only pre-fill the name field if the provided display name is an nickname
                    // or better (e.g. structured name, nickname)
                    if (mContactData.getDisplayNameSource() >= DisplayNameSources.NICKNAME) {
                        intent.putExtra(Intents.Insert.NAME, mContactData.getDisplayName());
                    } else if (mContactData.getDisplayNameSource()
                            == DisplayNameSources.ORGANIZATION) {
                        // This is probably an organization. Instead of copying the organization
                        // name into a name entry, copy it into the organization entry. This
                        // way we will still consider the contact an organization.
                        final ContentValues organization = new ContentValues();
                        organization.put(Organization.COMPANY, mContactData.getDisplayName());
                        organization.put(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE);
                        values.add(organization);
                    }
                    ArrayList<ContentValues> values = mContactData.getContentValues();

                    // Last time used and times used are aggregated values from the usage stat
                    // table. They need to be removed from data values so the SQL table can insert
                    // properly