Skip to content

Commit

Permalink
Merge pull request #220 from eofster/text-field-cell
Browse files Browse the repository at this point in the history
Call methods directly on NSTextField
  • Loading branch information
eofster committed Apr 22, 2016
2 parents 4c05b0e + 8d9b742 commit af61f04
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
30 changes: 15 additions & 15 deletions Telephone/AccountPreferencesViewController.m
Expand Up @@ -233,9 +233,9 @@ - (void)populateFieldsForAccountAtIndex:(NSInteger)index {

// Description's placeholder string.
if ([accountDict[kSIPAddress] length] > 0) {
[[[self accountDescriptionField] cell] setPlaceholderString:accountDict[kSIPAddress]];
[[self accountDescriptionField] setPlaceholderString:accountDict[kSIPAddress]];
} else {
[[[self accountDescriptionField] cell] setPlaceholderString:
[[self accountDescriptionField] setPlaceholderString:
[NSString stringWithFormat:@"%@@%@",
accountDict[kUsername], accountDict[kDomain]]];
}
Expand Down Expand Up @@ -308,11 +308,11 @@ - (void)populateFieldsForAccountAtIndex:(NSInteger)index {

// SIP Address and Registry Server placeholder strings.
if ([accountDict[kDomain] length] > 0) {
[[[self SIPAddressField] cell] setPlaceholderString:[NSString stringWithFormat:@"%@@%@", accountDict[kUsername], accountDict[kDomain]]];
[[[self registrarField] cell] setPlaceholderString:accountDict[kDomain]];
[[self SIPAddressField] setPlaceholderString:[NSString stringWithFormat:@"%@@%@", accountDict[kUsername], accountDict[kDomain]]];
[[self registrarField] setPlaceholderString:accountDict[kDomain]];
} else {
[[[self SIPAddressField] cell] setPlaceholderString:nil];
[[[self registrarField] cell] setPlaceholderString:nil];
[[self SIPAddressField] setPlaceholderString:nil];
[[self registrarField] setPlaceholderString:nil];
}

// Update headers checkbox.
Expand All @@ -325,7 +325,7 @@ - (void)populateFieldsForAccountAtIndex:(NSInteger)index {
} else { // if (index >= 0)
[[self accountEnabledCheckBox] setState:NSOffState];
[[self accountDescriptionField] setStringValue:@""];
[[[self accountDescriptionField] cell] setPlaceholderString:nil];
[[self accountDescriptionField] setPlaceholderString:nil];
[[self fullNameField] setStringValue:@""];
[[self domainField] setStringValue:@""];
[[self usernameField] setStringValue:@""];
Expand Down Expand Up @@ -353,9 +353,9 @@ - (void)populateFieldsForAccountAtIndex:(NSInteger)index {
[[self proxyHostField] setEnabled:NO];
[[self proxyPortField] setEnabled:NO];
[[self SIPAddressField] setEnabled:NO];
[[[self SIPAddressField] cell] setPlaceholderString:nil];
[[self SIPAddressField] setPlaceholderString:nil];
[[self registrarField] setEnabled:NO];
[[[self registrarField] cell] setPlaceholderString:nil];
[[self registrarField] setPlaceholderString:nil];
[[self cantEditAccountLabel] setHidden:YES];
[[self updateHeadersCheckBox] setEnabled:NO];
}
Expand Down Expand Up @@ -454,21 +454,21 @@ - (IBAction)changeAccountEnabled:(id)sender {
// Set placeholders.

if ([SIPAddress length] > 0) {
[[[self accountDescriptionField] cell] setPlaceholderString:SIPAddress];
[[self accountDescriptionField] setPlaceholderString:SIPAddress];
} else {
[[[self accountDescriptionField] cell] setPlaceholderString:
[[self accountDescriptionField] setPlaceholderString:
[NSString stringWithFormat:@"%@@%@", username, domain]];
}

if ([domain length] > 0) {
[[[self SIPAddressField] cell] setPlaceholderString:
[[self SIPAddressField] setPlaceholderString:
[NSString stringWithFormat:@"%@@%@", username, domain]];

[[[self registrarField] cell] setPlaceholderString:domain];
[[self registrarField] setPlaceholderString:domain];

} else {
[[[self SIPAddressField] cell] setPlaceholderString:nil];
[[[self registrarField] cell] setPlaceholderString:nil];
[[self SIPAddressField] setPlaceholderString:nil];
[[self registrarField] setPlaceholderString:nil];
}

// Disable account fields.
Expand Down
4 changes: 2 additions & 2 deletions Telephone/ActiveCallViewController.m
Expand Up @@ -172,8 +172,8 @@ - (void)activeCallView:(AKActiveCallView *)sender didReceiveText:(NSString *)aSt
[[self enteredDTMF] appendString:aString];
[[[self view] window] setTitle:[[self callController] displayedName]];

if ([[[self displayedNameField] cell] lineBreakMode]!= NSLineBreakByTruncatingHead) {
[[[self displayedNameField] cell] setLineBreakMode:NSLineBreakByTruncatingHead];
if ([[self displayedNameField] lineBreakMode]!= NSLineBreakByTruncatingHead) {
[[self displayedNameField] setLineBreakMode:NSLineBreakByTruncatingHead];
[[[[self callController] endedCallViewController] displayedNameField] setSelectable:YES];
}

Expand Down
4 changes: 2 additions & 2 deletions Telephone/NetworkPreferencesViewController.m
Expand Up @@ -131,7 +131,7 @@ - (void)networkSettingsChangeAlertDidEndWithReturnCode:(NSModalResponse)returnCo
NSCharacterSet *spacesSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];

if (returnCode == NSAlertFirstButtonReturn) {
[[[self transportPortField] cell] setPlaceholderString:[[self transportPortField] stringValue]];
[[self transportPortField] setPlaceholderString:[[self transportPortField] stringValue]];

[defaults setInteger:[[self transportPortField] integerValue] forKey:kTransportPort];

Expand Down Expand Up @@ -197,7 +197,7 @@ - (void)networkSettingsChangeAlertDidEndWithReturnCode:(NSModalResponse)returnCo

- (void)updateTransportPortPlaceholderWithValueFromUserAgent {
if (self.userAgent.isStarted) {
[[[self transportPortField] cell] setPlaceholderString:
[[self transportPortField] setPlaceholderString:
[NSString stringWithFormat:@"%lu", (unsigned long)self.userAgent.transportPort]];
}
}
Expand Down

0 comments on commit af61f04

Please sign in to comment.