Changeset 902 for apps/iphone/superbook/trunk/Classes
- Timestamp:
- 09/16/11 16:55:43 (20 months ago)
- Location:
- apps/iphone/superbook/trunk/Classes
- Files:
-
- 3 modified
-
FriendsData.h (modified) (1 diff)
-
FriendsData.m (modified) (1 diff)
-
LocateThem_ViewController.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
apps/iphone/superbook/trunk/Classes/FriendsData.h
r885 r902 80 80 - (NSNumber *) getABRecordIdForTel:(NSString *)telname; 81 81 - (ABRecordRef)getABRecordRefForABRecordId:(NSNumber *)theId withAddressBook:(ABRecordRef)theBook; 82 - (NSString *)getTelForABRecordId:(NSNumber *)theId withABRecordRef:(ABRecordRef)recordRef; 82 - (NSString *) getTelForABRecordId:(NSNumber *)theId withABRecordRef:(ABRecordRef)recordRef; 83 - (void)removeTelAtIndexPath:(NSIndexPath *)indexPath; 83 84 - (NSInteger)getTelIndexForABRecordId:(NSNumber *)theId withABRecordRef:(ABRecordRef)recordRef; 84 85 -
apps/iphone/superbook/trunk/Classes/FriendsData.m
r883 r902 280 280 } 281 281 282 - (void)removeTelAtIndexPath:(NSIndexPath *)indexPath { 283 ABMultiValueRef allUrls; 284 BOOL foundUrl = NO; 285 NSNumber *thePersonId = [sortedPeopleArray objectAtIndex:indexPath.row]; 286 ABRecordRef recordRef = ABAddressBookGetPersonWithRecordID(book, (ABRecordID)[thePersonId intValue]); 287 allUrls = ABRecordCopyValue(recordRef, kABPersonURLProperty); 288 CFRelease(allUrls); 289 ABMutableMultiValueRef allUrlsMutable = ABMultiValueCreateMutableCopy(allUrls); 290 CFStringRef telUrl; 291 for (CFIndex j = 0; j < ABMultiValueGetCount(allUrlsMutable); j++) { 292 telUrl = ABMultiValueCopyValueAtIndex(allUrlsMutable, j); 293 if ([(NSString *)telUrl hasSuffix:@".tel"]) { 294 foundUrl = YES; 295 } 296 if ([(NSString *)telUrl hasSuffix:@".tel/"]) { 297 foundUrl = YES; 298 } 299 if (foundUrl) { 300 ABMultiValueRemoveValueAndLabelAtIndex(allUrlsMutable, j); 301 NSError *err = nil; 302 ABRecordSetValue(recordRef, kABPersonURLProperty, allUrlsMutable, (CFErrorRef *)&err); 303 ABAddressBookSave(book, (CFErrorRef *)&err); 304 [peopleCurrentList removeObjectForKey:thePersonId]; 305 self.sortedPeopleArray = [peopleCurrentList keysSortedByValueUsingSelector:@selector(compositeNameSortAlgorithm:)]; 306 if (self.delegate) 307 [self.delegate friendsDataDidLoad]; 308 break; 309 } 310 CFRelease(telUrl); 311 // CFRelease(recordRef); 312 } 313 } 314 282 315 // Get .tel ABMultiValue index for a record 283 316 // given any url that ends with .tel -
apps/iphone/superbook/trunk/Classes/LocateThem_ViewController.m
r899 r902 480 480 481 481 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { 482 if (indexPath.section == LTSectionVisited) 483 return YES; 484 return NO; 482 return YES; 485 483 } 486 484 487 485 - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { 488 NSInteger maxRows = [domainsLastVisited numberOfCachedLookups]; 489 if ((indexPath.row == lastVisitedRowCount) && (lastVisitedRowCount < maxRows)) { 490 return UITableViewCellEditingStyleNone; // See More row 486 if (indexPath.section == LTSectionVisited) { 487 NSInteger maxRows = [domainsLastVisited numberOfCachedLookups]; 488 if ((indexPath.row == lastVisitedRowCount) && (lastVisitedRowCount < maxRows)) { 489 return UITableViewCellEditingStyleNone; // See More row 490 } 491 491 } 492 492 return UITableViewCellEditingStyleDelete; … … 494 494 495 495 - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { 496 if ([domainsLastVisited deleteCachedDataForRow:[indexPath row]]) { 497 lastVisitedRowCount--; 498 [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 499 if ([tableView numberOfRowsInSection:indexPath.section] == 0) { 500 [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; 501 } 496 [tableView beginUpdates]; 497 if (indexPath.section == LTSectionVisited) { 498 if ([domainsLastVisited deleteCachedDataForRow:[indexPath row]]) { 499 lastVisitedRowCount--; 500 } 501 } else if (indexPath.section == LTSectionContacts) { 502 [[FriendsData sharedInstance] removeTelAtIndexPath:indexPath]; 503 } 504 [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; 505 [tableView endUpdates]; 506 if ([tableView numberOfRowsInSection:indexPath.section] == 0) { 507 [tableView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationNone]; 502 508 } 503 509 }








