Permalink
Browse files

Increased number of maximum accounts to 32.

Fixes issue 369.
  • Loading branch information...
1 parent 93d89e7 commit 70321e6432f17e33659097f37cd2b359b7f10139 @eofster committed Dec 5, 2010
View
2 AccountPreferencesViewController.h
@@ -40,6 +40,7 @@
AccountSetupController *accountSetupController_;
NSTableView *accountsTable_;
+ NSButton *addAccountButton_;
NSButton *accountEnabledCheckBox_;
NSTextField *accountDescriptionField_;
NSTextField *fullNameField_;
@@ -65,6 +66,7 @@
// Outlets.
@property(nonatomic, retain) IBOutlet NSTableView *accountsTable;
+@property(nonatomic, retain) IBOutlet NSButton *addAccountButton;
@property(nonatomic, retain) IBOutlet NSButton *accountEnabledCheckBox;
@property(nonatomic, retain) IBOutlet NSTextField *accountDescriptionField;
@property(nonatomic, retain) IBOutlet NSTextField *fullNameField;
View
22 AccountPreferencesViewController.m
@@ -39,12 +39,16 @@
// Pasteboard type.
static NSString * const kAKSIPAccountPboardType = @"AKSIPAccountPboardType";
+// Maximum number of accounts.
+static const NSUInteger kAccountsMax = 32;
+
@implementation AccountPreferencesViewController
@synthesize preferencesController = preferencesController_;
@dynamic accountSetupController;
@synthesize accountsTable = accountsTable_;
+@synthesize addAccountButton = addAccountButton_;
@synthesize accountEnabledCheckBox = accountEnabledCheckBox_;
@synthesize accountDescriptionField = accountDescriptionField_;
@synthesize fullNameField = fullNameField_;
@@ -88,6 +92,12 @@ - (void)awakeFromNib {
[self populateFieldsForAccountAtIndex:row];
}
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSUInteger accountsCount = [[defaults arrayForKey:kAccounts] count];
+ if (accountsCount >= kAccountsMax) {
+ [[self addAccountButton] setEnabled:NO];
+ }
+
// Subscribe to the account setup notifications.
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
@@ -98,6 +108,7 @@ - (void)awakeFromNib {
- (void)dealloc {
[accountsTable_ release];
+ [addAccountButton_ release];
[accountEnabledCheckBox_ release];
[accountDescriptionField_ release];
[fullNameField_ release];
@@ -189,6 +200,10 @@ - (void)removeAccountAtIndex:(NSInteger)index {
[defaults setObject:savedAccounts forKey:kAccounts];
[defaults synchronize];
+ if ([savedAccounts count] < kAccountsMax) {
+ [[self addAccountButton] setEnabled:YES];
+ }
+
[[NSNotificationCenter defaultCenter]
postNotificationName:AKPreferencesControllerDidRemoveAccountNotification
object:[self preferencesController]
@@ -752,11 +767,16 @@ - (void)accountSetupControllerDidAddAccount:(NSNotification *)notification {
// Select the newly added account.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSUInteger index = [[defaults arrayForKey:kAccounts] count] - 1;
+ NSUInteger accountsCount = [[defaults arrayForKey:kAccounts] count];
+ NSUInteger index = accountsCount - 1;
if (index != 0) {
[[self accountsTable] selectRowIndexes:[NSIndexSet indexSetWithIndex:index]
byExtendingSelection:NO];
}
+
+ if (accountsCount >= kAccountsMax) {
+ [[self addAccountButton] setEnabled:NO];
+ }
}
@end
View
17 English.lproj/AccountPreferencesView.xib
@@ -1081,6 +1081,14 @@
</object>
<int key="connectionID">550</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">addAccountButton</string>
+ <reference key="source" ref="502969037"/>
+ <reference key="destination" ref="414082300"/>
+ </object>
+ <int key="connectionID">551</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -1619,7 +1627,7 @@
<string key="119.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="120.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="121.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="148.IBEditorWindowLastContentRect">{{460, 506}, {508, 327}}</string>
+ <string key="148.IBEditorWindowLastContentRect">{{285, 506}, {508, 327}}</string>
<string key="148.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary" key="409.IBAttributePlaceholdersKey">
<string key="NS.key.0">InitialTabViewItem</string>
@@ -1684,7 +1692,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">550</int>
+ <int key="maxID">551</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1725,6 +1733,7 @@
<string key="accountDescriptionField">NSTextField</string>
<string key="accountEnabledCheckBox">NSButton</string>
<string key="accountsTable">NSTableView</string>
+ <string key="addAccountButton">NSButton</string>
<string key="cantEditAccountLabel">NSTextField</string>
<string key="domainField">NSTextField</string>
<string key="fullNameField">NSTextField</string>
@@ -1755,6 +1764,10 @@
<string key="name">accountsTable</string>
<string key="candidateClassName">NSTableView</string>
</object>
+ <object class="IBToOneOutletInfo" key="addAccountButton">
+ <string key="name">addAccountButton</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
<object class="IBToOneOutletInfo" key="cantEditAccountLabel">
<string key="name">cantEditAccountLabel</string>
<string key="candidateClassName">NSTextField</string>
View
122 German.lproj/AccountPreferencesView.xib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10D573</string>
- <string key="IBDocument.InterfaceBuilderVersion">762</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">823</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">762</string>
+ <string key="NS.object.0">823</string>
</object>
<array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<integer value="148"/>
@@ -1081,6 +1081,14 @@
</object>
<int key="connectionID">446</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">addAccountButton</string>
+ <reference key="source" ref="941024433"/>
+ <reference key="destination" ref="978584326"/>
+ </object>
+ <int key="connectionID">447</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -1619,7 +1627,7 @@
<string key="119.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="120.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="121.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="148.IBEditorWindowLastContentRect">{{445, 545}, {540, 330}}</string>
+ <string key="148.IBEditorWindowLastContentRect">{{214, 432}, {540, 330}}</string>
<string key="148.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary" key="333.IBAttributePlaceholdersKey">
<string key="NS.key.0">InitialTabViewItem</string>
@@ -1684,7 +1692,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">446</int>
+ <int key="maxID">447</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1698,11 +1706,34 @@
<string key="showAddAccountSheet:">id</string>
<string key="showRemoveAccountSheet:">id</string>
</dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="changeAccountEnabled:">
+ <string key="name">changeAccountEnabled:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="changeSubstitutePlusCharacter:">
+ <string key="name">changeSubstitutePlusCharacter:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="changeUseProxy:">
+ <string key="name">changeUseProxy:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="showAddAccountSheet:">
+ <string key="name">showAddAccountSheet:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="showRemoveAccountSheet:">
+ <string key="name">showRemoveAccountSheet:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="SIPAddressField">NSTextField</string>
<string key="accountDescriptionField">NSTextField</string>
<string key="accountEnabledCheckBox">NSButton</string>
<string key="accountsTable">NSTableView</string>
+ <string key="addAccountButton">NSButton</string>
<string key="cantEditAccountLabel">NSTextField</string>
<string key="domainField">NSTextField</string>
<string key="fullNameField">NSTextField</string>
@@ -1716,6 +1747,76 @@
<string key="useProxyCheckBox">NSButton</string>
<string key="usernameField">NSTextField</string>
</dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="SIPAddressField">
+ <string key="name">SIPAddressField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="accountDescriptionField">
+ <string key="name">accountDescriptionField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="accountEnabledCheckBox">
+ <string key="name">accountEnabledCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="accountsTable">
+ <string key="name">accountsTable</string>
+ <string key="candidateClassName">NSTableView</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="addAccountButton">
+ <string key="name">addAccountButton</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="cantEditAccountLabel">
+ <string key="name">cantEditAccountLabel</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="domainField">
+ <string key="name">domainField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="fullNameField">
+ <string key="name">fullNameField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="passwordField">
+ <string key="name">passwordField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="plusCharacterSubstitutionField">
+ <string key="name">plusCharacterSubstitutionField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="proxyHostField">
+ <string key="name">proxyHostField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="proxyPortField">
+ <string key="name">proxyPortField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="registrarField">
+ <string key="name">registrarField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="reregistrationTimeField">
+ <string key="name">reregistrationTimeField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="substitutePlusCharacterCheckBox">
+ <string key="name">substitutePlusCharacterCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="useProxyCheckBox">
+ <string key="name">useProxyCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="usernameField">
+ <string key="name">usernameField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">AccountPreferencesViewController.h</string>
@@ -2224,6 +2325,13 @@
<string key="NS.key.0">view</string>
<string key="NS.object.0">NSView</string>
</object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">view</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">view</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSViewController.h</string>
View
122 Russian.lproj/AccountPreferencesView.xib
@@ -2,13 +2,13 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1060</int>
- <string key="IBDocument.SystemVersion">10D573</string>
- <string key="IBDocument.InterfaceBuilderVersion">762</string>
- <string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <string key="IBDocument.SystemVersion">10H574</string>
+ <string key="IBDocument.InterfaceBuilderVersion">823</string>
+ <string key="IBDocument.AppKitVersion">1038.35</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="NS.object.0">762</string>
+ <string key="NS.object.0">823</string>
</object>
<array class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<integer value="148"/>
@@ -1081,6 +1081,14 @@
</object>
<int key="connectionID">448</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">addAccountButton</string>
+ <reference key="source" ref="482428191"/>
+ <reference key="destination" ref="760311339"/>
+ </object>
+ <int key="connectionID">449</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -1619,7 +1627,7 @@
<string key="119.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="120.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="121.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string key="148.IBEditorWindowLastContentRect">{{448, 471}, {539, 327}}</string>
+ <string key="148.IBEditorWindowLastContentRect">{{254, 471}, {539, 327}}</string>
<string key="148.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSMutableDictionary" key="334.IBAttributePlaceholdersKey">
<string key="NS.key.0">InitialTabViewItem</string>
@@ -1684,7 +1692,7 @@
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">448</int>
+ <int key="maxID">449</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -1698,11 +1706,34 @@
<string key="showAddAccountSheet:">id</string>
<string key="showRemoveAccountSheet:">id</string>
</dictionary>
+ <dictionary class="NSMutableDictionary" key="actionInfosByName">
+ <object class="IBActionInfo" key="changeAccountEnabled:">
+ <string key="name">changeAccountEnabled:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="changeSubstitutePlusCharacter:">
+ <string key="name">changeSubstitutePlusCharacter:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="changeUseProxy:">
+ <string key="name">changeUseProxy:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="showAddAccountSheet:">
+ <string key="name">showAddAccountSheet:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo" key="showRemoveAccountSheet:">
+ <string key="name">showRemoveAccountSheet:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </dictionary>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="SIPAddressField">NSTextField</string>
<string key="accountDescriptionField">NSTextField</string>
<string key="accountEnabledCheckBox">NSButton</string>
<string key="accountsTable">NSTableView</string>
+ <string key="addAccountButton">NSButton</string>
<string key="cantEditAccountLabel">NSTextField</string>
<string key="domainField">NSTextField</string>
<string key="fullNameField">NSTextField</string>
@@ -1716,6 +1747,76 @@
<string key="useProxyCheckBox">NSButton</string>
<string key="usernameField">NSTextField</string>
</dictionary>
+ <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <object class="IBToOneOutletInfo" key="SIPAddressField">
+ <string key="name">SIPAddressField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="accountDescriptionField">
+ <string key="name">accountDescriptionField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="accountEnabledCheckBox">
+ <string key="name">accountEnabledCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="accountsTable">
+ <string key="name">accountsTable</string>
+ <string key="candidateClassName">NSTableView</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="addAccountButton">
+ <string key="name">addAccountButton</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="cantEditAccountLabel">
+ <string key="name">cantEditAccountLabel</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="domainField">
+ <string key="name">domainField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="fullNameField">
+ <string key="name">fullNameField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="passwordField">
+ <string key="name">passwordField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="plusCharacterSubstitutionField">
+ <string key="name">plusCharacterSubstitutionField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="proxyHostField">
+ <string key="name">proxyHostField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="proxyPortField">
+ <string key="name">proxyPortField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="registrarField">
+ <string key="name">registrarField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="reregistrationTimeField">
+ <string key="name">reregistrationTimeField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="substitutePlusCharacterCheckBox">
+ <string key="name">substitutePlusCharacterCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="useProxyCheckBox">
+ <string key="name">useProxyCheckBox</string>
+ <string key="candidateClassName">NSButton</string>
+ </object>
+ <object class="IBToOneOutletInfo" key="usernameField">
+ <string key="name">usernameField</string>
+ <string key="candidateClassName">NSTextField</string>
+ </object>
+ </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">AccountPreferencesViewController.h</string>
@@ -2224,6 +2325,13 @@
<string key="NS.key.0">view</string>
<string key="NS.object.0">NSView</string>
</object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">view</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">view</string>
+ <string key="candidateClassName">NSView</string>
+ </object>
+ </object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSViewController.h</string>

0 comments on commit 70321e6

Please sign in to comment.