aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPCustomQuery.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-08-19 17:10:55 +0000
committerBibiko <bibiko@eva.mpg.de>2010-08-19 17:10:55 +0000
commit692e6e7330d9a6fd0227f74c1665ddc0b19cc4c6 (patch)
tree6eb9bb4b085cbf80b3f038d9cb07edde4220774c /Source/SPCustomQuery.m
parent8915074c6393bdc5cbaa7900299122f0d4e365be (diff)
downloadsequelpro-692e6e7330d9a6fd0227f74c1665ddc0b19cc4c6.tar.gz
sequelpro-692e6e7330d9a6fd0227f74c1665ddc0b19cc4c6.tar.bz2
sequelpro-692e6e7330d9a6fd0227f74c1665ddc0b19cc4c6.zip
• added SPBeginWaitingAlertSheet() routine which offers the chance to display an alert sheet which waits for the change in the didEndSelector method of a passed class NSInteger variable
• applied the SPBeginWaitingAlertSheet routine to Pref > Editor's check for unsaved color themes and in SPCustomQuery's sheet about Stop/Continue/Run All if a query failed after executing "Run All"
Diffstat (limited to 'Source/SPCustomQuery.m')
-rw-r--r--Source/SPCustomQuery.m30
1 files changed, 19 insertions, 11 deletions
diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m
index 939b0b9f..31aaea54 100644
--- a/Source/SPCustomQuery.m
+++ b/Source/SPCustomQuery.m
@@ -659,18 +659,21 @@
// ask the user to continue after detecting an error
if (![mySQLConnection queryCancelled]) {
- NSAlert *alert = [[[NSAlert alloc] init] autorelease];
- [alert addButtonWithTitle:NSLocalizedString(@"Run All", @"run all button")];
- [alert addButtonWithTitle:NSLocalizedString(@"Continue", @"continue button")];
- [alert addButtonWithTitle:NSLocalizedString(@"Stop", @"stop button")];
- [alert setMessageText:NSLocalizedString(@"MySQL Error", @"mysql error message")];
- [alert setInformativeText:[mySQLConnection getLastErrorMessage]];
- [alert setAlertStyle:NSWarningAlertStyle];
- NSInteger choice = [[alert onMainThread] runModal];
- switch (choice){
- case NSAlertFirstButtonReturn:
+
+ SPBeginWaitingAlertSheet(@"title",
+ NSLocalizedString(@"Run All", @"run all button"), NSLocalizedString(@"Continue", @"continue button"), NSLocalizedString(@"Stop", @"stop button"),
+ NSWarningAlertStyle, [tableDocumentInstance parentWindow], self,
+ @selector(sheetDidEnd:returnCode:contextInfo:),
+ @"runAllContinueStopSheet",
+ NSLocalizedString(@"MySQL Error", @"mysql error message"),
+ [mySQLConnection getLastErrorMessage],
+ runAllContinueStopSheetReturnCode
+ );
+
+ switch (runAllContinueStopSheetReturnCode) {
+ case NSAlertDefaultReturn:
suppressErrorSheet = YES;
- case NSAlertSecondButtonReturn:
+ case NSAlertAlternateReturn:
break;
default:
if(i < queryCount-1) // output that message only if it was not the last one
@@ -3142,6 +3145,11 @@
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
+ if ([contextInfo isEqualToString:@"runAllContinueStopSheet"]) {
+ runAllContinueStopSheetReturnCode = returnCode;
+ return;
+ }
+
if ([contextInfo isEqualToString:@"clearHistory"]) {
if (returnCode == NSOKButton) {
// Remove items in the query controller