equal
deleted
inserted
replaced
956 |
956 |
957 if ( index > KErrNotFound ) |
957 if ( index > KErrNotFound ) |
958 { |
958 { |
959 // Loop through the rest of the contacts of the subview |
959 // Loop through the rest of the contacts of the subview |
960 // and modify their global contact mapping information |
960 // and modify their global contact mapping information |
961 for (TInt i = index; i < iContactMapping.Count(); ++i) |
961 for (TInt i = 0; i < iContactMapping.Count(); ++i ) |
962 { |
962 { |
963 if (iContactMapping[i].iViewIndex == subViewIndex) |
963 // Adjust the iContactIndex in the same view except the deleted one. |
|
964 if ( ( iContactMapping[i].iViewIndex == subViewIndex ) |
|
965 && ( iContactMapping[i].iContactIndex >= aIndex ) |
|
966 && ( i != index ) ) |
964 { |
967 { |
965 // Subtract one because one contact was deleted |
968 // Subtract one because one contact was deleted, the index |
966 // from the list before the current index |
969 // from the list which is bigger than the deleted one needs to be adjusted. |
967 --iContactMapping[i].iContactIndex; |
970 --iContactMapping[i].iContactIndex; |
968 } |
971 } |
969 } |
972 } |
970 // Finally remove the deleted index from global mapping |
973 // Finally remove the deleted index from global mapping |
971 iContactMapping.Remove( index ); |
974 iContactMapping.Remove( index ); |
997 if (err != KErrNone) |
1000 if (err != KErrNone) |
998 { |
1001 { |
999 index = err; |
1002 index = err; |
1000 } |
1003 } |
1001 else |
1004 else |
1002 { |
1005 { |
1003 // We have to fix the indexes of all the succeeding |
1006 // We have to fix the indexes of all the succeeding |
1004 // contacts in the view where the contact addition took place |
1007 // contacts in the view where the contact addition took place |
1005 for ( TInt i = index + 1; i < iContactMapping.Count(); ++i ) |
1008 for ( TInt i = 0; i < iContactMapping.Count(); ++i ) |
1006 { |
1009 { |
1007 if (iContactMapping[i].iViewIndex == subViewIndex) |
1010 // Adjust the iContactIndex in the same view except the added one. |
|
1011 if ( ( iContactMapping[i].iViewIndex == subViewIndex ) |
|
1012 && ( iContactMapping[i].iContactIndex >= aIndex ) |
|
1013 && ( i != index ) ) |
1008 { |
1014 { |
|
1015 // plus one because one contact was added, the index |
|
1016 // from the list which is bigger than the deleted one needs to be adjusted. |
1009 ++iContactMapping[i].iContactIndex; |
1017 ++iContactMapping[i].iContactIndex; |
1010 } |
1018 } |
1011 } |
1019 } |
1012 } |
1020 } |
1013 } |
1021 } |