From 79abe1184bbba9130e43e524317fd135db70332b Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 29 Sep 2015 15:29:28 +0200 Subject: [PATCH] fix compilation --- Classes/Base.lproj/HistoryListView.xib | 19 +- Classes/HistoryListTableView.m | 31 +- Classes/HistoryListView.m | 15 +- .../LinphoneUI/Base.lproj/UIHistoryCell.xib | 34 +- Classes/LinphoneUI/UICheckBoxTVCell.m | 6 +- Classes/LinphoneUI/UIHistoryCell.h | 2 + Classes/LinphoneUI/UIHistoryCell.m | 28 +- linphone.xcodeproj/project.pbxproj | 370 +++++++++--------- 8 files changed, 256 insertions(+), 249 deletions(-) diff --git a/Classes/Base.lproj/HistoryListView.xib b/Classes/Base.lproj/HistoryListView.xib index d3678cab2..30f2fd6d8 100644 --- a/Classes/Base.lproj/HistoryListView.xib +++ b/Classes/Base.lproj/HistoryListView.xib @@ -1,7 +1,8 @@ - + - + + @@ -11,7 +12,6 @@ - @@ -122,16 +122,11 @@ - - + + - - + + - - - - - diff --git a/Classes/HistoryListTableView.m b/Classes/HistoryListTableView.m index afbd69774..d1c951023 100644 --- a/Classes/HistoryListTableView.m +++ b/Classes/HistoryListTableView.m @@ -24,13 +24,16 @@ #import "UACellBackgroundView.h" #import "Utils.h" -@implementation HistoryListTableView +@implementation HistoryListTableView { + NSMutableArray *selectedItems; +} @synthesize missedFilter; #pragma mark - Lifecycle Functions - (void)initHistoryTableViewController { + selectedItems = [[NSMutableArray alloc] init]; callLogs = [[NSMutableArray alloc] init]; missedFilter = false; } @@ -140,13 +143,25 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { LinphoneCallLog *callLog = [[callLogs objectAtIndex:[indexPath row]] pointerValue]; - if (callLog != NULL && linphone_call_log_get_call_id(callLog) != NULL) { - LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); - char *uri = linphone_address_as_string(addr); - DialerView *view = VIEW(DialerView); - [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; - [view call:[NSString stringWithUTF8String:uri] displayName:[FastAddressBook displayNameForAddress:addr]]; - ms_free(uri); + + if ([self isEditing]) { + UIHistoryCell *cell = (UIHistoryCell *)[self tableView:tableView cellForRowAtIndexPath:indexPath]; + if ([selectedItems containsObject:indexPath]) { + [selectedItems removeObject:indexPath]; + cell.checkBoxButton.selected = YES; + } else { + [selectedItems addObject:indexPath]; + cell.checkBoxButton.selected = NO; + } + } else { + if (callLog != NULL && linphone_call_log_get_call_id(callLog) != NULL) { + LinphoneAddress *addr = linphone_call_log_get_remote_address(callLog); + char *uri = linphone_address_as_string(addr); + DialerView *view = VIEW(DialerView); + [PhoneMainView.instance changeCurrentView:view.compositeViewDescription]; + [view call:[NSString stringWithUTF8String:uri] displayName:[FastAddressBook displayNameForAddress:addr]]; + ms_free(uri); + } } } diff --git a/Classes/HistoryListView.m b/Classes/HistoryListView.m index 26b30dbaa..cd985b6ae 100644 --- a/Classes/HistoryListView.m +++ b/Classes/HistoryListView.m @@ -77,9 +77,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - - // editButton.hidden = ([[tableController.tableView dataSource] tableView:tableController.tableView - // numberOfRowsInSection:0] == 0); + [self hideEditIfNeeded]; } - (void)viewDidLoad { @@ -89,6 +87,10 @@ static UICompositeViewDescription *compositeDescription = nil; #pragma mark - +- (void)hideEditIfNeeded { + editButton.hidden = ([tableController tableView:tableController.tableView numberOfRowsInSection:0] == 0); +} + - (void)changeView:(HistoryView)view { if (view == History_All) { allButton.selected = TRUE; @@ -103,9 +105,7 @@ static UICompositeViewDescription *compositeDescription = nil; } else { missedButton.selected = FALSE; } - - // editButton.hidden = ([[tableController.tableView dataSource] tableView:tableController.tableView - // numberOfRowsInSection:0] == 0); + [self hideEditIfNeeded]; } #pragma mark - Action Functions @@ -126,8 +126,7 @@ static UICompositeViewDescription *compositeDescription = nil; - (IBAction)onDeleteClick:(id)event { linphone_core_clear_call_logs([LinphoneManager getLc]); [tableController loadData]; - // editButton.hidden = ([[tableController.tableView dataSource] tableView:tableController.tableView - // numberOfRowsInSection:0] == 0); + [self hideEditIfNeeded]; if ([editButton isSelected]) { [editButton toggle]; [self onEditClick:nil]; diff --git a/Classes/LinphoneUI/Base.lproj/UIHistoryCell.xib b/Classes/LinphoneUI/Base.lproj/UIHistoryCell.xib index 391957bd8..02afcd696 100644 --- a/Classes/LinphoneUI/Base.lproj/UIHistoryCell.xib +++ b/Classes/LinphoneUI/Base.lproj/UIHistoryCell.xib @@ -1,19 +1,22 @@ - + - + + + + - + @@ -25,7 +28,7 @@ +