Changeset 3801
- Timestamp:
- 09/13/08 18:08:54 (2 months ago)
- Files:
-
- trunk/Mobile/Controllers/CQConnectionEditViewController.m (modified) (1 diff)
- trunk/Mobile/Controllers/CQConnectionsController.m (modified) (2 diffs)
- trunk/Mobile/Controllers/CQConnectionsViewController.m (modified) (4 diffs)
- trunk/Mobile/Views/CQPreferencesTextCell.h (modified) (1 diff)
- trunk/Mobile/Views/CQPreferencesTextCell.m (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Mobile/Controllers/CQConnectionEditViewController.m
r3785 r3801 68 68 69 69 - (UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath { 70 CQPreferencesTextCell *cell = [[CQPreferencesTextCell alloc] init]; 71 cell.text = @"Test"; 72 cell.label = @"My Label"; 73 return [cell autorelease]; 70 CQPreferencesTextCell *cell = (CQPreferencesTextCell *)[tableView dequeueReusableCellWithIdentifier:@"CQPreferencesTextCell"]; 71 if( ! cell ) cell = [[[CQPreferencesTextCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"CQPreferencesTextCell"] autorelease]; 72 73 if( indexPath.section == 0 ) { 74 if ( indexPath.row == 0 ) { 75 cell.label = @"Server"; 76 cell.text = @""; 77 } else if( indexPath.row == 1 ) { 78 cell.label = @"Port"; 79 cell.text = @""; 80 } else if( indexPath.row == 2 ) { 81 cell.label = @"Use SSL"; 82 cell.text = @""; 83 } 84 } else if( indexPath.section == 1 ) { 85 if ( indexPath.row == 0 ) { 86 cell.label = @"Nickname"; 87 cell.text = @""; 88 } else if( indexPath.row == 1 ) { 89 cell.label = @"Alternates"; 90 cell.text = @""; 91 } else if( indexPath.row == 2 ) { 92 cell.label = @"Real Name"; 93 cell.text = @""; 94 } 95 } else if( indexPath.section == 2 ) { 96 if ( indexPath.row == 0 ) { 97 cell.label = @"Username"; 98 cell.text = @""; 99 } else if( indexPath.row == 1 ) { 100 cell.label = @"Password"; 101 cell.text = @""; 102 } else if( indexPath.row == 2 ) { 103 cell.label = @"Nick Password"; 104 cell.text = @""; 105 } 106 } else if( indexPath.section == 3 ) { 107 if ( indexPath.row == 0 ) { 108 cell.label = @"Connect"; 109 cell.text = @""; 110 } else if( indexPath.row == 1 ) { 111 cell.label = @"Join Rooms"; 112 cell.text = @""; 113 } 114 } 115 116 return cell; 74 117 } 75 118 @end trunk/Mobile/Controllers/CQConnectionsController.m
r3797 r3801 28 28 return nil; 29 29 30 _connections = [[NSMutableArray alloc] init];31 32 30 self.title = NSLocalizedString(@"Connections", @"Connections tab title"); 33 31 self.tabBarItem.image = [UIImage imageNamed:@"connections.png"]; 32 33 _connections = [[NSMutableArray alloc] init]; 34 35 connectionsViewController = [[CQConnectionsViewController alloc] init]; 36 [self pushViewController:connectionsViewController animated:NO]; 34 37 35 38 [self _loadConnectionList]; … … 47 50 #pragma mark - 48 51 49 - (void) viewDidLoad { 50 [super viewDidLoad]; 51 if( !connectionsViewController ) 52 connectionsViewController = [[CQConnectionsViewController alloc] init]; 53 [self pushViewController:connectionsViewController animated:NO]; 52 - (void) didReceiveMemoryWarning { 53 if( !editViewController.view.superview ) { 54 [editViewController release]; 55 editViewController = nil; 56 } 57 58 [super didReceiveMemoryWarning]; 54 59 } 55 60 trunk/Mobile/Controllers/CQConnectionsViewController.m
r3797 r3801 31 31 32 32 self.navigationItem.rightBarButtonItem = self.editButtonItem; 33 34 for( MVChatConnection *connection in [CQConnectionsController defaultController].connections )35 [self addConnection:connection];36 33 } 37 34 38 35 - (void) didReceiveMemoryWarning { 39 if( ! self.view.superview ) {36 if( !connectionCreationViewController.view.superview ) { 40 37 [connectionCreationViewController release]; 41 38 connectionCreationViewController = nil; … … 98 95 99 96 #pragma mark - 100 101 - (void) _registerNotificationsForConnection:(MVChatConnection *) connection {102 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didChange: ) name:MVChatConnectionNicknameAcceptedNotification object:connection];103 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _willConnect: ) name:MVChatConnectionWillConnectNotification object:connection];104 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didConnect: ) name:MVChatConnectionDidConnectNotification object:connection];105 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didChange: ) name:MVChatConnectionDidNotConnectNotification object:connection];106 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didDisconnect: ) name:MVChatConnectionDidDisconnectNotification object:connection];107 108 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _errorOccurred : ) name:MVChatConnectionErrorNotification object:connection];109 110 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _requestPassword: ) name:MVChatConnectionNeedNicknamePasswordNotification object:connection];111 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _requestCertificatePassword: ) name:MVChatConnectionNeedCertificatePasswordNotification object:connection];112 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _requestPublicKeyVerification: ) name:MVChatConnectionNeedPublicKeyVerificationNotification object:connection];113 }114 97 115 98 - (void) _deregisterNotificationsForConnection:(MVChatConnection *) connection { … … 127 110 } 128 111 112 - (void) _registerNotificationsForConnection:(MVChatConnection *) connection { 113 // Remove any previous observers, to prevent registering twice. 114 [self _deregisterNotificationsForConnection:connection]; 115 116 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didChange: ) name:MVChatConnectionNicknameAcceptedNotification object:connection]; 117 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _willConnect: ) name:MVChatConnectionWillConnectNotification object:connection]; 118 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didConnect: ) name:MVChatConnectionDidConnectNotification object:connection]; 119 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didChange: ) name:MVChatConnectionDidNotConnectNotification object:connection]; 120 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _didDisconnect: ) name:MVChatConnectionDidDisconnectNotification object:connection]; 121 122 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _errorOccurred : ) name:MVChatConnectionErrorNotification object:connection]; 123 124 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _requestPassword: ) name:MVChatConnectionNeedNicknamePasswordNotification object:connection]; 125 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _requestCertificatePassword: ) name:MVChatConnectionNeedCertificatePasswordNotification object:connection]; 126 // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector( _requestPublicKeyVerification: ) name:MVChatConnectionNeedPublicKeyVerificationNotification object:connection]; 127 } 128 129 129 - (void) _willConnect:(NSNotification *) notification { 130 130 MVChatConnection *connection = notification.object; … … 250 250 251 251 CQConnectionTableCell *cell = (CQConnectionTableCell *)[tableView dequeueReusableCellWithIdentifier:@"CQConnectionTableCell"]; 252 if( ! cell ) cell = [[[CQConnectionTableCell alloc] init ] autorelease];252 if( ! cell ) cell = [[[CQConnectionTableCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"CQConnectionTableCell"] autorelease]; 253 253 254 254 [cell takeValuesFromConnection:connection]; trunk/Mobile/Views/CQPreferencesTextCell.h
r3785 r3801 5 5 @property (nonatomic, copy) NSString *label; 6 6 @property (nonatomic, copy) NSString *text; 7 @property (nonatomic, copy) NSString *placeholder; 8 @property (nonatomic, getter=isSecureTextEntry) BOOL secureTextEntry; 7 9 @property (nonatomic, readonly) UITextField *textField; 8 10 @end trunk/Mobile/Views/CQPreferencesTextCell.m
r3785 r3801 6 6 return nil; 7 7 8 self.backgroundColor = [UIColor clearColor]; 9 self.opaque = NO; 10 8 11 _textField = [[UITextField alloc] initWithFrame:CGRectZero]; 9 12 _label = [[UILabel alloc] initWithFrame:CGRectZero]; 10 11 _textField.leftView = _label;12 _textField.leftViewMode = UITextFieldViewModeAlways;13 14 [self.contentView addSubview:_textField];15 16 _textField.font = [UIFont systemFontOfSize:14.];17 _textField.textColor = [UIColor colorWithRed:0.19607843 green:0.29803922 blue:0.84313725 alpha:1.];18 13 19 14 _label.font = [UIFont boldSystemFontOfSize:18.]; 20 15 _label.textColor = self.textColor; 21 16 _label.highlightedTextColor = self.selectedTextColor; 17 _label.backgroundColor = [UIColor clearColor]; 18 _label.opaque = NO; 19 20 _textField.textAlignment = UITextAlignmentLeft; 21 _textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 22 _textField.font = [UIFont systemFontOfSize:14.]; 23 _textField.textColor = [UIColor colorWithRed:0.235294117647059 green:0.341176470588235 blue:0.545098039215686 alpha:1.]; 24 _textField.backgroundColor = [UIColor clearColor]; 25 _textField.opaque = NO; 26 27 [self.contentView addSubview:_label]; 28 [self.contentView addSubview:_textField]; 22 29 23 30 return self; … … 48 55 } 49 56 57 - (NSString *) placeholder { 58 return _textField.placeholder; 59 } 60 61 - (void) setPlaceholder:(NSString *) placeholder { 62 _textField.placeholder = placeholder; 63 } 64 65 - (BOOL) isSecureTextEntry { 66 return _textField.secureTextEntry; 67 } 68 69 - (void) setSecureTextEntry:(BOOL) flag { 70 _textField.secureTextEntry = flag; 71 } 72 50 73 - (void) setSelected:(BOOL) selected animated:(BOOL) animated { 51 74 [super setSelected:selected animated:animated]; 52 75 53 UIColor *backgroundColor = nil; 54 if( selected || animated ) backgroundColor = nil; 55 else backgroundColor = [UIColor whiteColor]; 76 _label.highlighted = selected; 77 } 56 78 57 _textField.backgroundColor = backgroundColor; 58 _textField.opaque = !selected && !animated; 59 60 _label.backgroundColor = backgroundColor; 61 _label.highlighted = selected; 62 _label.opaque = !selected && !animated; 79 - (void) prepareForReuse { 80 self.label = @""; 81 self.text = @""; 82 self.placeholder = @""; 83 self.secureTextEntry = NO; 63 84 } 64 85 … … 67 88 68 89 CGRect contentRect = self.contentView.bounds; 90 contentRect.origin.x = 10.; 91 contentRect.size.width = 130.; 92 93 _label.frame = contentRect; 94 95 contentRect = self.contentView.bounds; 96 contentRect.origin.x = 150.; 97 contentRect.size.width -= 160.; 69 98 70 99 _textField.frame = contentRect;
