Add DEBUG symbol in debug configuration

Disabled validation of contact is first & last name are empty
This commit is contained in:
Yann Diorcet 2012-08-09 16:40:16 +02:00
parent be9509f7c3
commit 93a8588ed4
17 changed files with 410 additions and 34 deletions

View file

@ -0,0 +1,25 @@
/* ContactDetailsDelegate.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.
*/
@protocol ContactDetailsDelegate <NSObject>
- (void)onRemove:(id)event;
- (void)onModification:(id)event;
@end

View file

@ -20,6 +20,7 @@
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import "ContactDetailsDelegate.h"
#import "ContactDetailsLabelViewController.h"
#import "UIContactDetailsHeader.h"
#import "UIContactDetailsFooter.h"
@ -30,13 +31,17 @@
NSMutableArray *dataCache;
NSMutableArray *labelArray;
NSIndexPath *editingIndexPath;
@public
UIContactDetailsHeader *headerController;
UIContactDetailsFooter *footerController;
id<ContactDetailsDelegate> contactDetailsDelegate;
}
@property (nonatomic, assign) ABRecordRef contact;
@property (nonatomic, retain) IBOutlet id<ContactDetailsDelegate> contactDetailsDelegate;
@property (nonatomic, retain) IBOutlet UIContactDetailsHeader *headerController;
@property (nonatomic, retain) IBOutlet UIContactDetailsFooter *footerController;
- (BOOL)isValid;
- (void)addSipField:(NSString*)address;
@end

View file

@ -63,6 +63,9 @@ enum _ContactSections {
static const int contactSections[ContactSections_MAX] = {ContactSections_Number, ContactSections_Sip};
@synthesize footerController;
@synthesize headerController;
@synthesize contactDetailsDelegate;
@synthesize contact;
#pragma mark - Lifecycle Functions
@ -74,8 +77,6 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
[NSString stringWithString:(NSString*)kABPersonPhoneMobileLabel],
[NSString stringWithString:(NSString*)kABPersonPhoneIPhoneLabel],
[NSString stringWithString:(NSString*)kABPersonPhoneMainLabel], nil];
headerController = [[UIContactDetailsHeader alloc] init];
footerController = [[UIContactDetailsFooter alloc] init];
editingIndexPath = nil;
}
@ -104,8 +105,6 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
}
[labelArray release];
[dataCache release];
[headerController release];
[UIContactDetailsFooter release];
[super dealloc];
}
@ -125,6 +124,15 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
#pragma mark -
- (BOOL)isValid {
return [headerController isValid];
}
- (void)updateModification {
[contactDetailsDelegate onModification:nil];
}
+ (BOOL)findAndResignFirstResponder:(UIView*)view {
if (view.isFirstResponder) {
[view resignFirstResponder];
@ -212,7 +220,10 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
}
[dataCache addObject:subArray];
}
if(contactDetailsDelegate != nil) {
[contactDetailsDelegate onModification:nil];
}
[self.tableView reloadData];
}
@ -286,6 +297,9 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
}
[tableview insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForRow:count inSection:section]] withRowAnimation:UITableViewRowAnimationFade];
}
if(contactDetailsDelegate != nil) {
[contactDetailsDelegate onModification:nil];
}
}
- (void)removeEmptyEntry:(UITableView*)tableview section:(NSInteger)section animated:(BOOL)animated {
@ -314,6 +328,9 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
CFRelease(lMap);
}
}
if(contactDetailsDelegate != nil) {
[contactDetailsDelegate onModification:nil];
}
}
- (void)removeEntry:(UITableView*)tableview path:(NSIndexPath*)indexPath animated:(BOOL)animated {
@ -652,6 +669,13 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
#pragma mark - UITextFieldDelegate Functions
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if(contactDetailsDelegate != nil) {
[self performSelector:@selector(updateModification) withObject:nil afterDelay:0];
}
return YES;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder];
return YES;
@ -692,6 +716,9 @@ static const int contactSections[ContactSections_MAX] = {ContactSections_Number,
} else {
[LinphoneLogger logc:LinphoneLoggerError format:"Not valid UIEditableTableViewCell"];
}
if(contactDetailsDelegate != nil) {
[self performSelector:@selector(updateModification) withObject:nil afterDelay:0];
}
return TRUE;
}

View file

@ -21,10 +21,10 @@
#import <AddressBook/AddressBook.h>
#import "UICompositeViewController.h"
#import "ContactDetailsTableViewController.h"
#import "UIToggleButton.h"
#import "ContactDetailsTableViewController.h"
@interface ContactDetailsViewController : UIViewController<UICompositeViewDelegate> {
@interface ContactDetailsViewController : UIViewController<UICompositeViewDelegate, ContactDetailsDelegate> {
ContactDetailsTableViewController *tableController;
ABRecordRef contact;
UIToggleButton *editButton;

View file

@ -198,22 +198,18 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
- (void)viewDidLoad{
[super viewDidLoad];
// Set selected+over background: IB lack !
[editButton setImage:[UIImage imageNamed:@"contact_ok_over.png"]
forState:(UIControlStateHighlighted | UIControlStateSelected)];
// Force view load
[tableController->footerController view];
[tableController->footerController->removeButton addTarget:self
action:@selector(onRemove:)
forControlEvents:UIControlEventTouchUpInside];
// Set selected+disabled background: IB lack !
[editButton setImage:[UIImage imageNamed:@"contact_ok_disabled.png"]
forState:(UIControlStateDisabled | UIControlStateSelected)];
}
- (void)viewDidUnload {
[super viewDidUnload];
[tableController->footerController->removeButton removeTarget:self
action:@selector(onRemove:)
forControlEvents:UIControlEventTouchUpInside];
}
- (void)viewWillDisappear:(BOOL)animated {
@ -291,6 +287,7 @@ static UICompositeViewDescription *compositeDescription = nil;
[backButton setHidden:FALSE];
}
#pragma mark - Action Functions
- (IBAction)onCancelClick:(id)event {
@ -304,8 +301,10 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onEditClick:(id)event {
if([tableController isEditing]) {
[self disableEdit:TRUE];
[self saveData];
if([tableController isValid]) {
[self disableEdit:TRUE];
[self saveData];
}
} else {
[self enableEdit:TRUE];
}
@ -317,4 +316,12 @@ static UICompositeViewDescription *compositeDescription = nil;
[[PhoneMainView instance] popCurrentView];
}
- (void)onModification:(id)event {
if(![tableController isEditing] || [tableController isValid]) {
[editButton setEnabled:TRUE];
} else {
[editButton setEnabled:FALSE];
}
}
@end

View file

@ -17,6 +17,7 @@
<string>IBUITableView</string>
<string>IBUITableViewController</string>
<string>IBUIView</string>
<string>IBUIViewController</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -176,7 +177,6 @@
<string key="NSFrame">{{0, 59}, {320, 401}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">10</int>
@ -270,6 +270,26 @@ AAgACAAIAAEAAQABAAE</bytes>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
<object class="IBUIViewController" id="675959495">
<string key="IBUINibName">UIContactDetailsFooter</string>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
<object class="IBUIViewController" id="320247549">
<string key="IBUINibName">UIContactDetailsHeader</string>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
<int key="IBUIInterfaceOrientation">1</int>
<int key="interfaceOrientation">1</int>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIHorizontal">NO</bool>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
@ -355,6 +375,30 @@ AAgACAAIAAEAAQABAAE</bytes>
</object>
<int key="connectionID">26</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">contactDetailsDelegate</string>
<reference key="source" ref="537601624"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">53</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">footerController</string>
<reference key="source" ref="537601624"/>
<reference key="destination" ref="675959495"/>
</object>
<int key="connectionID">59</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">headerController</string>
<reference key="source" ref="537601624"/>
<reference key="destination" ref="320247549"/>
</object>
<int key="connectionID">60</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onCancelClick:</string>
@ -364,6 +408,22 @@ AAgACAAIAAEAAQABAAE</bytes>
</object>
<int key="connectionID">49</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">contactDetailsDelegate</string>
<reference key="source" ref="675959495"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">61</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">contactDetailsDelegate</string>
<reference key="source" ref="320247549"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">62</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@ -442,6 +502,18 @@ AAgACAAIAAEAAQABAAE</bytes>
<reference key="parent" ref="624008635"/>
<string key="objectName">barBackground</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">57</int>
<reference key="object" ref="675959495"/>
<reference key="parent" ref="0"/>
<string key="objectName">footerController</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">58</int>
<reference key="object" ref="320247549"/>
<reference key="parent" ref="0"/>
<string key="objectName">headerController</string>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@ -457,6 +529,10 @@ AAgACAAIAAEAAQABAAE</bytes>
<string key="47.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="1" key="47.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
<string key="52.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="57.CustomClassName">UIContactDetailsFooter</string>
<string key="57.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="58.CustomClassName">UIContactDetailsHeader</string>
<string key="58.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.CustomClassName">UIToggleButton</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<real value="2" key="8.IBUIButtonInspectorSelectedStateConfigurationMetadataKey"/>
@ -467,13 +543,32 @@ AAgACAAIAAEAAQABAAE</bytes>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">52</int>
<int key="maxID">62</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">ContactDetailsTableViewController</string>
<string key="superclassName">UITableViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contactDetailsDelegate">id</string>
<string key="footerController">UIContactDetailsFooter</string>
<string key="headerController">UIContactDetailsHeader</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contactDetailsDelegate">
<string key="name">contactDetailsDelegate</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo" key="footerController">
<string key="name">footerController</string>
<string key="candidateClassName">UIContactDetailsFooter</string>
</object>
<object class="IBToOneOutletInfo" key="headerController">
<string key="name">headerController</string>
<string key="candidateClassName">UIContactDetailsHeader</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ContactDetailsTableViewController.h</string>
@ -530,6 +625,81 @@ AAgACAAIAAEAAQABAAE</bytes>
<string key="minorKey">./Classes/ContactDetailsViewController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIContactDetailsFooter</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">onRemoveClick:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">onRemoveClick:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">onRemoveClick:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="contactDetailsDelegate">id</string>
<string key="removeButton">UIButton</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="contactDetailsDelegate">
<string key="name">contactDetailsDelegate</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo" key="removeButton">
<string key="name">removeButton</string>
<string key="candidateClassName">UIButton</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIContactDetailsFooter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIContactDetailsHeader</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="addressLabel">UILabel</string>
<string key="avatarImage">UIImageView</string>
<string key="contactDetailsDelegate">id</string>
<string key="editView">UIView</string>
<string key="normalView">UIView</string>
<string key="tableView">UITableView</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="addressLabel">
<string key="name">addressLabel</string>
<string key="candidateClassName">UILabel</string>
</object>
<object class="IBToOneOutletInfo" key="avatarImage">
<string key="name">avatarImage</string>
<string key="candidateClassName">UIImageView</string>
</object>
<object class="IBToOneOutletInfo" key="contactDetailsDelegate">
<string key="name">contactDetailsDelegate</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBToOneOutletInfo" key="editView">
<string key="name">editView</string>
<string key="candidateClassName">UIView</string>
</object>
<object class="IBToOneOutletInfo" key="normalView">
<string key="name">normalView</string>
<string key="candidateClassName">UIView</string>
</object>
<object class="IBToOneOutletInfo" key="tableView">
<string key="name">tableView</string>
<string key="candidateClassName">UITableView</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/UIContactDetailsHeader.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">UIToggleButton</string>
<string key="superclassName">UIButton</string>

View file

@ -111,7 +111,7 @@
} else {
}
if(name != nil) {
if(name != nil && [name length] > 0) {
// Put in correct subDic
NSString *firstChar = [[name substringToIndex:1] uppercaseString];
if([firstChar characterAtIndex:0] < 'A' || [firstChar characterAtIndex:0] > 'Z') {

View file

@ -19,12 +19,18 @@
#import <UIKit/UIKit.h>
#import "ContactDetailsDelegate.h"
@interface UIContactDetailsFooter : UIViewController {
@public
@private
UIButton *removeButton;
id<ContactDetailsDelegate> contactDetailsDelegate;
}
@property (nonatomic, retain) IBOutlet UIButton *removeButton;
@property (nonatomic, retain) IBOutlet id<ContactDetailsDelegate> contactDetailsDelegate;
- (IBAction)onRemoveClick:(id)event;
+ (CGFloat)height:(BOOL)editing;

View file

@ -22,12 +22,36 @@
@implementation UIContactDetailsFooter
@synthesize removeButton;
@synthesize contactDetailsDelegate;
#pragma mark - Lifecycle Functions
- (void)initUIContactDetailsFooter {
}
- (id)init {
return self = [super initWithNibName:@"UIContactDetailsFooter" bundle:[NSBundle mainBundle]];
self = [super init];
if(self != nil) {
[self initUIContactDetailsFooter];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if(self != nil) {
[self initUIContactDetailsFooter];
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self != nil) {
[self initUIContactDetailsFooter];
}
return self;
}
- (void)dealloc {
@ -37,6 +61,15 @@
}
#pragma mark - Action Functions
- (IBAction)onRemoveClick:(id)event {
if(contactDetailsDelegate != nil) {
[contactDetailsDelegate onRemove:event];
}
}
#pragma mark -
+ (CGFloat)height:(BOOL)editing {

View file

@ -3,17 +3,17 @@
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.InterfaceBuilderVersion">2549</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
<string key="NS.object.0">1498</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUIButton</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
@ -41,7 +41,6 @@
<string key="NSFrame">{{23, 25}, {275, 50}}</string>
<reference key="NSSuperview" ref="380043078"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor" id="245863526">
<int key="NSColorSpace">3</int>
@ -103,6 +102,15 @@
</object>
<int key="connectionID">7</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">onRemoveClick:</string>
<reference key="source" ref="439465593"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">10</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@ -152,13 +160,24 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">9</int>
<int key="maxID">10</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">UIContactDetailsFooter</string>
<string key="superclassName">UIViewController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">onRemoveClick:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">onRemoveClick:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">onRemoveClick:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">removeButton</string>
<string key="NS.object.0">UIButton</string>
@ -189,6 +208,6 @@
<string key="button_alert_background_default.png">{550, 101}</string>
<string key="button_alert_background_over.png">{550, 101}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1181</string>
<string key="IBCocoaTouchPluginVersion">1498</string>
</data>
</archive>

View file

@ -20,6 +20,8 @@
#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
#import "ContactDetailsDelegate.h"
@interface UIContactDetailsHeader : UIViewController<UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate> {
UILabel *addressLabel;
UIImageView *avatarImage;
@ -30,6 +32,7 @@
NSArray *propertyList;
ABRecordRef contact;
BOOL editing;
id<ContactDetailsDelegate> contactDetailsDelegate;
}
@property (nonatomic, assign) ABRecordRef contact;
@ -40,6 +43,7 @@
@property (nonatomic, retain) IBOutlet UIView *normalView;
@property (nonatomic, retain) IBOutlet UIView *editView;
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, retain) IBOutlet id<ContactDetailsDelegate> contactDetailsDelegate;
@property(nonatomic,getter=isEditing) BOOL editing;
@ -48,5 +52,6 @@
- (void)setEditing:(BOOL)editing animated:(BOOL)animated;
- (void)setEditing:(BOOL)editing;
- (BOOL)isEditing;
- (BOOL)isValid;
@end

View file

@ -31,15 +31,36 @@
@synthesize normalView;
@synthesize editView;
@synthesize tableView;
@synthesize contactDetailsDelegate;
#pragma mark - Lifecycle Functions
- (void)initUIContactDetailsHeader {
propertyList = [[NSArray alloc] initWithObjects:
[NSNumber numberWithInt:kABPersonFirstNameProperty],
[NSNumber numberWithInt:kABPersonLastNameProperty], nil];
}
- (id)init {
self = [super initWithNibName:@"UIContactDetailsHeader" bundle:[NSBundle mainBundle]];
self = [super init];
if(self != nil) {
self->propertyList = [[NSArray alloc] initWithObjects:
[NSNumber numberWithInt:kABPersonFirstNameProperty],
[NSNumber numberWithInt:kABPersonLastNameProperty], nil];
[self initUIContactDetailsHeader];
}
return self;
}
- (id)initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if(self != nil) {
[self initUIContactDetailsHeader];
}
return self;
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if(self != nil) {
[self initUIContactDetailsHeader];
}
return self;
}
@ -73,7 +94,16 @@
}
#pragma mark -
#pragma mark -
- (BOOL)isValid {
for (int i = 0; i < [propertyList count]; ++i) {
UIEditableTableViewCell *cell = (UIEditableTableViewCell *)[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
if([cell.detailTextField.text length] > 0)
return true;
}
return false;
}
- (void)update {
if(contact == NULL) {
@ -154,6 +184,9 @@
return editing;
}
- (void)updateModification {
[contactDetailsDelegate onModification:nil];
}
#pragma mark - UITableViewDataSource Functions
@ -213,6 +246,13 @@
return YES;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
if(contactDetailsDelegate != nil) {
[self performSelector:@selector(updateModification) withObject:nil afterDelay:0];
}
return YES;
}
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField {
UIView *view = [textField superview];
// Find TableViewCell
@ -230,6 +270,9 @@
} else {
[LinphoneLogger logc:LinphoneLoggerWarning format:"Not valid UIEditableTableViewCell"];
}
if(contactDetailsDelegate != nil) {
[self performSelector:@selector(updateModification) withObject:nil afterDelay:0];
}
return TRUE;
}

View file

@ -451,6 +451,10 @@ static UICompositeViewDescription *compositeDescription = nil;
}
NSMutableSet *hiddenKeys = [NSMutableSet set];
#ifndef DEBUG
[hiddenKeys addObject:@"release_button"];
#endif
[hiddenKeys addObject:@"quit_button"]; // Hide for the moment
[hiddenKeys addObject:@"about_button"]; // Hide for the moment

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -176,6 +176,14 @@
<key>Type</key>
<string>IASKButtonSpecifier</string>
</dict>
<dict>
<key>Key</key>
<string>Release_button</string>
<key>Title</key>
<string>Release</string>
<key>Type</key>
<string>IASKButtonSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>

View file

@ -141,6 +141,8 @@
C9C8254915AE204D00D493FA /* transfer_call_over.png in Resources */ = {isa = PBXBuildFile; fileRef = C9C8254215AE204D00D493FA /* transfer_call_over.png */; };
C9C8254C15AE207B00D493FA /* options_selected.png in Resources */ = {isa = PBXBuildFile; fileRef = C9C8254B15AE207B00D493FA /* options_selected.png */; };
C9C8254F15AE256100D493FA /* transfer_call_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = C9C8254E15AE256100D493FA /* transfer_call_disabled.png */; };
D30BBD1815D402A7000F93DD /* contact_ok_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D30BBD1715D402A7000F93DD /* contact_ok_disabled.png */; };
D30BBD1915D402A7000F93DD /* contact_ok_disabled.png in Resources */ = {isa = PBXBuildFile; fileRef = D30BBD1715D402A7000F93DD /* contact_ok_disabled.png */; };
D3119E7215B6A4710005D4A4 /* contacts_back_default.png in Resources */ = {isa = PBXBuildFile; fileRef = D3119E7015B6A4710005D4A4 /* contacts_back_default.png */; };
D3119E7415B6A4710005D4A4 /* contacts_back_over.png in Resources */ = {isa = PBXBuildFile; fileRef = D3119E7115B6A4710005D4A4 /* contacts_back_over.png */; };
D3128FE115AABC7E00A2147A /* ContactDetailsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3128FDF15AABC7E00A2147A /* ContactDetailsViewController.m */; };
@ -1480,6 +1482,8 @@
C9C8254215AE204D00D493FA /* transfer_call_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = transfer_call_over.png; path = Resources/transfer_call_over.png; sourceTree = "<group>"; };
C9C8254B15AE207B00D493FA /* options_selected.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = options_selected.png; path = Resources/options_selected.png; sourceTree = "<group>"; };
C9C8254E15AE256100D493FA /* transfer_call_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = transfer_call_disabled.png; path = Resources/transfer_call_disabled.png; sourceTree = "<group>"; };
D30BBD1215D3EFEB000F93DD /* ContactDetailsDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailsDelegate.h; sourceTree = "<group>"; };
D30BBD1715D402A7000F93DD /* contact_ok_disabled.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contact_ok_disabled.png; path = Resources/contact_ok_disabled.png; sourceTree = "<group>"; };
D3119E7015B6A4710005D4A4 /* contacts_back_default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contacts_back_default.png; path = Resources/contacts_back_default.png; sourceTree = "<group>"; };
D3119E7115B6A4710005D4A4 /* contacts_back_over.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = contacts_back_over.png; path = Resources/contacts_back_over.png; sourceTree = "<group>"; };
D3128FDE15AABC7E00A2147A /* ContactDetailsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailsViewController.h; sourceTree = "<group>"; };
@ -2149,6 +2153,7 @@
22E0A820111C44E100B04932 /* ConsoleViewController.h */,
22E0A81F111C44E100B04932 /* ConsoleViewController.m */,
22E0A81E111C44E100B04932 /* ConsoleViewController.xib */,
D30BBD1215D3EFEB000F93DD /* ContactDetailsDelegate.h */,
D378906215AC373B00BD776C /* ContactDetailsLabelViewController.h */,
D378906315AC373B00BD776C /* ContactDetailsLabelViewController.m */,
D378906415AC373B00BD776C /* ContactDetailsLabelViewController.xib */,
@ -2751,6 +2756,7 @@
D37C638D15AAD251009D0BAC /* contact_number.png */,
D37C638C15AAD251009D0BAC /* contact_number_over.png */,
D3C6526915AC228A0092A874 /* contact_ok_default.png */,
D30BBD1715D402A7000F93DD /* contact_ok_disabled.png */,
D3C6526A15AC228A0092A874 /* contact_ok_over.png */,
D354980E15875608000081D8 /* contacts_add_default.png */,
D354980F15875608000081D8 /* contacts_add_over.png */,
@ -3753,6 +3759,7 @@
D339890815C6E16F00CAF1E4 /* dialer_alt_back_over_landscape~ipad.png in Resources */,
D33CF34A15D3A03400CD4B85 /* linphone_icon_57@2x.png in Resources */,
D33CF34C15D3A03400CD4B85 /* linphone_icon_72@2x.png in Resources */,
D30BBD1815D402A7000F93DD /* contact_ok_disabled.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4191,6 +4198,7 @@
D339890915C6E16F00CAF1E4 /* dialer_alt_back_over_landscape~ipad.png in Resources */,
D33CF34B15D3A03400CD4B85 /* linphone_icon_57@2x.png in Resources */,
D33CF34D15D3A03400CD4B85 /* linphone_icon_72@2x.png in Resources */,
D30BBD1915D402A7000F93DD /* contact_ok_disabled.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -4462,6 +4470,7 @@
VIDEO_ENABLED,
HAVE_X264,
HAVE_SILK,
DEBUG,
);
HEADER_SEARCH_PATHS = (
submodules/linphone/coreapi,
@ -4582,6 +4591,7 @@
GCC_PREPROCESSOR_DEFINITIONS = (
IN_LINPHONE,
VIDEO_ENABLED,
DEBUG,
);
HEADER_SEARCH_PATHS = (
submodules/linphone/coreapi,

14
main.m
View file

@ -19,7 +19,21 @@
#import <UIKit/UIKit.h>
#ifdef DEBUG
// Dump exception
void uncaughtExceptionHandler(NSException *exception) {
NSLog(@"Crash: %@", exception);
NSLog(@"Stack Trace: %@", [exception callStackSymbols]);
// Internal error reporting
}
#endif
int main(int argc, char *argv[]) {
#ifdef DEBUG
NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
#endif
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];