forked from mirrors/linphone-iphone
fix ipad: add contact from HistoryDetailsView
This commit is contained in:
parent
8cc619da3b
commit
972aabfe05
3 changed files with 41 additions and 31 deletions
|
|
@ -54,4 +54,5 @@
|
|||
- (void)editContact:(Contact *)contact;
|
||||
- (void)editContact:(Contact *)contact address:(NSString *)address;
|
||||
- (void)setContact:(Contact *)contact;
|
||||
- (void)resetContact;
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -197,6 +197,39 @@
|
|||
[self selectContact:acontact andReload:NO];
|
||||
}
|
||||
|
||||
- (void)resetContact {
|
||||
if (self.tmpContact) {
|
||||
_contact.firstName = _tmpContact.firstName.copy;
|
||||
_contact.lastName = _tmpContact.lastName.copy;
|
||||
while (_contact.sipAddresses.count > 0) {
|
||||
[_contact removeSipAddressAtIndex:0];
|
||||
}
|
||||
NSInteger nbSipAd = 0;
|
||||
while (_tmpContact.sipAddresses.count > nbSipAd) {
|
||||
[_contact addSipAddress:_tmpContact.sipAddresses[nbSipAd]];
|
||||
nbSipAd++;
|
||||
}
|
||||
while (_contact.phones.count > 0) {
|
||||
[_contact removePhoneNumberAtIndex:0];
|
||||
}
|
||||
NSInteger nbPhone = 0;
|
||||
while (_tmpContact.phones.count > nbPhone) {
|
||||
[_contact addPhoneNumber:_tmpContact.phones[nbPhone]];
|
||||
nbPhone++;
|
||||
}
|
||||
while (_contact.emails.count > 0) {
|
||||
[_contact removeEmailAtIndex:0];
|
||||
}
|
||||
NSInteger nbEmail = 0;
|
||||
while (_tmpContact.emails.count > nbEmail) {
|
||||
[_contact addEmail:_tmpContact.emails[nbEmail]];
|
||||
nbEmail++;
|
||||
}
|
||||
self.tmpContact = NULL;
|
||||
[self saveData];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - ViewController Functions
|
||||
|
||||
- (void)viewDidLoad {
|
||||
|
|
@ -229,7 +262,8 @@
|
|||
[ContactSelection getSelectionMode] != ContactSelectionModeNone);
|
||||
[_tableController.tableView addObserver:self forKeyPath:@"contentSize" options:0 context:NULL];
|
||||
_tableController.waitView = _waitView;
|
||||
self.tmpContact = NULL;
|
||||
if (!IPAD)
|
||||
self.tmpContact = NULL;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self
|
||||
selector: @selector(deviceOrientationDidChange:)
|
||||
|
|
@ -281,36 +315,7 @@
|
|||
}
|
||||
[super viewWillDisappear:animated];
|
||||
PhoneMainView.instance.currentName = NULL;
|
||||
if (self.tmpContact) {
|
||||
_contact.firstName = _tmpContact.firstName.copy;
|
||||
_contact.lastName = _tmpContact.lastName.copy;
|
||||
while (_contact.sipAddresses.count > 0) {
|
||||
[_contact removeSipAddressAtIndex:0];
|
||||
}
|
||||
NSInteger nbSipAd = 0;
|
||||
while (_tmpContact.sipAddresses.count > nbSipAd) {
|
||||
[_contact addSipAddress:_tmpContact.sipAddresses[nbSipAd]];
|
||||
nbSipAd++;
|
||||
}
|
||||
while (_contact.phones.count > 0) {
|
||||
[_contact removePhoneNumberAtIndex:0];
|
||||
}
|
||||
NSInteger nbPhone = 0;
|
||||
while (_tmpContact.phones.count > nbPhone) {
|
||||
[_contact addPhoneNumber:_tmpContact.phones[nbPhone]];
|
||||
nbPhone++;
|
||||
}
|
||||
while (_contact.emails.count > 0) {
|
||||
[_contact removeEmailAtIndex:0];
|
||||
}
|
||||
NSInteger nbEmail = 0;
|
||||
while (_tmpContact.emails.count > nbEmail) {
|
||||
[_contact addEmail:_tmpContact.emails[nbEmail]];
|
||||
nbEmail++;
|
||||
}
|
||||
self.tmpContact = NULL;
|
||||
[self saveData];
|
||||
}
|
||||
[self resetContact];
|
||||
|
||||
BOOL rm = TRUE;
|
||||
for (NSString *sip in _contact.sipAddresses) {
|
||||
|
|
|
|||
|
|
@ -398,6 +398,10 @@ static int ms_strcmpfuz(const char *fuzzy_word, const char *sentence) {
|
|||
if (([ContactSelection getSelectionMode] != ContactSelectionModeEdit) || !([ContactSelection getAddAddress])) {
|
||||
[view setContact:contact];
|
||||
} else {
|
||||
if (IPAD) {
|
||||
[view resetContact];
|
||||
view.isAdding = FALSE;
|
||||
}
|
||||
[view editContact:contact address:[ContactSelection getAddAddress]];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue