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 | |
parent | d5dd74e8f3b1a73b125fa66db7b08b269933819d (diff) | |
download | sequelpro-57955871fb174eefc56dfedcd8222d2e68272ca5.tar.gz sequelpro-57955871fb174eefc56dfedcd8222d2e68272ca5.tar.bz2 sequelpro-57955871fb174eefc56dfedcd8222d2e68272ca5.zip |
Minimal refactoring
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPExportSettingsPersistence.h | 2 | ||||
-rw-r--r-- | Source/SPExtendedTableInfo.m | 2 | ||||
-rw-r--r-- | Source/SPIndexesController.m | 4 | ||||
-rw-r--r-- | Source/SPTableContent.m | 22 | ||||
-rw-r--r-- | Source/SPTableStructureDelegate.m | 25 |
5 files changed, 26 insertions, 29 deletions
diff --git a/Source/SPExportSettingsPersistence.h b/Source/SPExportSettingsPersistence.h index 2f9104c4..90f29cfe 100644 --- a/Source/SPExportSettingsPersistence.h +++ b/Source/SPExportSettingsPersistence.h @@ -39,6 +39,6 @@ /** * @return A serialized form of the "custom filename" field */ -- (NSDictionary *)currentCustomFilenameAsArray; +- (NSArray *)currentCustomFilenameAsArray; @end diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 92b845e9..26574621 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -119,7 +119,7 @@ static NSString *SPMySQLCommentField = @"Comment"; if ([currentType isEqualToString:newType]) return; // If the table is empty, perform the change directly - if ([[[tableDataInstance statusValues] objectForKey:SPMySQLRowsField] isEqualToString:@"0"]) { + if ([[tableDataInstance statusValueForKey:SPMySQLRowsField] isEqualToString:@"0"]) { [self _changeCurrentTableTypeFrom:currentType to:newType]; return; } diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index a885ff01..5b239ec0 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -166,8 +166,8 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; // Check whether a save of the current field row is required. if (![tableStructure saveRowOnDeselect]) return; - isMyISAMTable = [[[tableData statusValues] objectForKey:@"Engine"] isEqualToString:@"MyISAM"]; - isInnoDBTable = [[[tableData statusValues] objectForKey:@"Engine"] isEqualToString:@"InnoDB"]; + isMyISAMTable = [[tableData statusValueForKey:@"Engine"] isEqualToString:@"MyISAM"]; + isInnoDBTable = [[tableData statusValueForKey:@"Engine"] isEqualToString:@"InnoDB"]; // Reset visibility of the primary key item [[[indexTypePopUpButton menu] itemWithTag:SPPrimaryKeyMenuTag] setHidden:NO]; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 2caa80da..14bae14a 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -320,7 +320,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // Attempt to retrieve the table encoding; if that fails (indicating an error occurred // while retrieving table data), or if the Rows variable is null, clear and return - if (![tableDataInstance tableEncoding] || [[[tableDataInstance statusValues] objectForKey:@"Rows"] isNSNull]) { + if (![tableDataInstance tableEncoding] || [[tableDataInstance statusValueForKey:@"Rows"] isNSNull]) { [[self onMainThread] setTableDetails:nil]; return; } @@ -3992,16 +3992,16 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper // If the state is now accurate, use it if ([[tableDataInstance statusValueForKey:@"RowsCountAccurate"] boolValue]) { - maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] integerValue]; - maxNumRowsIsEstimate = NO; - checkStatusCount = YES; + maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] integerValue]; + maxNumRowsIsEstimate = NO; + checkStatusCount = YES; - // Otherwise, use the estimate count - } else { - maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] integerValue]; - maxNumRowsIsEstimate = YES; - checkStatusCount = YES; - } + // Otherwise, use the estimate count + } else { + maxNumRows = [[tableDataInstance statusValueForKey:@"Rows"] integerValue]; + maxNumRowsIsEstimate = YES; + checkStatusCount = YES; + } } // Check whether the estimated count requires updating, ie if the retrieved count exceeds it @@ -4102,7 +4102,7 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper return; #endif - if ( ![[[tableDataInstance statusValues] objectForKey:@"Rows"] isNSNull] && selectedTable && [selectedTable length] && [tableDataInstance tableEncoding]) { + if ( ![[tableDataInstance statusValueForKey:@"Rows"] isNSNull] && selectedTable && [selectedTable length] && [tableDataInstance tableEncoding]) { [addButton setEnabled:([tablesListInstance tableType] == SPTableTypeTable)]; [self updatePaginationState]; [reloadButton setEnabled:YES]; 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 @""; } |