aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/MCPKit
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-05-09 01:00:23 +0000
committerrowanbeentje <rowan@beent.je>2010-05-09 01:00:23 +0000
commit4144a5e1b78480fd86994a9c255c9a0fb98db48b (patch)
tree144569ffc18dea3b4b3feedf89b04753c1ef53c3 /Frameworks/MCPKit
parent1ba45688cf6b851a662429eb770ce4fcea93d1bf (diff)
downloadsequelpro-4144a5e1b78480fd86994a9c255c9a0fb98db48b.tar.gz
sequelpro-4144a5e1b78480fd86994a9c255c9a0fb98db48b.tar.bz2
sequelpro-4144a5e1b78480fd86994a9c255c9a0fb98db48b.zip
Rework alert sheets:
- Change MCPConnection.m to no longer use a reference to tableWindow to attach sheets - instead use a delate error display method if available - Rework TableSource and TableContent sheetDidEnd methods into per-task methods rather than overloading contextInfo - Rework SPAlertSheets to perform actions on the main thread, with the loss of (unused) support for a didDismissSelector. This addresses a number of crashes logged by the crash reporter
Diffstat (limited to 'Frameworks/MCPKit')
-rw-r--r--Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m18
1 files changed, 13 insertions, 5 deletions
diff --git a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
index a8eb923a..05d7d42a 100644
--- a/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
+++ b/Frameworks/MCPKit/MCPFoundationKit/MCPConnection.m
@@ -1440,10 +1440,13 @@ void performThreadedKeepAlive(void *ptr)
// Notify that the query has been performed
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:delegate];
+
// Show an error alert while resetting
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"),
- nil, nil, [delegate valueForKeyPath:@"tableWindow"], self, nil, nil, nil, errorMessage);
-
+ if ([delegate respondsToSelector:@selector(showErrorWithTitle:message:)])
+ [delegate showErrorWithTitle:NSLocalizedString(@"Error", @"error") message:errorMessage];
+ else
+ NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), errorMessage, @"OK", nil, nil);
+
return nil;
}
}
@@ -2631,8 +2634,13 @@ void performThreadedKeepAlive(void *ptr)
MCPResult *r;
r = [self queryString:@"SELECT @@global.max_allowed_packet" usingEncoding:mEncoding streamingResult:NO];
if (![[self getLastErrorMessage] isEqualToString:@""]) {
- if ([self isConnected])
- NSRunAlertPanel(@"Error", [NSString stringWithFormat:@"An error occured while retrieving max_allowed_packet size:\n\n%@", [self getLastErrorMessage]], @"OK", nil, nil);
+ if ([self isConnected]) {
+ NSString *errorMessage = [NSString stringWithFormat:@"An error occured while retrieving max_allowed_packet size:\n\n%@", [self getLastErrorMessage]];
+ if ([delegate respondsToSelector:@selector(showErrorWithTitle:message:)])
+ [delegate showErrorWithTitle:NSLocalizedString(@"Error", @"error") message:errorMessage];
+ else
+ NSRunAlertPanel(@"Error", errorMessage, @"OK", nil, nil);
+ }
return -1;
}
NSArray *a = [r fetchRowAsArray];