diff options
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 96 |
1 files changed, 3 insertions, 93 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 65c8afd6..8d1bca5f 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -755,6 +755,9 @@ return _shouldOpenConnectionAutomatically; } +/** + * Sets this connection's Keychain ID. + */ - (void)setKeychainID:(NSString *)theID { keyChainID = [[NSString stringWithString:theID] retain]; @@ -3425,99 +3428,6 @@ return [[[[self fileURL] absoluteString] lastPathComponent] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; } - -#pragma mark - -#pragma mark MCPKit connection delegate methods - -/** - * Invoked when the framework is about to perform a query. - */ -- (void)willQueryString:(NSString *)query connection:(id)connection -{ - if ([prefs boolForKey:SPConsoleEnableLogging]) { - if ((_queryMode == SPInterfaceQueryMode && [prefs boolForKey:SPConsoleEnableInterfaceLogging]) - || (_queryMode == SPCustomQueryQueryMode && [prefs boolForKey:SPConsoleEnableCustomQueryLogging]) - || (_queryMode == SPImportExportQueryMode && [prefs boolForKey:SPConsoleEnableImportExportLogging])) - { - [[SPQueryController sharedQueryController] showMessageInConsole:query]; - } - } -} - -/** - * Invoked when the query just executed by the framework resulted in an error. - */ -- (void)queryGaveError:(NSString *)error connection:(id)connection -{ - if ([prefs boolForKey:SPConsoleEnableLogging] && [prefs boolForKey:SPConsoleEnableErrorLogging]) { - [[SPQueryController sharedQueryController] showErrorInConsole:error]; - } -} - -/** - * Invoked when the framework is in the process of reconnecting to the server and needs to know - * which database to select. - */ -- (NSString *)onReconnectShouldSelectDatabase:(id)connection -{ - return selectedDatabase; -} - -/** - * Invoked when the framework is in the process of reconnecting to the server and needs to know - * what encoding to use for the connection. - */ -- (NSString *)onReconnectShouldUseEncoding:(id)connection -{ - return _encoding; -} - -/** - * Invoked when the current connection needs a password from the Keychain. - */ -- (NSString *)keychainPasswordForConnection:(MCPConnection *)connection -{ - - // If no keychain item is available, return an empty password - if (![connectionController connectionKeychainItemName]) return @""; - - // Otherwise, pull the password from the keychain using the details from this connection - SPKeychain *keychain = [[SPKeychain alloc] init]; - NSString *password = [keychain getPasswordForName:[connectionController connectionKeychainItemName] account:[connectionController connectionKeychainItemAccount]]; - [keychain release]; - - return password; -} - -/** - * Invoked when an attempt was made to execute a query on the current connection, but the connection is not - * actually active. - */ -- (void)noConnectionAvailable:(id)connection -{ - NSBeginAlertSheet(NSLocalizedString(@"No connection available", @"no connection available message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"An error has occured and there doesn't seem to be a connection available.", @"no connection available informatie message")); -} - -/** - * Invoked when the connection fails and the framework needs to know how to proceed. - */ -- (MCPConnectionCheck)connectionLost:(id)connection -{ - [NSApp beginSheet:connectionErrorDialog modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; - int connectionErrorCode = [NSApp runModalForWindow:connectionErrorDialog]; - - [NSApp endSheet:connectionErrorDialog]; - [connectionErrorDialog orderOut:nil]; - - // If 'disconnect' was selected, trigger a window close. - if (connectionErrorCode == MCPConnectionCheckDisconnect) { - [self windowWillClose:nil]; - [tableWindow performSelector:@selector(close) withObject:nil afterDelay:0.0]; - } - - return connectionErrorCode; -} - #pragma mark - #pragma mark Connection controller delegate methods |