diff options
author | Abhi Beckert <abhi@Twist-of-Lemon-2.local> | 2015-05-16 08:06:06 +1000 |
---|---|---|
committer | Abhi Beckert <abhi@Twist-of-Lemon-2.local> | 2015-05-16 08:06:06 +1000 |
commit | 57a6f6c73bdaa202164645370d37fcbe5d14a092 (patch) | |
tree | dd30aa6156064f1d4c0e10ea87059625470fc2f9 /Source/SPNavigatorController.m | |
parent | b5e972f4504043dfb9c358e272e93fb59ae2127f (diff) | |
parent | 0f0c43eb74408b6a65a42e2c6fd46f4142ef8e3f (diff) | |
download | sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.gz sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.tar.bz2 sequelpro-57a6f6c73bdaa202164645370d37fcbe5d14a092.zip |
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPNavigatorController.m')
-rw-r--r-- | Source/SPNavigatorController.m | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 1a7e52fd..3f194b24 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -109,21 +109,21 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - if(schemaDataFiltered) [schemaDataFiltered release]; - if(allSchemaKeys) [allSchemaKeys release]; - if(schemaData) [schemaData release]; - if(infoArray) [infoArray release]; - if(updatingConnections) [updatingConnections release]; - if(expandStatus2) [expandStatus2 release]; - if(cachedSortedKeys) [cachedSortedKeys release]; + if(schemaDataFiltered) SPClear(schemaDataFiltered); + if(allSchemaKeys) SPClear(allSchemaKeys); + if(schemaData) SPClear(schemaData); + if(infoArray) SPClear(infoArray); + if(updatingConnections) SPClear(updatingConnections); + if(expandStatus2) SPClear(expandStatus2); + if(cachedSortedKeys) SPClear(cachedSortedKeys); #ifndef SP_CODA /* dealloc ivars */ - [connectionIcon release]; - [databaseIcon release]; - [tableIcon release]; - [viewIcon release]; - [procedureIcon release]; - [functionIcon release]; - [fieldIcon release]; + SPClear(connectionIcon); + SPClear(databaseIcon); + SPClear(tableIcon); + SPClear(viewIcon); + SPClear(procedureIcon); + SPClear(functionIcon); + SPClear(fieldIcon); #endif [super dealloc]; @@ -155,7 +155,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [schemaStatusSplitView setMinSize:16.f ofSubviewAtIndex:1]; [self setWindowFrameAutosaveName:@"SPNavigator"]; - [outlineSchema2 registerForDraggedTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType, nil]]; + [outlineSchema2 registerForDraggedTypes:@[SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType]]; [outlineSchema2 setDraggingSourceOperationMask:NSDragOperationEvery forLocal:YES]; [outlineSchema2 setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; @@ -312,8 +312,8 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte // Detect if more than one connection windows with the connectionID are open. // If so, don't remove it. - if ([[NSApp delegate] frontDocument]) { - for(id doc in [[NSApp delegate] orderedDocuments]) { + if ([SPAppDelegate frontDocument]) { + for(id doc in [SPAppDelegate orderedDocuments]) { if([[doc connectionID] isEqualToString:connectionID]) docCounter++; if(docCounter > 1) break; @@ -322,7 +322,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if(docCounter > 1) return; - if(schemaData && [schemaData objectForKey:connectionID] && [[NSApp delegate] frontDocument] && [[[NSApp delegate] orderedDocuments] count]) + if(schemaData && [schemaData objectForKey:connectionID] && [SPAppDelegate frontDocument] && [[SPAppDelegate orderedDocuments] count]) [self saveSelectedItems]; if(schemaDataFiltered) @@ -374,7 +374,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte NSArray *pathArray = [[[parentKeys objectAtIndex:0] description] componentsSeparatedByString:SPUniqueSchemaDelimiter]; if([pathArray count] > 1) { - SPDatabaseDocument *doc = [[NSApp delegate] frontDocument]; + SPDatabaseDocument *doc = [SPAppDelegate frontDocument]; if([doc isWorking]) { [SPTooltip showWithObject:NSLocalizedString(@"Active connection window is busy. Please wait and try again.", @"active connection window is busy. please wait and try again. tooltip") atLocation:pos @@ -466,8 +466,8 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if(a) [allSchemaKeys setObject:a forKey:connectionName]; } else { - [schemaData setObject:[NSDictionary dictionary] forKey:[NSString stringWithFormat:@"%@&DEL&no data loaded yet", connectionName]]; - [allSchemaKeys setObject:[NSArray array] forKey:connectionName]; + [schemaData setObject:@{} forKey:[NSString stringWithFormat:@"%@&DEL&no data loaded yet", connectionName]]; + [allSchemaKeys setObject:@[] forKey:connectionName]; } [updatingConnections removeObject:connectionName]; @@ -547,12 +547,12 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte } } - if([result count] < 1 ) return [NSArray arrayWithObjects:[NSNumber numberWithInt:0], @"", nil]; + if([result count] < 1 ) return @[@0, @""]; if([result count] == 1) { NSArray *split = [[result objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter]; - if([split count] == 2 ) return [NSArray arrayWithObjects:[NSNumber numberWithInt:1], [split lastObject], nil]; - if([split count] == 3 ) return [NSArray arrayWithObjects:[NSNumber numberWithInt:2], [split lastObject], nil]; - return [NSArray arrayWithObjects:[NSNumber numberWithInt:0], @"", nil]; + if([split count] == 2 ) return [NSArray arrayWithObjects:@1, [split lastObject], nil]; + if([split count] == 3 ) return [NSArray arrayWithObjects:@2, [split lastObject], nil]; + return @[@0, @""]; } // case if field is equal to a table or db name NSMutableArray *arr = [NSMutableArray array]; @@ -560,14 +560,13 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if([[item componentsSeparatedByString:SPUniqueSchemaDelimiter] count] < 4) [arr addObject:item]; } - if([arr count] < 1 ) [NSArray arrayWithObjects:[NSNumber numberWithInt:0], @"", nil]; if([arr count] == 1) { NSArray *split = [[arr objectAtIndex:0] componentsSeparatedByString:SPUniqueSchemaDelimiter]; - if([split count] == 2 ) [NSArray arrayWithObjects:[NSNumber numberWithInt:1], [split lastObject], nil]; - if([split count] == 3 ) [NSArray arrayWithObjects:[NSNumber numberWithInt:2], [split lastObject], nil]; - return [NSArray arrayWithObjects:[NSNumber numberWithInt:0], @"", nil]; + if([split count] == 2 ) [NSArray arrayWithObjects:@1, [split lastObject], nil]; + if([split count] == 3 ) [NSArray arrayWithObjects:@2, [split lastObject], nil]; + return @[@0, @""]; } - return [NSArray arrayWithObjects:[NSNumber numberWithInt:0], @"", nil]; + return @[@0, @""]; } #ifndef SP_CODA @@ -590,7 +589,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte { // Reset everything for current active doc connection - SPDatabaseDocument *doc = [[NSApp delegate] frontDocument]; + SPDatabaseDocument *doc = [SPAppDelegate frontDocument]; if(!doc) return; NSString *connectionID = [doc connectionID]; if(!connectionID || [connectionID length] < 2) return; @@ -611,7 +610,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte if (![[doc getConnection] isConnected]) return; - [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[doc databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], @"forceUpdate", nil]]; + [NSThread detachNewThreadWithName:@"SPNavigatorController database structure querier" target:[doc databaseStructureRetrieval] selector:@selector(queryDbStructureWithUserInfo:) object:@{@"forceUpdate" : @YES}]; } - (IBAction)outlineViewAction:(id)sender @@ -694,7 +693,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [[[[schemaData objectForKey:connectionID] objectForKey:db_id] objectForKey:table_id] objectForKey:@" struct_type "] forKey:@" struct_type "]; else [[[[structure valueForKey:connectionID] valueForKey:db_id] valueForKey:table_id] setObject: - [NSNumber numberWithInt:0] forKey:@" struct_type "]; + @0 forKey:@" struct_type "]; if([a count] > 3) { NSString *field_id = [NSString stringWithFormat:@"%@%@%@", table_id,SPUniqueSchemaDelimiter,[a objectAtIndex:3]]; @@ -750,7 +749,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte [searchField setStringValue:@""]; } - SPDatabaseDocument *doc = [[NSApp delegate] frontDocument]; + SPDatabaseDocument *doc = [SPAppDelegate frontDocument]; if (doc) { NSMutableString *key = [NSMutableString string]; [key setString:[doc connectionID]]; @@ -1113,7 +1112,7 @@ static NSComparisonResult compareStrings(NSString *s1, NSString *s2, void* conte - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard { // Provide data for our custom type, and simple NSStrings. - [pboard declareTypes:[NSArray arrayWithObjects:SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType, nil] owner:self]; + [pboard declareTypes:@[SPNavigatorTableDataPasteboardDragType, SPNavigatorPasteboardDragType, NSStringPboardType] owner:self]; // Collect the actual schema paths without leading connection ID NSMutableArray *draggedItems = [NSMutableArray array]; |