diff options
author | Max <post@wickenrode.com> | 2015-10-31 01:26:59 +0100 |
---|---|---|
committer | Max <post@wickenrode.com> | 2015-10-31 01:26:59 +0100 |
commit | 57955871fb174eefc56dfedcd8222d2e68272ca5 (patch) | |
tree | ef6cb0497fbb0abefb20f1bb5c92a08612088a67 /Source/SPTableStructureDelegate.m | |
parent | d5dd74e8f3b1a73b125fa66db7b08b269933819d (diff) | |
download | sequelpro-57955871fb174eefc56dfedcd8222d2e68272ca5.tar.gz sequelpro-57955871fb174eefc56dfedcd8222d2e68272ca5.tar.bz2 sequelpro-57955871fb174eefc56dfedcd8222d2e68272ca5.zip |
Minimal refactoring
Diffstat (limited to 'Source/SPTableStructureDelegate.m')
-rw-r--r-- | Source/SPTableStructureDelegate.m | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m index 1e470e79..b8db3bff 100644 --- a/Source/SPTableStructureDelegate.m +++ b/Source/SPTableStructureDelegate.m @@ -146,17 +146,17 @@ - (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { - // Make sure that the drag operation is for the right table view + // Make sure that the operation is for the right table view if (aTableView != tableSourceView) return; + + NSMutableDictionary *currentRow = NSArrayObjectAtIndex(tableFields,rowIndex); if (!isEditingRow) { - [oldRow setDictionary:[tableFields objectAtIndex:rowIndex]]; + [oldRow setDictionary:currentRow]; isEditingRow = YES; currentlyEditingRow = rowIndex; } - - NSMutableDictionary *currentRow = [tableFields objectAtIndex:rowIndex]; - + // Reset collation if encoding was changed if ([[aTableColumn identifier] isEqualToString:@"encoding"]) { if ([[currentRow objectForKey:@"encoding"] integerValue] != [anObject integerValue]) { @@ -286,7 +286,7 @@ - (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)operation { // Make sure that the drag operation is for the right table view - if (tableView!=tableSourceView) return NO; + if (tableView!=tableSourceView) return NSDragOperationNone; NSArray *pboardTypes = [[info draggingPasteboard] types]; NSInteger originalRow; @@ -457,10 +457,8 @@ */ - (void)tableViewSelectionDidChange:(NSNotification *)aNotification { - id object = [aNotification object]; - // Check for which table view the selection changed - if (object == tableSourceView) { + if ([aNotification object] == tableSourceView) { // If we are editing a row, attempt to save that row - if saving failed, reselect the edit row. if (isEditingRow && [tableSourceView selectedRow] != currentlyEditingRow && ![self saveRowOnDeselect]) return; @@ -557,10 +555,9 @@ [self cancelRowEditing]; return YES; - } - else { - return NO; } + + return NO; } /** @@ -577,7 +574,7 @@ } else { // Validate cell against current field type - NSString *rowType = @""; + NSString *rowType; NSDictionary *row = NSArrayObjectAtIndex(tableFields, rowIndex); if ((rowType = [row objectForKey:@"type"])) { @@ -692,7 +689,7 @@ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF BEGINSWITH[c] %@", [uncompletedString uppercaseString]]; NSArray *result = [typeSuggestions filteredArrayUsingPredicate:predicate]; - if (result && [result count]) return [result objectAtIndex:0]; + if ([result count]) return [result objectAtIndex:0]; return @""; } |