/android/import-contacts

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

« back to all changes in this revision

Viewing changes to src/org/waxworlds/edam/importcontacts/VcardImporter.java

  • Committer: edam
  • Date: 2011-05-30 14:04:51 UTC
  • Revision ID: edam@waxworlds.org-20110530140451-d99fy3zoi6zq1jf2
- renamed VCFImporter to VcardImporter and VCard to Vcard

Show diffs side-by-side

added added

removed removed

48
48
import android.provider.Contacts;
49
49
import android.provider.Contacts.PhonesColumns;
50
50
 
51
 
public class VCFImporter extends Importer
 
51
public class VcardImporter extends Importer
52
52
{
53
53
        private int _vcard_count = 0;
54
54
        private int _progress = 0;
55
55
 
56
 
        public VCFImporter( Doit doit )
 
56
        public VcardImporter( Doit doit )
57
57
        {
58
58
                super( doit );
59
59
        }
185
185
                throws AbortImportException
186
186
        {
187
187
                // go through lines
188
 
                VCard vcard = null;
 
188
                Vcard vcard = null;
189
189
                ContentLineIterator cli = new ContentLineIterator( content );
190
190
                while( cli.hasNext() )
191
191
                {
206
206
                                // look for vcard beginning
207
207
                                if( line.matches( "^BEGIN:VCARD" ) ) {
208
208
                                        setProgress( ++_progress );
209
 
                                        vcard = new VCard();
 
209
                                        vcard = new Vcard();
210
210
                                }
211
211
                        }
212
212
                        else {
218
218
                                                vcard.finaliseParsing();
219
219
                                                importContact( vcard );
220
220
                                        }
221
 
                                        catch( VCard.ParseException e ) {
 
221
                                        catch( Vcard.ParseException e ) {
222
222
                                                skipContact();
223
223
                                                if( !showContinue(
224
224
                                                        getText( R.string.error_vcf_parse ).toString()
227
227
                                                        finish( ACTION_ABORT );
228
228
                                                }
229
229
                                        }
230
 
                                        catch( VCard.SkipContactException e ) {
 
230
                                        catch( Vcard.SkipContactException e ) {
231
231
                                                skipContact();
232
232
                                                // do nothing
233
233
                                        }
240
240
                                                vcard.parseLine( buffer, line,
241
241
                                                        cli.doesNextLineLookFolded() );
242
242
                                        }
243
 
                                        catch( VCard.ParseException e ) {
 
243
                                        catch( Vcard.ParseException e ) {
244
244
                                                skipContact();
245
245
                                                if( !showContinue(
246
246
                                                        getText( R.string.error_vcf_parse ).toString()
254
254
                                                // get to another BEGIN:VCARD line.
255
255
                                                vcard = null;
256
256
                                        }
257
 
                                        catch( VCard.SkipContactException e ) {
 
257
                                        catch( Vcard.SkipContactException e ) {
258
258
                                                skipContact();
259
259
                                                // abort this vCard. Further lines will be ignored until
260
260
                                                // we get to another BEGIN:VCARD line.
328
328
                }
329
329
        }
330
330
 
331
 
        private class VCard extends ContactData
 
331
        private class Vcard extends ContactData
332
332
        {
333
333
                private final static int NAMELEVEL_NONE = 0;
334
334
                private final static int NAMELEVEL_FN = 1;
382
382
 
383
383
                        public ParseException( int res )
384
384
                        {
385
 
                                super( VCFImporter.this.getText( res ).toString() );
 
385
                                super( VcardImporter.this.getText( res ).toString() );
386
386
                        }
387
387
                }
388
388