diff options
author | stuconnolly <stuart02@gmail.com> | 2010-06-15 10:41:34 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-06-15 10:41:34 +0000 |
commit | 1b2c88384d941b28437feaf9d408ca343c485f7e (patch) | |
tree | ad170503f07fc33b0a4cd486daa33a058fafedc9 | |
parent | bb77a4a36318cdb0a101a1ceba04d35301a64026 (diff) | |
download | sequelpro-1b2c88384d941b28437feaf9d408ca343c485f7e.tar.gz sequelpro-1b2c88384d941b28437feaf9d408ca343c485f7e.tar.bz2 sequelpro-1b2c88384d941b28437feaf9d408ca343c485f7e.zip |
Revert a change made in r2320 that required an explicit name when adding new index.
-rw-r--r-- | Interfaces/English.lproj/IndexesView.xib | 8 | ||||
-rw-r--r-- | Source/SPIndexesController.m | 32 |
2 files changed, 11 insertions, 29 deletions
diff --git a/Interfaces/English.lproj/IndexesView.xib b/Interfaces/English.lproj/IndexesView.xib index 34349bdf..7aa20238 100644 --- a/Interfaces/English.lproj/IndexesView.xib +++ b/Interfaces/English.lproj/IndexesView.xib @@ -343,7 +343,7 @@ <int key="NSTag">1</int> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="289434200"> - <int key="NSCellFlags">604110336</int> + <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">138018816</int> <string key="NSContents">Add</string> <reference key="NSSupport" ref="26"/> @@ -792,9 +792,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{568, 540}, {267, 139}}</string> + <string>{{644, 219}, {267, 139}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{568, 540}, {267, 139}}</string> + <string>{{644, 219}, {267, 139}}</string> <integer value="1"/> <integer value="0"/> <integer value="1"/> @@ -1303,6 +1303,7 @@ <string>indexTypePopUpButton</string> <string>indexedColumnsComboBox</string> <string>indexesTableView</string> + <string>removeIndexButton</string> <string>tableData</string> <string>tableStructure</string> <string>tablesList</string> @@ -1315,6 +1316,7 @@ <string>NSPopUpButton</string> <string>NSComboBox</string> <string>NSTableView</string> + <string>NSButton</string> <string>SPTableData</string> <string>SPTableStructure</string> <string>SPTablesList</string> diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 819a8bc2..1c0fe8db 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -231,11 +231,9 @@ /** * Performs various interface validation */ -- (void)tableViewSelectionDidChange:(NSNotification *)aNotification +- (void)tableViewSelectionDidChange:(NSNotification *)notification { - id object = [aNotification object]; - - if (object == indexesTableView) { + if ([notification object] == indexesTableView) { // Check if there is currently an index selected and change button state accordingly [removeIndexButton setEnabled:([indexesTableView numberOfSelectedRows] > 0 && [tablesList tableType] == SPTableTypeTable)]; @@ -247,30 +245,12 @@ #pragma mark Text field delegate methods /** - * When an index other than a primary key is being added ensure there is a name specified. + * Only enable the add button if there is at least one indexed column. */ - (void)controlTextDidChange:(NSNotification *)notification -{ - // Only proceed if we are not adding a primary key - if ([indexTypePopUpButton indexOfSelectedItem] == 0) return; - - if ([notification object] == indexNameTextField) { - [addIndexButton setEnabled:(([[[indexNameTextField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0) && - ([[[indexedColumnsComboBox stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0))]; - } -} - -#pragma mark - -#pragma mark Combo box delegate methods - -/** - * Only enable the add button if there is an index name and at least one indexed column. - */ -- (void)comboBoxSelectionDidChange:(NSNotification *)notification -{ - if ([notification object] == indexedColumnsComboBox) { - [addIndexButton setEnabled:(([[[indexNameTextField stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0) && - ([[[indexedColumnsComboBox stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0))]; +{ + if ([notification object] == indexedColumnsComboBox) { + [addIndexButton setEnabled:([[[indexedColumnsComboBox stringValue] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0)]; } } |