/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-10-28 15:49:21 UTC
  • Revision ID: edam@waxworlds.org-20101028154921-98svlxlpno3cpzb8
- added file chooser
- changed file/dir entry box for a button that opens the file chooser
- added dialog to ask if you want to select a dir to scan or a file
- fixed bug where you could abort as dialog opened and the dialog wasn't cancelled
- fixed crash where you could abort as the merge prompt opened and it would try to use the just-destroyed importer
- fixed bug where closing the application at the end would show "aborted!" erroniously

Show diffs side-by-side

added added

removed removed

65
65
                try
66
66
                {
67
67
                        // open directory
68
 
                        String location = prefs.getString( "location", "" );
69
 
                        File dir = new File( location );
70
 
                        if( !dir.exists() )
 
68
                        String path = "/sdcard" + prefs.getString( "location", "/" );
 
69
                        File file = new File( path );
 
70
                        if( !file.exists() )
71
71
                                showError( R.string.error_locationnotfound );
72
72
 
73
73
                        // directory, or file?
74
 
                        if( dir.isDirectory() )
 
74
                        if( file.isDirectory() )
75
75
                        {
76
76
                                // get files
77
77
                                class VCardFilter implements FilenameFilter {
79
79
                                                return name.toLowerCase().endsWith( ".vcf" );
80
80
                                        }
81
81
                                }
82
 
                                files = dir.listFiles( new VCardFilter() );
 
82
                                files = file.listFiles( new VCardFilter() );
83
83
                        }
84
84
                        else
85
85
                        {
86
86
                                // use just this file
87
87
                                files = new File[ 1 ];
88
 
                                files[ 0 ] = dir;
 
88
                                files[ 0 ] = file;
89
89
                        }
90
90
                }
91
91
                catch( SecurityException e ) {