/android/export-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/export-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/exportcontacts/ContactsBackend.java

  • Committer: edam
  • Date: 2012-12-21 13:26:31 UTC
  • Revision ID: tim@ed.am-20121221132631-ofj30d60lvuxp4a3
added ContactsContract backend; removed references to Contacts types (conversion to/from backend types now done in backends); added support for exporting NOTEs

Show diffs side-by-side

added added

removed removed

1
1
/*
2
2
 * ContactsContactAccessor.java
3
3
 *
4
 
 * Copyright (C) 2011 to 2012 Tim Marston <tim@ed.am>
 
4
 * Copyright (C) 2011 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Export Contacts program (hereafter referred
7
7
 * to as "this program"). For more information, see
58
58
                {
59
59
                        switch( type )
60
60
                        {
61
 
                        case Contacts.PhonesColumns.TYPE_MOBILE:
 
61
                        case Contacts.Phones.TYPE_MOBILE:
62
62
                                return ContactData.TYPE_MOBILE;
63
 
                        case Contacts.PhonesColumns.TYPE_FAX_HOME:
 
63
                        case Contacts.Phones.TYPE_FAX_HOME:
64
64
                                return ContactData.TYPE_FAX_HOME;
65
 
                        case Contacts.PhonesColumns.TYPE_FAX_WORK:
 
65
                        case Contacts.Phones.TYPE_FAX_WORK:
66
66
                                return ContactData.TYPE_FAX_WORK;
67
 
                        case Contacts.PhonesColumns.TYPE_PAGER:
 
67
                        case Contacts.Phones.TYPE_PAGER:
68
68
                                return ContactData.TYPE_PAGER;
69
 
                        case Contacts.PhonesColumns.TYPE_WORK:
 
69
                        case Contacts.Phones.TYPE_WORK:
70
70
                                return ContactData.TYPE_WORK;
71
71
                        default:
72
72
                                return ContactData.TYPE_HOME;
76
76
                {
77
77
                        switch( type )
78
78
                        {
79
 
                        case Contacts.ContactMethodsColumns.TYPE_WORK:
 
79
                        case Contacts.Phones.TYPE_WORK:
80
80
                                return ContactData.TYPE_WORK;
81
81
                        default:
82
82
                                return ContactData.TYPE_HOME;
115
115
                        _cur.getString( _cur.getColumnIndex( Contacts.People.NAME ) ) );
116
116
 
117
117
                // add notes
118
 
                String note = _cur.getString(
119
 
                        _cur.getColumnIndex( Contacts.People.NOTES ) );
120
 
                if( note != null && note.length() > 0 )
121
 
                        contact.addNote( note );
 
118
                contact.addNote(
 
119
                        _cur.getString( _cur.getColumnIndex( Contacts.People.NOTES ) ) );
122
120
 
123
121
                // add the organisations
124
122
                Cursor cur = _activity.managedQuery( Contacts.Organizations.CONTENT_URI,