/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/VCFImporter.java

  • Committer: edam
  • Date: 2010-07-13 19:13:38 UTC
  • Revision ID: edam@waxworlds.org-20100713191338-e23wre83uellvtt4
Tags: 1.0
- updated NEWS, TODO and manifest

Show diffs side-by-side

added added

removed removed

67
67
                        // open directory
68
68
                        String location = prefs.getString( "location", "" );
69
69
                        File dir = new File( location );
70
 
                        if( !dir.exists() || !dir.isDirectory() )
 
70
                        if( !dir.exists() )
71
71
                                showError( R.string.error_locationnotfound );
72
72
 
73
 
                        // get files
74
 
                        class VCardFilter implements FilenameFilter {
75
 
                                public boolean accept( File dir, String name ) {
76
 
                                        return name.toLowerCase().endsWith( ".vcf" );
 
73
                        // directory, or file?
 
74
                        if( dir.isDirectory() )
 
75
                        {
 
76
                                // get files
 
77
                                class VCardFilter implements FilenameFilter {
 
78
                                        public boolean accept( File dir, String name ) {
 
79
                                                return name.toLowerCase().endsWith( ".vcf" );
 
80
                                        }
77
81
                                }
78
 
                        }
79
 
                        files = dir.listFiles( new VCardFilter() );
 
82
                                files = dir.listFiles( new VCardFilter() );
 
83
                        }
 
84
                        else
 
85
                        {
 
86
                                // use just this file
 
87
                                files = new File[ 1 ];
 
88
                                files[ 0 ] = dir;
 
89
                        }
80
90
                }
81
91
                catch( SecurityException e ) {
82
92
                        showError( R.string.error_locationpermissions );
451
461
                                        !charset.equals( "UTF-8" ) && !charset.equals( "UTF-16" ) )
452
462
                                throw new ParseException( R.string.error_vcf_charset );
453
463
                        if( ( encoding = checkParam( params, "ENCODING" ) ) != null &&
454
 
                                        !encoding.equals( "QUOTED-PRINTABLE" ) )
 
464
                                        !encoding.equals( "QUOTED-PRINTABLE" ) &&
 
465
                                        !encoding.equals( "8BIT" ) ) //&& !encoding.equals( "BASE64" ) )
455
466
                                throw new ParseException( R.string.error_vcf_encoding );
456
467
 
457
468
                        // do decoding?
458
469
                        if( encoding != null && encoding.equals( "QUOTED-PRINTABLE" ) )
459
470
                                return unencodeQuotedPrintable( value, charset );
 
471
//                      if( encoding != null && encoding.equals( "BASE64" ) )
 
472
//                              return unencodeBase64( value, charset );
460
473
 
461
474
                        // nothing to do!
462
475
                        return value;