diff --git a/Classes/Base.lproj/ContactDetailsLabelView.xib b/Classes/Base.lproj/ContactDetailsLabelView.xib deleted file mode 100644 index f746a0dfc..000000000 --- a/Classes/Base.lproj/ContactDetailsLabelView.xib +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Classes/Base.lproj/ContactDetailsLabelViewController.strings b/Classes/Base.lproj/ContactDetailsLabelViewController.strings deleted file mode 100644 index c17ffbc07..000000000 Binary files a/Classes/Base.lproj/ContactDetailsLabelViewController.strings and /dev/null differ diff --git a/Classes/Base.lproj/ContactDetailsView.xib b/Classes/Base.lproj/ContactDetailsView.xib index 32a5ae076..47f0c8974 100644 --- a/Classes/Base.lproj/ContactDetailsView.xib +++ b/Classes/Base.lproj/ContactDetailsView.xib @@ -97,10 +97,10 @@ - + - + diff --git a/Classes/ContactDetailsLabelView.h b/Classes/ContactDetailsLabelView.h deleted file mode 100644 index c534456ee..000000000 --- a/Classes/ContactDetailsLabelView.h +++ /dev/null @@ -1,40 +0,0 @@ -/* ContactDetailsLabelViewController.h - * - * Copyright (C) 2012 Belledonne Comunications, Grenoble, France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#import -#import "UICompositeView.h" - -@protocol ContactDetailsLabelViewDelegate - -- (void)changeContactDetailsLabel:(NSString *)label; - -@end - -@interface ContactDetailsLabelView - : UIViewController { -} - -@property(nonatomic, copy) NSString *selectedData; -@property(nonatomic, strong) NSDictionary *dataList; -@property(nonatomic, strong) IBOutlet UITableView *tableView; -@property(nonatomic, strong) id delegate; - -- (IBAction)onBackClick:(id)event; - -@end diff --git a/Classes/ContactDetailsLabelView.m b/Classes/ContactDetailsLabelView.m deleted file mode 100644 index 2b0507157..000000000 --- a/Classes/ContactDetailsLabelView.m +++ /dev/null @@ -1,115 +0,0 @@ -/* ContactDetailsLabelViewController.m - * - * Copyright (C) 2012 Belledonne Comunications, Grenoble, France - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#import "ContactDetailsLabelView.h" - -#import "UACellBackgroundView.h" -#import "Utils.h" -#import "PhoneMainView.h" - -@implementation ContactDetailsLabelView - -@synthesize dataList; -@synthesize tableView; -@synthesize selectedData; -@synthesize delegate; - -#pragma mark - UICompositeViewDelegate Functions - -static UICompositeViewDescription *compositeDescription = nil; - -+ (UICompositeViewDescription *)compositeViewDescription { - if (compositeDescription == nil) { - compositeDescription = [[UICompositeViewDescription alloc] init:self.class - statusBar:StatusBarView.class - tabBar:TabBarView.class - fullscreen:false - landscapeMode:LinphoneManager.runningOnIpad - portraitMode:true]; - } - return compositeDescription; -} - -- (UICompositeViewDescription *)compositeViewDescription { - return self.class.compositeViewDescription; -} - -#pragma mark - - -- (void)dismiss { - if ([[PhoneMainView.instance currentView] equal:ContactDetailsLabelView.compositeViewDescription]) { - [PhoneMainView.instance popCurrentView]; - } -} - -#pragma mark - Property Functions - -- (void)setDataList:(NSDictionary *)adatalist { - if ([dataList isEqualToDictionary:adatalist]) { - return; - } - dataList = adatalist; - [tableView reloadData]; -} - -- (void)setSelectedData:(NSString *)aselectedData { - selectedData = [[NSString alloc] initWithString:aselectedData]; - [tableView reloadData]; -} - -#pragma mark - UITableViewDataSource Functions - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [dataList count]; -} - -- (UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *kCellId = @"ContactDetailsLabelCell"; - UITableViewCell *cell = [atableView dequeueReusableCellWithIdentifier:kCellId]; - if (cell == nil) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kCellId]; - } - NSString *key = [[dataList allKeys] objectAtIndex:[indexPath row]]; - [cell.textLabel setText:[dataList objectForKey:key]]; - if ([key compare:selectedData] == 0) { - [cell setAccessoryType:UITableViewCellAccessoryCheckmark]; - } else { - [cell setAccessoryType:UITableViewCellAccessoryNone]; - } - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSString *key = [[dataList allKeys] objectAtIndex:[indexPath row]]; - [self setSelectedData:key]; - [delegate changeContactDetailsLabel:key]; - [self dismiss]; -} - -#pragma mark - Action Functions - -- (IBAction)onBackClick:(id)event { - [self dismiss]; -} - -@end diff --git a/Classes/ContactDetailsTableView.h b/Classes/ContactDetailsTableView.h index a78f51499..35bf74d1a 100644 --- a/Classes/ContactDetailsTableView.h +++ b/Classes/ContactDetailsTableView.h @@ -24,7 +24,7 @@ #import "ContactDetailsLabelView.h" typedef enum _ContactSections { - ContactSections_None = -1, + ContactSections_None = 0, // first section is empty because we cannot set header for first section ContactSections_First_Name, ContactSections_Last_Name, ContactSections_Number, diff --git a/Classes/ContactDetailsTableView.m b/Classes/ContactDetailsTableView.m index 75c1ffcda..5190a58a7 100644 --- a/Classes/ContactDetailsTableView.m +++ b/Classes/ContactDetailsTableView.m @@ -50,8 +50,8 @@ @implementation ContactDetailsTableView static const ContactSections_e contactSections[ContactSections_MAX] = { - ContactSections_First_Name, ContactSections_Last_Name, ContactSections_Number, ContactSections_Sip, - ContactSections_Email}; + ContactSections_None, ContactSections_First_Name, ContactSections_Last_Name, + ContactSections_Number, ContactSections_Sip, ContactSections_Email}; @synthesize contactDetailsDelegate; @synthesize contact; @@ -500,7 +500,6 @@ static const ContactSections_e contactSections[ContactSections_MAX] = { [cell.detailTextField setDelegate:self]; [cell.detailTextField setAutocapitalizationType:UITextAutocapitalizationTypeNone]; [cell.detailTextField setAutocorrectionType:UITextAutocorrectionTypeNo]; - [cell setBackgroundColor:[UIColor whiteColor]]; } NSMutableArray *sectionDict = [self getSectionData:[indexPath section]]; @@ -510,11 +509,11 @@ static const ContactSections_e contactSections[ContactSections_MAX] = { // default label is our app name NSString *label = [FastAddressBook localizedLabel:[labelArray objectAtIndex:0]]; - if (contactSections[[indexPath section]] == ContactSections_First_Name) { + 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) { + } else if (contactSections[indexPath.section] == ContactSections_Last_Name) { value = (__bridge NSString *)(ABRecordCopyValue(contact, [self propertyIDForSection:ContactSections_Last_Name])); label = nil; @@ -721,23 +720,38 @@ static const ContactSections_e contactSections[ContactSections_MAX] = { return UITableViewCellEditingStyleDelete; } -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + NSString *text = nil; if (contactSections[section] == ContactSections_First_Name) { - return NSLocalizedString(@"First name", nil); + text = NSLocalizedString(@"First name", nil); } else if (contactSections[section] == ContactSections_Last_Name) { - return NSLocalizedString(@"Last name", nil); + text = NSLocalizedString(@"Last name", nil); + } else if ([self getSectionData:section].count > 0) { + if (contactSections[section] == ContactSections_Number) { + text = NSLocalizedString(@"Phone numbers", nil); + } else if (contactSections[section] == ContactSections_Sip) { + text = NSLocalizedString(@"SIP addresses", nil); + } else if (contactSections[section] == ContactSections_Email) { + text = NSLocalizedString(@"Email addresses", nil); + } } - if ([[self getSectionData:section] count] == 0) - return nil; - if (contactSections[section] == ContactSections_Number) { - return NSLocalizedString(@"Phone numbers", nil); - } else if (contactSections[section] == ContactSections_Sip) { - return NSLocalizedString(@"SIP addresses", nil); - } else if (contactSections[section] == ContactSections_Email) { - return NSLocalizedString(@"Email addresses", nil); + if (!text) { + return nil; } - return nil; + + UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 20)]; + tempView.backgroundColor = [UIColor clearColor]; + + UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 5, 300, 10)]; + tempLabel.backgroundColor = [UIColor clearColor]; + tempLabel.textColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"color_E"]]; + tempLabel.text = text.uppercaseString; + tempLabel.textAlignment = NSTextAlignmentLeft; + tempLabel.font = [UIFont systemFontOfSize:12]; + [tempView addSubview:tempLabel]; + + return tempView; } #pragma mark - ContactDetailsLabelDelegate Functions @@ -823,4 +837,14 @@ static const ContactSections_e contactSections[ContactSections_MAX] = { return true; } +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { + return 1e-5; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + if (section == 0) + return 1e-5; + return [self tableView:tableView viewForHeaderInSection:section].frame.size.height; +} + @end diff --git a/Classes/LinphoneUI/UIEditableTableViewCell.m b/Classes/LinphoneUI/UIEditableTableViewCell.m index a4b71bcfe..3f68ee81d 100644 --- a/Classes/LinphoneUI/UIEditableTableViewCell.m +++ b/Classes/LinphoneUI/UIEditableTableViewCell.m @@ -30,15 +30,20 @@ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { UITextField *tf = [[UITextField alloc] init]; - [tf setHidden:TRUE]; - [tf setClearButtonMode:UITextFieldViewModeWhileEditing]; - [tf setContentVerticalAlignment:UIControlContentVerticalAlignmentCenter]; - [tf setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; + tf.hidden = TRUE; + tf.clearButtonMode = UITextFieldViewModeWhileEditing; + tf.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; + tf.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; + self.detailTextField = tf; UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:[UIFont systemFontSize]]; [self.detailTextLabel setFont:font]; [self.detailTextField setFont:font]; + + self.detailTextLabel.backgroundColor = self.detailTextField.backgroundColor = + [UIColor colorWithPatternImage:[UIImage imageNamed:@"color_A"]]; + [self.contentView addSubview:detailTextField]; // a vertical separator that will come between the text and detailed text @@ -58,10 +63,11 @@ - (void)layoutSubviews { [super layoutSubviews]; + CGRect superframe = [[self.detailTextField superview] frame]; CGRect detailEditFrame; detailEditFrame.origin.x = 15; - detailEditFrame.origin.y = 0; - detailEditFrame.size.height = 44; + detailEditFrame.origin.y = 5; + detailEditFrame.size.height = superframe.size.height - 10; if ([[self.textLabel text] length] != 0) { detailEditFrame.origin.x += [self.textLabel frame].size.width + 8; @@ -79,9 +85,8 @@ } // put the detailed text edit view at the correct position - CGRect superframe = [[self.detailTextField superview] frame]; - detailEditFrame.size.width = superframe.size.width - detailEditFrame.origin.x; - [self.detailTextField setFrame:detailEditFrame]; + detailEditFrame.size.width = superframe.size.width - 10 - detailEditFrame.origin.x; + self.detailTextField.frame = detailEditFrame; } #pragma mark - UITableViewCell Functions diff --git a/Classes/LinphoneUI/UIEditableTableViewCell.xib b/Classes/LinphoneUI/UIEditableTableViewCell.xib new file mode 100644 index 000000000..60b4509ae --- /dev/null +++ b/Classes/LinphoneUI/UIEditableTableViewCell.xib @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Classes/ar.lproj/ContactDetailsLabelView.strings b/Classes/ar.lproj/ContactDetailsLabelView.strings deleted file mode 100644 index 589309b12..000000000 Binary files a/Classes/ar.lproj/ContactDetailsLabelView.strings and /dev/null differ diff --git a/Classes/de.lproj/ContactDetailsLabelViewController.strings b/Classes/de.lproj/ContactDetailsLabelViewController.strings deleted file mode 100644 index d5f6b2507..000000000 Binary files a/Classes/de.lproj/ContactDetailsLabelViewController.strings and /dev/null differ diff --git a/Classes/fr.lproj/ContactDetailsLabelView.strings b/Classes/fr.lproj/ContactDetailsLabelView.strings deleted file mode 100644 index 760a82b81..000000000 Binary files a/Classes/fr.lproj/ContactDetailsLabelView.strings and /dev/null differ diff --git a/Classes/ja.lproj/ContactDetailsLabelViewController.strings b/Classes/ja.lproj/ContactDetailsLabelViewController.strings deleted file mode 100644 index e4eb9a898..000000000 Binary files a/Classes/ja.lproj/ContactDetailsLabelViewController.strings and /dev/null differ diff --git a/Classes/nl.lproj/ContactDetailsLabelViewController.strings b/Classes/nl.lproj/ContactDetailsLabelViewController.strings deleted file mode 100644 index e2eeedb87..000000000 Binary files a/Classes/nl.lproj/ContactDetailsLabelViewController.strings and /dev/null differ diff --git a/Classes/ru.lproj/ContactDetailsLabelView.strings b/Classes/ru.lproj/ContactDetailsLabelView.strings deleted file mode 100644 index 3185e062f..000000000 Binary files a/Classes/ru.lproj/ContactDetailsLabelView.strings and /dev/null differ diff --git a/Classes/zh_TW.lproj/ContactDetailsLabelViewController.strings b/Classes/zh_TW.lproj/ContactDetailsLabelViewController.strings deleted file mode 100644 index b75d6bc65..000000000 Binary files a/Classes/zh_TW.lproj/ContactDetailsLabelViewController.strings and /dev/null differ diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 9eed6f550..b5c5fa5fd 100755 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -107,6 +107,7 @@ 636BC9971B5F921B00C754CE /* UIIconButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 636BC9961B5F921B00C754CE /* UIIconButton.m */; }; 63701DD61BA31DA1006A9AE3 /* UIConfirmationDialog.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */; }; 63701DDF1BA32039006A9AE3 /* UIConfirmationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = 63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */; }; + 637144571BD531CE007E7C06 /* UIEditableTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 637144561BD531CE007E7C06 /* UIEditableTableViewCell.xib */; }; 637157A11B283FE200C91677 /* FileTransferDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 637157A01B283FE200C91677 /* FileTransferDelegate.m */; }; 637527C91BBA8EF700FDEA6F /* add_field_default.png in Resources */ = {isa = PBXBuildFile; fileRef = 6375271A1BBA8EF700FDEA6F /* add_field_default.png */; }; 637527CA1BBA8EF700FDEA6F /* add_field_over.png in Resources */ = {isa = PBXBuildFile; fileRef = 6375271B1BBA8EF700FDEA6F /* add_field_over.png */; }; @@ -738,6 +739,7 @@ 63701DD51BA31DA1006A9AE3 /* UIConfirmationDialog.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIConfirmationDialog.xib; sourceTree = ""; }; 63701DDD1BA32039006A9AE3 /* UIConfirmationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIConfirmationDialog.h; sourceTree = ""; }; 63701DDE1BA32039006A9AE3 /* UIConfirmationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIConfirmationDialog.m; sourceTree = ""; }; + 637144561BD531CE007E7C06 /* UIEditableTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = UIEditableTableViewCell.xib; sourceTree = ""; }; 6371579F1B283FE200C91677 /* FileTransferDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileTransferDelegate.h; path = Utils/FileTransferDelegate.h; sourceTree = ""; }; 637157A01B283FE200C91677 /* FileTransferDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FileTransferDelegate.m; path = Utils/FileTransferDelegate.m; sourceTree = ""; }; 6375271A1BBA8EF700FDEA6F /* add_field_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = add_field_default.png; sourceTree = ""; }; @@ -1521,6 +1523,7 @@ 2248E90D12F7E4CF00220D9C /* UIDigitButton.m */, D3C6526515AC1A8F0092A874 /* UIEditableTableViewCell.h */, D3C6526615AC1A8F0092A874 /* UIEditableTableViewCell.m */, + 637144561BD531CE007E7C06 /* UIEditableTableViewCell.xib */, 2214EB8712F84EBB002A5394 /* UIHangUpButton.h */, 2214EB8812F84EBB002A5394 /* UIHangUpButton.m */, D31C9C96158A1CDE00756B45 /* UIHistoryCell.h */, @@ -2374,6 +2377,7 @@ 639CEAFD1A1DF4D9004DE38F /* StatusBarView.xib in Resources */, 637527DD1BBA8EF700FDEA6F /* call_status_incoming.png in Resources */, 637528321BBA8EF700FDEA6F /* numpad_3_over.png in Resources */, + 637144571BD531CE007E7C06 /* UIEditableTableViewCell.xib in Resources */, F088488A19FF8C41007FFCF3 /* UIContactCell.xib in Resources */, 637527E51BBA8EF700FDEA6F /* camera_switch_disabled.png in Resources */, 6375280F1BBA8EF700FDEA6F /* delete_field_default.png in Resources */,