From 692e6e7330d9a6fd0227f74c1665ddc0b19cc4c6 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Thu, 19 Aug 2010 17:10:55 +0000 Subject: =?UTF-8?q?=E2=80=A2=20added=20SPBeginWaitingAlertSheet()=20routin?= =?UTF-8?q?e=20which=20offers=20the=20chance=20to=20display=20an=20alert?= =?UTF-8?q?=20sheet=20which=20waits=20for=20the=20change=20in=20the=20didE?= =?UTF-8?q?ndSelector=20method=20of=20a=20passed=20class=20NSInteger=20var?= =?UTF-8?q?iable=20=E2=80=A2=20applied=20the=20SPBeginWaitingAlertSheet=20?= =?UTF-8?q?routine=20to=20Pref=20>=20Editor's=20check=20for=20unsaved=20co?= =?UTF-8?q?lor=20themes=20and=20in=20SPCustomQuery's=20sheet=20about=20Sto?= =?UTF-8?q?p/Continue/Run=20All=20if=20a=20query=20failed=20after=20execut?= =?UTF-8?q?ing=20"Run=20All"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPCustomQuery.m | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'Source/SPCustomQuery.m') 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 -- cgit v1.2.3