From 994057ae2a82dc110a385ced4239ce49cc0601f8 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 17:20:18 +0100 Subject: Add cast for [NSApp delegate] * (Also changed some outdated URLs) * Replaced [NSApplication sharedApplication] with NSApp --- Source/SPAppController.m | 12 ++++----- Source/SPBundleCommandRunner.m | 7 ++--- Source/SPBundleEditorController.m | 5 ++-- Source/SPBundleHTMLOutputController.m | 14 +++++----- Source/SPChooseMenuItemDialog.m | 2 +- Source/SPConnectionController.m | 8 +++--- Source/SPConnectionControllerDelegate.m | 2 +- Source/SPConstants.h | 2 ++ Source/SPConstants.m | 2 +- Source/SPContentFilterManager.m | 3 ++- Source/SPCopyTable.m | 12 ++++----- Source/SPCustomQuery.m | 6 ++--- Source/SPDatabaseDocument.m | 46 ++++++++++++++++----------------- Source/SPDatabaseViewController.m | 4 +-- Source/SPDocumentController.m | 2 +- Source/SPExportFilenameUtilities.m | 2 +- Source/SPNavigatorController.m | 12 ++++----- Source/SPProcessListController.m | 4 +-- Source/SPQueryDocumentsController.m | 5 ++-- Source/SPQueryFavoriteManager.m | 3 ++- Source/SPServerVariablesController.m | 2 +- Source/SPTableContentDelegate.m | 4 +-- Source/SPTableInfo.m | 3 ++- Source/SPTablesList.m | 6 ++--- Source/SPTextView.m | 6 ++--- Source/SPTextViewAdditions.m | 14 +++++----- Source/SPUserManager.m | 8 +++--- Source/SPWindowControllerDelegate.m | 6 ++--- Source/Sequel-Pro.pch | 2 +- 29 files changed, 106 insertions(+), 98 deletions(-) (limited to 'Source') diff --git a/Source/SPAppController.m b/Source/SPAppController.m index ba9c6cab..8aabce60 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -440,8 +440,8 @@ [spfsDocData setObject:[NSNumber numberWithBool:[[spfs objectForKey:@"save_editor_content"] boolValue]] forKey:@"save_editor_content"]; // Set global session properties - [[NSApp delegate] setSpfSessionDocData:spfsDocData]; - [[NSApp delegate] setSessionURL:[NSURL fileURLWithPath:filePath]]; + [SPAppDelegate setSpfSessionDocData:spfsDocData]; + [SPAppDelegate setSessionURL:[NSURL fileURLWithPath:filePath]]; // Loop through each defined window in reversed order to reconstruct the last active window for (NSDictionary *window in [[[spfs objectForKey:@"windows"] reverseObjectEnumerator] allObjects]) @@ -993,7 +993,7 @@ { NSInteger idx = [sender tag] - 1000000; NSString *infoPath = nil; - NSArray *scopeBundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeGeneral]; + NSArray *scopeBundleItems = [SPAppDelegate bundleItemsForScope:SPBundleScopeGeneral]; if(idx >=0 && idx < (NSInteger)[scopeBundleItems count]) { infoPath = [[scopeBundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey]; } else { @@ -1137,7 +1137,7 @@ [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]]; [c setDocUUID:uuid]; [c displayHTMLContent:output withOptions:nil]; - [[NSApp delegate] addHTMLOutputController:c]; + [SPAppDelegate addHTMLOutputController:c]; } } } @@ -1830,8 +1830,8 @@ BOOL bundleOtherThanGeneralFound = NO; for(NSString* scope in scopes) { - NSArray *scopeBundleCategories = [[NSApp delegate] bundleCategoriesForScope:scope]; - NSArray *scopeBundleItems = [[NSApp delegate] bundleItemsForScope:scope]; + NSArray *scopeBundleCategories = [SPAppDelegate bundleCategoriesForScope:scope]; + NSArray *scopeBundleItems = [SPAppDelegate bundleItemsForScope:scope]; if(![scopeBundleItems count]) { k++; diff --git a/Source/SPBundleCommandRunner.m b/Source/SPBundleCommandRunner.m index 2842ce4e..b8e22b93 100644 --- a/Source/SPBundleCommandRunner.m +++ b/Source/SPBundleCommandRunner.m @@ -30,6 +30,7 @@ #import "SPBundleCommandRunner.h" #import "SPDatabaseDocument.h" +#import "SPAppController.h" // Defined to suppress warnings @interface NSObject (SPBundleMethods) @@ -91,11 +92,11 @@ [fm removeItemAtPath:scriptFilePath error:nil]; [fm removeItemAtPath:stdoutFilePath error:nil]; - if([[NSApp delegate] lastBundleBlobFilesDirectory] != nil) - [fm removeItemAtPath:[[NSApp delegate] lastBundleBlobFilesDirectory] error:nil]; + if([SPAppDelegate lastBundleBlobFilesDirectory] != nil) + [fm removeItemAtPath:[SPAppDelegate lastBundleBlobFilesDirectory] error:nil]; if([shellEnvironment objectForKey:SPBundleShellVariableBlobFileDirectory]) - [[NSApp delegate] setLastBundleBlobFilesDirectory:[shellEnvironment objectForKey:SPBundleShellVariableBlobFileDirectory]]; + [SPAppDelegate setLastBundleBlobFilesDirectory:[shellEnvironment objectForKey:SPBundleShellVariableBlobFileDirectory]]; // Parse first line for magic header #! ; if found save the script content and run the command after #! with that file. // This allows to write perl, ruby, osascript scripts natively. diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index 4aaa7cad..aa400b05 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -34,6 +34,7 @@ #import "SPOutlineView.h" #import "SPBundleCommandTextView.h" #import "SPSplitView.h" +#import "SPAppController.h" static NSString *SPSaveBundleAction = @"SPSaveBundle"; @@ -880,7 +881,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; [[self window] performClose:self]; } - [[NSApp delegate] reloadBundles:self]; + [SPAppDelegate reloadBundles:self]; } @@ -1083,7 +1084,7 @@ static NSString *SPSaveBundleAction = @"SPSaveBundle"; [undeleteTableView reloadData]; [[NSUserDefaults standardUserDefaults] setObject:stillUndeletedBundles forKey:SPBundleDeletedDefaultBundlesKey]; [[NSUserDefaults standardUserDefaults] synchronize]; - [[NSApp delegate] reloadBundles:nil]; + [SPAppDelegate reloadBundles:nil]; [self reloadBundles:self]; } diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index da82d768..ed1142a2 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -260,7 +260,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; [c displayHTMLContent:[NSString stringWithFormat:@"
%@
", [sourceCode HTMLEscapeString]] withOptions:nil]; - [[NSApp delegate] addHTMLOutputController:c]; + [SPAppDelegate addHTMLOutputController:c]; } - (void)saveDocument @@ -294,7 +294,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; windowUUID = @""; docUUID = @""; - [[NSApp delegate] removeHTMLOutputController:self]; + [SPAppDelegate removeHTMLOutputController:self]; [self release]; } @@ -332,7 +332,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; if(request != nil) { SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init]; [c displayURLString:[[request URL] absoluteString] withOptions:nil]; - [[NSApp delegate] addHTMLOutputController:c]; + [SPAppDelegate addHTMLOutputController:c]; return [c webView]; } return nil; @@ -351,7 +351,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; // sequelpro:// handler if([[[request URL] scheme] isEqualToString:@"sequelpro"] && navigationType == WebNavigationTypeLinkClicked) { - [[NSApp delegate] handleEventWithURL:[request URL]]; + [SPAppDelegate handleEventWithURL:[request URL]]; [listener ignore]; } // sp-reveal-file://a_file_path reveals the file in Finder @@ -571,7 +571,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; */ - (NSString *)getShellEnvironmentForName:(NSString*)keyName { - return [[[NSApp delegate] shellEnvironmentForDocument:nil] objectForKey:keyName]; + return [[SPAppDelegate shellEnvironmentForDocument:nil] objectForKey:keyName]; } /** @@ -691,7 +691,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; output = [SPBundleCommandRunner runBashCommand:command withEnvironment:nil atCurrentDirectoryPath:nil error:&err]; else { NSMutableDictionary *theEnv = [NSMutableDictionary dictionary]; - [theEnv addEntriesFromDictionary:[[NSApp delegate] shellEnvironmentForDocument:nil]]; + [theEnv addEntriesFromDictionary:[SPAppDelegate shellEnvironmentForDocument:nil]]; [theEnv setObject:uuid forKey:SPBundleShellVariableProcessID]; [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryInputPathHeader, uuid] forKey:SPBundleShellVariableQueryFile]; [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultPathHeader, uuid] forKey:SPBundleShellVariableQueryResultFile]; @@ -701,7 +701,7 @@ static NSString *SPSaveDocumentAction = @"SPSaveDocument"; output = [SPBundleCommandRunner runBashCommand:command withEnvironment:theEnv atCurrentDirectoryPath:nil - callerInstance:[NSApp delegate] + callerInstance:SPAppDelegate contextInfo:[NSDictionary dictionaryWithObjectsAndKeys: @"JavaScript", @"name", NSLocalizedString(@"General", @"general menu item label"), @"scope", diff --git a/Source/SPChooseMenuItemDialog.m b/Source/SPChooseMenuItemDialog.m index 4b1dafb5..60b9ced3 100644 --- a/Source/SPChooseMenuItemDialog.m +++ b/Source/SPChooseMenuItemDialog.m @@ -148,7 +148,7 @@ clickCount:1 pressure:0.0f]; - [[NSApplication sharedApplication] sendEvent:theEvent]; + [NSApp sendEvent:theEvent]; while ([dialog waitForChoice] && [[[NSApp keyWindow] firstResponder] isKindOfClass:[SPChooseMenuItemDialogTextView class]]) { diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 905975dc..e98cc426 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -836,7 +836,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [self _sortFavorites]; [self _selectNode:node]; - [[[[NSApp delegate] preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; favoriteNameFieldWasAutogenerated = YES; @@ -979,7 +979,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [self _reloadFavoritesViewData]; [self _selectNode:node]; - [[(SPPreferenceController *)[[NSApp delegate] preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[(SPPreferenceController *)[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; } } @@ -1354,7 +1354,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [self _selectNode:newNode]; // Update the favorites popup button in the preferences - [[[[NSApp delegate] preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; // Otherwise, if editing the favourite, update it } else { @@ -1677,7 +1677,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [connectionResizeContainer setHidden:NO]; [connectionInstructionsTextField setStringValue:NSLocalizedString(@"Enter connection details below, or choose a favorite", @"enter connection details label")]; - [[(SPPreferenceController *)[[NSApp delegate] preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[(SPPreferenceController *)[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; } /** diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index acd9f1d7..4384ae32 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -424,7 +424,7 @@ static NSString *SPQuickConnectImageWhite = @"quick-connect-icon-white.pdf"; [[NSNotificationCenter defaultCenter] postNotificationName:SPConnectionFavoritesChangedNotification object:self]; - [[[[NSApp delegate] preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; + [[[SPAppDelegate preferenceController] generalPreferencePane] updateDefaultFavoritePopup]; // Update the selection to account for rearranged faourites NSMutableIndexSet *restoredSelection = [NSMutableIndexSet indexSet]; diff --git a/Source/SPConstants.h b/Source/SPConstants.h index fd7afe40..322219ae 100644 --- a/Source/SPConstants.h +++ b/Source/SPConstants.h @@ -607,3 +607,5 @@ extern NSString *SPURLSchemeQueryInputPathHeader; extern NSString *SPURLSchemeQueryResultPathHeader; extern NSString *SPURLSchemeQueryResultStatusPathHeader; extern NSString *SPURLSchemeQueryResultMetaPathHeader; + +#define SPAppDelegate ((SPAppController *)[NSApp delegate]) diff --git a/Source/SPConstants.m b/Source/SPConstants.m index e7b92884..23d8c378 100644 --- a/Source/SPConstants.m +++ b/Source/SPConstants.m @@ -233,7 +233,7 @@ NSString *SPSSHEnableMuxingPreference = @"SSHMultiplexingEnabled"; // URLs NSString *SPDonationsURL = @"http://www.sequelpro.com/donate/"; NSString *SPMySQLSearchURL = @"http://dev.mysql.com/doc/refman/%@/%@/%@.html"; -NSString *SPDevURL = @"http://code.google.com/p/sequel-pro/"; +NSString *SPDevURL = @"https://github.com/sequelpro/sequelpro"; // Toolbar constants diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index c08e84b9..ea7c49b1 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -37,6 +37,7 @@ #import "SPTableContent.h" #import "SPConnectionController.h" #import "SPSplitView.h" +#import "SPAppController.h" static NSString *SPExportFilterAction = @"SPExportFilter"; @@ -404,7 +405,7 @@ static NSString *SPExportFilterAction = @"SPExportFilter"; [cf release]; // Inform all opened documents to update the query favorites list - for(id doc in [[NSApp delegate] orderedDocuments]) + for(id doc in [SPAppDelegate orderedDocuments]) if([[doc valueForKeyPath:@"tableContentInstance"] respondsToSelector:@selector(setCompareTypes:)]) [[doc valueForKeyPath:@"tableContentInstance"] setCompareTypes:nil]; #endif diff --git a/Source/SPCopyTable.m b/Source/SPCopyTable.m index 8eb33525..7796ca11 100644 --- a/Source/SPCopyTable.m +++ b/Source/SPCopyTable.m @@ -885,7 +885,7 @@ static const NSInteger kBlobAsImageFile = 4; if(![[self delegate] isKindOfClass:[SPCustomQuery class]] && ![[self delegate] isKindOfClass:[SPTableContent class]]) return menu; - [[NSApp delegate] reloadBundles:self]; + [SPAppDelegate reloadBundles:self]; // Remove 'Bundles' sub menu and separator NSMenuItem *bItem = [menu itemWithTag:10000000]; @@ -895,8 +895,8 @@ static const NSInteger kBlobAsImageFile = 4; [menu removeItem:bItem]; } - NSArray *bundleCategories = [[NSApp delegate] bundleCategoriesForScope:SPBundleScopeDataTable]; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeDataTable]; + NSArray *bundleCategories = [SPAppDelegate bundleCategoriesForScope:SPBundleScopeDataTable]; + NSArray *bundleItems = [SPAppDelegate bundleItemsForScope:SPBundleScopeDataTable]; // Add 'Bundles' sub menu if(bundleItems && [bundleItems count]) { @@ -1246,7 +1246,7 @@ static const NSInteger kBlobAsImageFile = 4; #ifndef SP_CODA /* executeBundleItemForDataTable: */ NSInteger idx = [sender tag] - 1000000; NSString *infoPath = nil; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeDataTable]; + NSArray *bundleItems = [SPAppDelegate bundleItemsForScope:SPBundleScopeDataTable]; if(idx >=0 && idx < (NSInteger)[bundleItems count]) { infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey]; } else { @@ -1432,7 +1432,7 @@ static const NSInteger kBlobAsImageFile = 4; NSString *output = [SPBundleCommandRunner runBashCommand:cmd withEnvironment:env atCurrentDirectoryPath:nil - callerInstance:[[NSApp delegate] frontDocument] + callerInstance:[SPAppDelegate frontDocument] contextInfo:[NSDictionary dictionaryWithObjectsAndKeys: ([cmdData objectForKey:SPBundleFileNameKey])?:@"-", @"name", NSLocalizedString(@"Data Table", @"data table menu item label"), @"scope", @@ -1509,7 +1509,7 @@ static const NSInteger kBlobAsImageFile = 4; SPBundleHTMLOutputController *bundleController = [[SPBundleHTMLOutputController alloc] init]; [bundleController setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]]; [bundleController displayHTMLContent:output withOptions:nil]; - [[NSApp delegate] addHTMLOutputController:bundleController]; + [SPAppDelegate addHTMLOutputController:bundleController]; } } } diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index ba053dbf..9de7391d 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -2541,7 +2541,7 @@ if ([aNotification object] != customQueryView) return; #ifndef SP_CODA /* triggered commands */ - NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; + NSArray *triggeredCommands = [SPAppDelegate bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; for(NSString* cmdPath in triggeredCommands) { NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; @@ -2565,7 +2565,7 @@ } if(!stopTrigger) { if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) @@ -3894,7 +3894,7 @@ arrowEvent = [NSEvent keyEventWithType:NSKeyDown location:NSMakePoint(0,0) modifierFlags:0 timestamp:0 windowNumber:[[tableDocumentInstance parentWindow] windowNumber] context:[NSGraphicsContext currentContext] characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:0x7D]; else arrowEvent = [NSEvent keyEventWithType:NSKeyDown location:NSMakePoint(0,0) modifierFlags:0 timestamp:0 windowNumber:[[tableDocumentInstance parentWindow] windowNumber] context:[NSGraphicsContext currentContext] characters:nil charactersIgnoringModifiers:nil isARepeat:NO keyCode:0x7E]; - [[NSApplication sharedApplication] postEvent:arrowEvent atStart:NO]; + [NSApp postEvent:arrowEvent atStart:NO]; return YES; } diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index a377a8ec..7ab802da 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -2526,8 +2526,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; - (IBAction)openCurrentConnectionInNewWindow:(id)sender { - [[NSApp delegate] newWindow:self]; - SPDatabaseDocument *newTableDocument = [[NSApp delegate] frontDocument]; + [SPAppDelegate newWindow:self]; + SPDatabaseDocument *newTableDocument = [SPAppDelegate frontDocument]; [newTableDocument setStateFromConnectionFile:[[self fileURL] path]]; } @@ -2921,7 +2921,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; else if (sender == nil || [sender tag] == 1020 || [sender tag] == 1021) { // Save As Session - if ([sender tag] == 1020 && [[NSApp delegate] sessionURL]) { + if ([sender tag] == 1020 && [SPAppDelegate sessionURL]) { [self saveConnectionPanelDidEnd:panel returnCode:1 contextInfo:@"saveAsSession"]; return; } @@ -2935,7 +2935,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [panel setAllowedFileTypes:[NSArray arrayWithObjects:SPBundleFileExtension, nil]]; - NSDictionary *spfSessionData = [[NSApp delegate] spfSessionDocData]; + NSDictionary *spfSessionData = [SPAppDelegate spfSessionDocData]; // Restore accessory view settings if possible if ([spfSessionData objectForKey:@"save_password"]) { @@ -2967,8 +2967,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [panel setAccessoryView:saveConnectionAccessory]; // Set file name - if ([[NSApp delegate] sessionURL]) - filename = [[[[NSApp delegate] sessionURL] absoluteString] lastPathComponent]; + if ([SPAppDelegate sessionURL]) + filename = [[[SPAppDelegate sessionURL] absoluteString] lastPathComponent]; else filename = [NSString stringWithFormat:NSLocalizedString(@"Session",@"Initial filename for 'Save session' file")]; @@ -3055,8 +3055,8 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // info.plist will contain the opened structure (windows and tabs for each window). Each connection // is linked to a saved spf file either in 'Contents' for unTitled ones or already saved spf files. - if(contextInfo == @"saveAsSession" && [[NSApp delegate] sessionURL]) - fileName = [[[NSApp delegate] sessionURL] path]; + if(contextInfo == @"saveAsSession" && [SPAppDelegate sessionURL]) + fileName = [[SPAppDelegate sessionURL] path]; if(!fileName || ![fileName length]) return; @@ -3094,7 +3094,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // retrieve save panel data for passing them to each doc NSMutableDictionary *spfDocData_temp = [NSMutableDictionary dictionary]; if(contextInfo == @"saveAsSession") { - [spfDocData_temp addEntriesFromDictionary:[[NSApp delegate] spfSessionDocData]]; + [spfDocData_temp addEntriesFromDictionary:[SPAppDelegate spfSessionDocData]]; } else { [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionEncrypt state]==NSOnState) ? YES : NO ] forKey:@"encrypted"]; if([[spfDocData_temp objectForKey:@"encrypted"] boolValue]) @@ -3105,7 +3105,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [spfDocData_temp setObject:[NSNumber numberWithBool:([saveConnectionIncludeQuery state]==NSOnState) ? YES : NO ] forKey:@"save_editor_content"]; // Save the session's accessory view settings - [[NSApp delegate] setSpfSessionDocData:spfDocData_temp]; + [SPAppDelegate setSpfSessionDocData:spfDocData_temp]; } @@ -3118,7 +3118,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [info setObject:@"connection bundle" forKey:@"format"]; // Loop through all windows - for(NSWindow *window in [[NSApp delegate] orderedDatabaseConnectionWindows]) { + for(NSWindow *window in [SPAppDelegate orderedDatabaseConnectionWindows]) { // First window is always the currently key window @@ -3192,7 +3192,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; return; } - [[NSApp delegate] setSessionURL:fileName]; + [SPAppDelegate setSessionURL:fileName]; // Register spfs bundle in Recent Files [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:fileName]]; @@ -3459,7 +3459,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [currentState setObject:sessionDict forKey:@"session"]; // Set the connection on the new tab - [[[NSApp delegate] frontDocument] setState:currentState]; + [[SPAppDelegate frontDocument] setState:currentState]; } /** @@ -4807,11 +4807,11 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; // Ask for a password if SPF file passwords were encrypted, via a sheet if ([spf objectForKey:@"encrypted"] && [[spf valueForKey:@"encrypted"] boolValue]) { - if([self isSaveInBundle] && [[[NSApp delegate] spfSessionDocData] objectForKey:@"e_string"]) { - encryptpw = [[[NSApp delegate] spfSessionDocData] objectForKey:@"e_string"]; + if([self isSaveInBundle] && [[SPAppDelegate spfSessionDocData] objectForKey:@"e_string"]) { + encryptpw = [[SPAppDelegate spfSessionDocData] objectForKey:@"e_string"]; } else { [inputTextWindowHeader setStringValue:NSLocalizedString(@"Connection file is encrypted", @"Connection file is encrypted")]; - [inputTextWindowMessage setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Please enter the password for ‘%@’:", @"Please enter the password"), ([self isSaveInBundle]) ? [[[[NSApp delegate] sessionURL] absoluteString] lastPathComponent] : [path lastPathComponent]]]; + [inputTextWindowMessage setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Please enter the password for ‘%@’:", @"Please enter the password"), ([self isSaveInBundle]) ? [[[SPAppDelegate sessionURL] absoluteString] lastPathComponent] : [path lastPathComponent]]]; [inputTextWindowSecureTextField setStringValue:@""]; [inputTextWindowSecureTextField selectText:nil]; @@ -4843,9 +4843,9 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; encryptpw = [inputTextWindowSecureTextField stringValue]; if ([self isSaveInBundle]) { NSMutableDictionary *spfSessionData = [NSMutableDictionary dictionary]; - [spfSessionData addEntriesFromDictionary:[[NSApp delegate] spfSessionDocData]]; + [spfSessionData addEntriesFromDictionary:[SPAppDelegate spfSessionDocData]]; [spfSessionData setObject:encryptpw forKey:@"e_string"]; - [[NSApp delegate] setSpfSessionDocData:spfSessionData]; + [SPAppDelegate setSpfSessionDocData:spfSessionData]; } } else { [self closeAndDisconnect]; @@ -5379,7 +5379,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; return; } if(doSyntaxHighlighting) { - [result appendFormat:@"%@
", [[NSApp delegate] doSQLSyntaxHighlightForString:[syntaxString createViewSyntaxPrettifier] cssLike:doSyntaxHighlightingViaCSS]]; + [result appendFormat:@"%@
", [SPAppDelegate doSQLSyntaxHighlightForString:[syntaxString createViewSyntaxPrettifier] cssLike:doSyntaxHighlightingViaCSS]]; } else { [result appendFormat:@"%@\n", [syntaxString createViewSyntaxPrettifier]]; } @@ -5591,7 +5591,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; [runningActivitiesArray addObject:commandDict]; [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:SPActivitiesUpdateNotification object:self]; - if([runningActivitiesArray count] || [[[NSApp delegate] runningActivities] count]) + if([runningActivitiesArray count] || [[SPAppDelegate runningActivities] count]) [self performSelector:@selector(setActivityPaneHidden:) withObject:@0 afterDelay:1.0]; else { [NSObject cancelPreviousPerformRequestsWithTarget:self @@ -5612,7 +5612,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; } } - if([runningActivitiesArray count] || [[[NSApp delegate] runningActivities] count]) + if([runningActivitiesArray count] || [[SPAppDelegate runningActivities] count]) [self performSelector:@selector(setActivityPaneHidden:) withObject:@0 afterDelay:1.0]; else { [NSObject cancelPreviousPerformRequestsWithTarget:self @@ -6198,7 +6198,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; #ifndef SP_CODA - (void)_processDatabaseChangedBundleTriggerActions { - NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionDatabaseChanged]; + NSArray *triggeredCommands = [SPAppDelegate bundleCommandsForTrigger:SPBundleTriggerActionDatabaseChanged]; for (NSString* cmdPath in triggeredCommands) { @@ -6229,7 +6229,7 @@ static NSString *SPAlterDatabaseAction = @"SPAlterDatabase"; } if(!stopTrigger) { if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { if ([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) { diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index c1823661..9b0ded39 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -589,7 +589,7 @@ [self endTask]; #ifndef SP_CODA /* triggered commands */ - NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; + NSArray *triggeredCommands = [SPAppDelegate bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; for(NSString* cmdPath in triggeredCommands) { @@ -615,7 +615,7 @@ } if(!stopTrigger) { if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) diff --git a/Source/SPDocumentController.m b/Source/SPDocumentController.m index 391d41a6..a5d81554 100644 --- a/Source/SPDocumentController.m +++ b/Source/SPDocumentController.m @@ -40,7 +40,7 @@ /** * Add a dummy implementation of readFromData:ofType:error:, which appears to * be called by the OS in certain situations despite non-document use. - * (See http://code.google.com/p/sequel-pro/issues/detail?id=1411 ) + * (See issue #1411 ) */ - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { diff --git a/Source/SPExportFilenameUtilities.m b/Source/SPExportFilenameUtilities.m index 71422b28..b0070f31 100644 --- a/Source/SPExportFilenameUtilities.m +++ b/Source/SPExportFilenameUtilities.m @@ -242,7 +242,7 @@ isARepeat:NO keyCode:0x24]; - [[NSApplication sharedApplication] postEvent:tokenizingEvent atStart:NO]; + [NSApp postEvent:tokenizingEvent atStart:NO]; // Update the filename preview [self updateDisplayedExportFilename]; diff --git a/Source/SPNavigatorController.m b/Source/SPNavigatorController.m index 379cdc18..e2319141 100644 --- a/Source/SPNavigatorController.m +++ b/Source/SPNavigatorController.m @@ -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 @@ -590,7 +590,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; @@ -750,7 +750,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]]; diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index 956b0d9b..c77e82d2 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -85,7 +85,7 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; - (void)awakeFromNib { - [[self window] setTitle:[NSString stringWithFormat:NSLocalizedString(@"Server Processes on %@", @"server processes window title (var = hostname)"),[[(SPAppController*)[NSApp delegate] frontDocument] name]]]; + [[self window] setTitle:[NSString stringWithFormat:NSLocalizedString(@"Server Processes on %@", @"server processes window title (var = hostname)"),[[SPAppDelegate frontDocument] name]]]; [self setWindowFrameAutosaveName:@"ProcessList"]; @@ -238,7 +238,7 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { if (returnCode == NSOKButton) { if ([processesFiltered count] > 0) { - NSMutableString *processesString = [NSMutableString stringWithFormat:@"# MySQL server proceese for %@\n\n", [[[NSApp delegate] frontDocument] host]]; + NSMutableString *processesString = [NSMutableString stringWithFormat:@"# MySQL server proceese for %@\n\n", [[SPAppDelegate frontDocument] host]]; for (NSDictionary *process in processesFiltered) { diff --git a/Source/SPQueryDocumentsController.m b/Source/SPQueryDocumentsController.m index ba1bc2b1..e42a734b 100644 --- a/Source/SPQueryDocumentsController.m +++ b/Source/SPQueryDocumentsController.m @@ -30,6 +30,7 @@ #import "SPQueryDocumentsController.h" #import "SPCustomQuery.h" +#import "SPAppController.h" @implementation SPQueryController (SPQueryDocumentsController) @@ -122,7 +123,7 @@ #ifndef SP_CODA // Check for multiple instance of the same document. // Remove it if only one instance was registerd. - NSArray *allDocs = [[NSApp delegate] orderedDocuments]; + NSArray *allDocs = [SPAppDelegate orderedDocuments]; NSMutableArray *allURLs = [NSMutableArray array]; for (id doc in allDocs) @@ -202,7 +203,7 @@ } // Inform all opened documents to update the history list - for (id doc in [[NSApp delegate] orderedDocuments]) + for (id doc in [SPAppDelegate orderedDocuments]) { if([[doc valueForKeyPath:@"customQueryInstance"] respondsToSelector:@selector(historyItemsHaveBeenUpdated:)]) { [[doc valueForKeyPath:@"customQueryInstance"] performSelectorOnMainThread:@selector(historyItemsHaveBeenUpdated:) withObject:self waitUntilDone:NO]; diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 9f96d98a..c73501b8 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -38,6 +38,7 @@ #import "RegexKitLite.h" #import "SPTextView.h" #import "SPSplitView.h" +#import "SPAppController.h" #define SP_MULTIPLE_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[multiple selection]", @"[multiple selection]") #define SP_NO_SELECTION_PLACEHOLDER_STRING NSLocalizedString(@"[no selection]", @"[no selection]") @@ -477,7 +478,7 @@ [prefs setObject:[self queryFavoritesForFileURL:nil] forKey:SPQueryFavorites]; // Inform all opened documents to update the query favorites list - for(id doc in [[NSApp delegate] orderedDocuments]) + for(id doc in [SPAppDelegate orderedDocuments]) if([[doc valueForKeyPath:@"customQueryInstance"] respondsToSelector:@selector(queryFavoritesHaveBeenUpdated:)]) [[doc valueForKeyPath:@"customQueryInstance"] queryFavoritesHaveBeenUpdated:self]; } diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index a2e1e059..80c9f558 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -136,7 +136,7 @@ [panel beginSheetModalForWindow:[self window] completionHandler:^(NSInteger returnCode) { if (returnCode == NSOKButton) { if ([variablesFiltered count] > 0) { - NSMutableString *variablesString = [NSMutableString stringWithFormat:@"# MySQL server variables for %@\n\n", [[(SPAppController*)[NSApp delegate] frontDocument] host]]; + NSMutableString *variablesString = [NSMutableString stringWithFormat:@"# MySQL server variables for %@\n\n", [[SPAppDelegate frontDocument] host]]; for (NSDictionary *variable in variablesFiltered) { diff --git a/Source/SPTableContentDelegate.m b/Source/SPTableContentDelegate.m index 2f78a120..0a624efc 100644 --- a/Source/SPTableContentDelegate.m +++ b/Source/SPTableContentDelegate.m @@ -118,7 +118,7 @@ [self updateCountText]; #ifndef SP_CODA /* triggered commands */ - NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; + NSArray *triggeredCommands = [SPAppDelegate bundleCommandsForTrigger:SPBundleTriggerActionTableRowChanged]; for (NSString *cmdPath in triggeredCommands) { @@ -150,7 +150,7 @@ if (!stopTrigger) { if ([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if ([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { if ([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) { diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index 4bed0226..76a11a5c 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -35,6 +35,7 @@ #import "SPTableData.h" #import "SPActivityTextFieldCell.h" #import "SPTableTextFieldCell.h" +#import "SPAppController.h" @interface SPTableInfo (PrivateAPI) @@ -111,7 +112,7 @@ [acts removeAllObjects]; [acts addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"ACTIVITIES", @"header for activities pane"), @"name", nil]]; [acts addObjectsFromArray:[tableDocumentInstance runningActivities]]; - [acts addObjectsFromArray:[[NSApp delegate] runningActivities]]; + [acts addObjectsFromArray:[SPAppDelegate runningActivities]]; _activitiesWillBeUpdated = YES; diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 458389c2..8d455b58 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -717,13 +717,13 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [documentState setObject:@YES forKey:@"auto_connect"]; // Set the connection on the new tab - [[[NSApp delegate] frontDocument] setState:documentState]; + [[SPAppDelegate frontDocument] setState:documentState]; } - (IBAction)openTableInNewWindow:(id)sender { //create new window - [(SPAppController *)[NSApp delegate] newWindow:self]; + [SPAppDelegate newWindow:self]; [self _duplicateConnectionToFrontTab]; } @@ -2653,7 +2653,7 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; // check if the name really changed if ([oldTableName isEqualToString:newTableName]) return; - // check if only the case changed - then we have to do two renames, see http://code.google.com/p/sequel-pro/issues/detail?id=484 + // check if only the case changed - then we have to do two renames, see issue #484 if ([[oldTableName lowercaseString] isEqualToString:[newTableName lowercaseString]]) { // first try finding an unused temporary name diff --git a/Source/SPTextView.m b/Source/SPTextView.m index abe89c5b..523a7ade 100644 --- a/Source/SPTextView.m +++ b/Source/SPTextView.m @@ -3125,7 +3125,7 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS } #ifndef SP_CODA - [[NSApp delegate] reloadBundles:self]; + [SPAppDelegate reloadBundles:self]; // Remove 'Bundles' sub menu and separator NSMenuItem *bItem = [menu itemWithTag:10000000]; @@ -3135,8 +3135,8 @@ static inline NSPoint SPPointOnLine(NSPoint a, NSPoint b, CGFloat t) { return NS [menu removeItem:bItem]; } - NSArray *bundleCategories = [[NSApp delegate] bundleCategoriesForScope:SPBundleScopeInputField]; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeInputField]; + NSArray *bundleCategories = [SPAppDelegate bundleCategoriesForScope:SPBundleScopeInputField]; + NSArray *bundleItems = [SPAppDelegate bundleItemsForScope:SPBundleScopeInputField]; // Add 'Bundles' sub menu for custom query editor only so far if bundles with scope 'editor' were found if(customQueryInstance && bundleItems && [bundleItems count]) { diff --git a/Source/SPTextViewAdditions.m b/Source/SPTextViewAdditions.m index 17998fa6..7272de1d 100644 --- a/Source/SPTextViewAdditions.m +++ b/Source/SPTextViewAdditions.m @@ -511,7 +511,7 @@ NSInteger idx = [sender tag] - 1000000; NSString *infoPath = nil; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeInputField]; + NSArray *bundleItems = [SPAppDelegate bundleItemsForScope:SPBundleScopeInputField]; if(idx >=0 && idx < (NSInteger)[bundleItems count]) { infoPath = [[bundleItems objectAtIndex:idx] objectForKey:SPBundleInternPathToFileKey]; } else { @@ -661,7 +661,7 @@ NSString *output = [SPBundleCommandRunner runBashCommand:cmd withEnvironment:env atCurrentDirectoryPath:nil - callerInstance:[(SPAppController*)[NSApp delegate] frontDocument] + callerInstance:[SPAppDelegate frontDocument] contextInfo:[NSDictionary dictionaryWithObjectsAndKeys: ([cmdData objectForKey:SPBundleFileNameKey])?:@"-", @"name", NSLocalizedString(@"Input Field", @"input field menu item label"), @"scope", @@ -736,7 +736,7 @@ SPBundleHTMLOutputController *c = [[SPBundleHTMLOutputController alloc] init]; [c setWindowUUID:[cmdData objectForKey:SPBundleFileUUIDKey]]; [c displayHTMLContent:output withOptions:nil]; - [[NSApp delegate] addHTMLOutputController:c]; + [SPAppDelegate addHTMLOutputController:c]; } } @@ -800,12 +800,12 @@ [menu removeItem:bItem]; } - if ([[[(SPWindowController *)[[[NSApp delegate] frontDocumentWindow] delegate] selectedTableDocument] connectionID] isEqualToString:@"_"]) return menu; + if ([[[(SPWindowController *)[[SPAppDelegate frontDocumentWindow] delegate] selectedTableDocument] connectionID] isEqualToString:@"_"]) return menu; - [[NSApp delegate] reloadBundles:self]; + [SPAppDelegate reloadBundles:self]; - NSArray *bundleCategories = [[NSApp delegate] bundleCategoriesForScope:SPBundleScopeInputField]; - NSArray *bundleItems = [[NSApp delegate] bundleItemsForScope:SPBundleScopeInputField]; + NSArray *bundleCategories = [SPAppDelegate bundleCategoriesForScope:SPBundleScopeInputField]; + NSArray *bundleItems = [SPAppDelegate bundleItemsForScope:SPBundleScopeInputField]; // Add 'Bundles' sub menu if(bundleItems && [bundleItems count]) { diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index 917c73ae..3fdcaa63 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -281,7 +281,7 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; [[self managedObjectContext] save:&error]; if (error != nil) { - [[NSApplication sharedApplication] presentError:error]; + [NSApp presentError:error]; } [parentResults release]; @@ -443,7 +443,7 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel: [self managedObjectModel]]; if (![persistentStoreCoordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:&error]) { - [[NSApplication sharedApplication] presentError:error]; + [NSApp presentError:error]; } return persistentStoreCoordinator; @@ -1261,7 +1261,7 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; NSArray *array = [moc executeFetchRequest:request error:&error]; if (error != nil) { - [[NSApplication sharedApplication] presentError:error]; + [NSApp presentError:error]; } return array; @@ -1297,7 +1297,7 @@ static NSString * const SPTableViewNameColumnID = @"NameColumn"; NSArray *array = [moc executeFetchRequest:request error:&error]; if (error != nil) { - [[NSApplication sharedApplication] presentError:error]; + [NSApp presentError:error]; } return array; diff --git a/Source/SPWindowControllerDelegate.m b/Source/SPWindowControllerDelegate.m index d8637ac4..47959f1b 100644 --- a/Source/SPWindowControllerDelegate.m +++ b/Source/SPWindowControllerDelegate.m @@ -68,9 +68,9 @@ } // Remove global session data if the last window of a session will be closed - if ([[NSApp delegate] sessionURL] && [[[NSApp delegate] orderedDatabaseConnectionWindows] count] == 1) { - [[NSApp delegate] setSessionURL:nil]; - [[NSApp delegate] setSpfSessionDocData:nil]; + if ([SPAppDelegate sessionURL] && [[SPAppDelegate orderedDatabaseConnectionWindows] count] == 1) { + [SPAppDelegate setSessionURL:nil]; + [SPAppDelegate setSpfSessionDocData:nil]; } return YES; diff --git a/Source/Sequel-Pro.pch b/Source/Sequel-Pro.pch index 080e20ec..f3b2fd16 100644 --- a/Source/Sequel-Pro.pch +++ b/Source/Sequel-Pro.pch @@ -25,7 +25,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // OTHER DEALINGS IN THE SOFTWARE. // -// More info at +// More info at #ifdef __OBJC__ #import -- cgit v1.2.3