/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/am/ed/importcontacts/Importer.java

  • Committer: Tim Marston
  • Date: 2013-05-10 12:16:15 UTC
  • Revision ID: tim@ed.am-20130510121615-g8qhsu0h3t0ymrt6
Tags: 1.3.2
fix spacing in NEWS

Show diffs side-by-side

added added

removed removed

4
4
 * Copyright (C) 2009 to 2012 Tim Marston <tim@ed.am>
5
5
 *
6
6
 * This file is part of the Import Contacts program (hereafter referred
7
 
 * to as "this program").  For more information, see
 
7
 * to as "this program"). For more information, see
8
8
 * http://ed.am/dev/android/import-contacts
9
9
 *
10
10
 * This program is free software: you can redistribute it and/or modify
185
185
 
186
186
                        // if this is the first organisation added, or it's a preferred
187
187
                        // organisation and the current primary organisation isn't, then
188
 
                        // record this as the primary organisation
 
188
                        // record this as the primary organisation.
189
189
                        if( _primary_organisation == null ||
190
190
                                ( is_preferred && !_primary_organisation_is_preferred ) )
191
191
                        {
239
239
                        // and the current primary number isn't, or this number is on equal
240
240
                        // standing with the primary number in terms of preference and it is
241
241
                        // a voice number and the primary number isn't, then record this as
242
 
                        // the primary number
 
242
                        // the primary number.
243
243
                        if( _primary_number == null ||
244
244
                                ( is_preferred && !_primary_number_is_preferred ) ||
245
245
                                ( is_preferred == _primary_number_is_preferred &&
291
291
 
292
292
                        // if this is the first email added, or it's a preferred email and
293
293
                        // the current primary organisation isn't, then record this as the
294
 
                        // primary email
 
294
                        // primary email.
295
295
                        if( _primary_email == null ||
296
296
                                ( is_preferred && !_primary_email_is_preferred ) )
297
297
                        {
365
365
                protected void finalise()
366
366
                        throws ContactNotIdentifiableException
367
367
                {
368
 
                        // Ensure that if there is a primary number, it is preferred so
369
 
                        // that there is always one preferred number.  Android will assign
 
368
                        // ensure that if there is a primary number, it is preferred so
 
369
                        // that there is always one preferred number. Android will assign
370
370
                        // preference to one anyway so we might as well decide one sensibly.
371
371
                        if( _primary_number != null ) {
372
372
                                PreferredDetail data = _numbers.get( _primary_number );
627
627
        /**
628
628
         * Should we skip a contact, given whether it exists or not and the current
629
629
         * merge setting?  This routine handles throwing up a prompt, if required.
630
 
         *
631
630
         * @param contact_detail the display name of the contact
632
631
         * @param exists true if this contact matches one in the cache
633
632
         * @param merge_setting the merge setting to use
687
686
        {
688
687
                checkAbort();
689
688
 
690
 
                // It is expected that we use contact.getCacheIdentifier() here.  The
 
689
                // It is expected that we use contact.getCacheIdentifier() here. The
691
690
                // contact we are passed should have been successfully finalise()d,
692
691
                // which includes generating a valid cache identifier.
693
692
                ContactsCache.CacheIdentifier cache_identifier =
780
779
                        String number = i.next();
781
780
                        ContactData.PreferredDetail data = datas.get( number );
782
781
 
783
 
                        // We don't want to add this number if it's crap, or it already
784
 
                        // exists (which would cause a duplicate to be created).  We don't
785
 
                        // take in to account the type when checking for duplicates.  This
786
 
                        // is intentional: types aren't really very reliable.  We assume
787
 
                        // that if the number exists at all, it doesn't need importing.
788
 
                        // Because of this, we also can't update the cache (which we don't
789
 
                        // need to anyway, so it's not a problem).
 
782
                        // we don't want to add this number if it's crap, or it already
 
783
                        // exists (which would cause a duplicate to be created). We don't
 
784
                        // take in to account the type when checking for duplicates. This is
 
785
                        // intentional: types aren't really very reliable. We assume that
 
786
                        // if the number exists at all, it doesn't need importing. Because
 
787
                        // of this, we also can't update the cache (which we don't need to
 
788
                        // anyway, so it's not a problem).
790
789
                        if( _contacts_cache.hasAssociatedNumber( id, number ) )
791
790
                                continue;
792
791
 
811
810
                        ContactData.PreferredDetail data = datas.get( email );
812
811
 
813
812
                        // we don't want to add this email address if it exists already or
814
 
                        // we would introduce duplicates
 
813
                        // we would introduce duplicates.
815
814
                        if( _contacts_cache.hasAssociatedEmail( id, email ) )
816
815
                                continue;
817
816