diff --git a/Classes/ContactDetailsTableView.h b/Classes/ContactDetailsTableView.h index b5095d74e..a78f51499 100644 --- a/Classes/ContactDetailsTableView.h +++ b/Classes/ContactDetailsTableView.h @@ -24,7 +24,9 @@ #import "ContactDetailsLabelView.h" typedef enum _ContactSections { - ContactSections_None = 0, + ContactSections_None = -1, + ContactSections_First_Name, + ContactSections_Last_Name, ContactSections_Number, ContactSections_Sip, ContactSections_Email, diff --git a/Classes/ContactDetailsTableView.m b/Classes/ContactDetailsTableView.m index 1720d1141..75c1ffcda 100644 --- a/Classes/ContactDetailsTableView.m +++ b/Classes/ContactDetailsTableView.m @@ -49,8 +49,9 @@ @implementation ContactDetailsTableView -static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSections_None, ContactSections_Number, - ContactSections_Sip, ContactSections_Email}; +static const ContactSections_e contactSections[ContactSections_MAX] = { + ContactSections_First_Name, ContactSections_Last_Name, ContactSections_Number, ContactSections_Sip, + ContactSections_Email}; @synthesize contactDetailsDelegate; @synthesize contact; @@ -118,6 +119,10 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe - (ABPropertyID)propertyIDForSection:(ContactSections_e)section { switch (section) { + case ContactSections_First_Name: + return kABPersonFirstNameProperty; + case ContactSections_Last_Name: + return kABPersonLastNameProperty; case ContactSections_Sip: return kABPersonInstantMessageProperty; case ContactSections_Number: @@ -479,7 +484,12 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [[self getSectionData:section] count]; + if (contactSections[section] == ContactSections_First_Name || + contactSections[section] == ContactSections_Last_Name) { + return 1; + } else { + return [[self getSectionData:section] count]; + } } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -500,7 +510,15 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe // default label is our app name NSString *label = [FastAddressBook localizedLabel:[labelArray objectAtIndex:0]]; - if (contactSections[[indexPath section]] == ContactSections_Number) { + if (contactSections[[indexPath section]] == ContactSections_First_Name) { + value = + (__bridge NSString *)(ABRecordCopyValue(contact, [self propertyIDForSection:ContactSections_First_Name])); + label = nil; + } else if (contactSections[[indexPath section]] == ContactSections_Last_Name) { + value = + (__bridge NSString *)(ABRecordCopyValue(contact, [self propertyIDForSection:ContactSections_Last_Name])); + label = nil; + } else if (contactSections[[indexPath section]] == ContactSections_Number) { ABMultiValueRef lMap = ABRecordCopyValue(contact, kABPersonPhoneProperty); NSInteger index = ABMultiValueGetIndexForIdentifier(lMap, [entry identifier]); NSString *labelRef = CFBridgingRelease(ABMultiValueCopyLabelAtIndex(lMap, index)); @@ -693,6 +711,9 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { + if (indexPath.section == ContactSections_First_Name || indexPath.section == ContactSections_Last_Name) { + return UITableViewCellEditingStyleNone; + } NSInteger last_index = [[self getSectionData:[indexPath section]] count] - 1; if (indexPath.row == last_index) { return UITableViewCellEditingStyleInsert; @@ -701,6 +722,11 @@ static const ContactSections_e contactSections[ContactSections_MAX] = {ContactSe } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { + if (contactSections[section] == ContactSections_First_Name) { + return NSLocalizedString(@"First name", nil); + } else if (contactSections[section] == ContactSections_Last_Name) { + return NSLocalizedString(@"Last name", nil); + } if ([[self getSectionData:section] count] == 0) return nil; diff --git a/Classes/LinphoneUI/UIEditableTableViewCell.m b/Classes/LinphoneUI/UIEditableTableViewCell.m index 029518883..a4b71bcfe 100644 --- a/Classes/LinphoneUI/UIEditableTableViewCell.m +++ b/Classes/LinphoneUI/UIEditableTableViewCell.m @@ -33,6 +33,7 @@ [tf setHidden:TRUE]; [tf setClearButtonMode:UITextFieldViewModeWhileEditing]; [tf setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; + [tf setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; self.detailTextField = tf; UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:[UIFont systemFontSize]]; diff --git a/submodules/linphone b/submodules/linphone index 34d3a0583..217f50fa3 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 34d3a0583b69946d35b4c7e968530e359423603f +Subproject commit 217f50fa311ec103caaa20147cc6160c0d72c76b