From 08fb692301568e7143271ffad9bbcb3a5b247de5 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 13 Jan 2010 20:53:39 +0000 Subject: =?UTF-8?q?=E2=80=A2=20fixed=20several=20sheetDidEnd=20selectors?= =?UTF-8?q?=20to=20close=20a=20NSAlert=20or=20NSWindow=20properly=20to=20a?= =?UTF-8?q?void=20overlapping=20sheets=20=E2=80=A2=20F5=20completion=20-?= =?UTF-8?q?=20if=20a=20table=20is=20selected=20and=20no=20further=20parsin?= =?UTF-8?q?g=20info=20is=20given=20show=20that=20table=20and=20its=20field?= =?UTF-8?q?s=20at=20the=20top=20of=20the=20suggestions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/TablesList.m | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'Source/TablesList.m') diff --git a/Source/TablesList.m b/Source/TablesList.m index 742ac458..baca3e8a 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -510,6 +510,8 @@ // Order out current sheet to suppress overlapping of sheets if ([sheet respondsToSelector:@selector(orderOut:)]) [sheet orderOut:nil]; + else if ([sheet respondsToSelector:@selector(window)]) + [[sheet window] orderOut:nil]; if ([contextInfo isEqualToString:@"addRow"]) { alertSheetOpened = NO; @@ -1886,9 +1888,24 @@ // Couldn't truncate table if (![[mySQLConnection getLastErrorMessage] isEqualTo:@""]) { - NSBeginAlertSheet(NSLocalizedString(@"Error truncating table", @"error truncating table message"), - NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, - [NSString stringWithFormat:NSLocalizedString(@"An error occurred while trying to truncate the table '%@'.\n\nMySQL said: %@", @"error truncating table informative message"), [filteredTables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]); + // NSBeginAlertSheet(NSLocalizedString(@"Error truncating table", @"error truncating table message"), + // NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, nil, + // [NSString stringWithFormat:NSLocalizedString(@"An error occurred while trying to truncate the table '%@'.\n\nMySQL said: %@", @"error truncating table informative message"), [filteredTables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]); + + NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Error truncating table", @"error truncating table message") + defaultButton:NSLocalizedString(@"OK", @"OK button") + alternateButton:nil + otherButton:nil + informativeTextWithFormat:[NSString stringWithFormat:NSLocalizedString(@"An error occurred while trying to truncate the table '%@'.\n\nMySQL said: %@", @"error truncating table informative message"), + [filteredTables objectAtIndex:currentIndex], [mySQLConnection getLastErrorMessage]]]; + + [alert setAlertStyle:NSCriticalAlertStyle]; + // NSArray *buttons = [alert buttons]; + // // Change the alert's cancel button to have the key equivalent of return + // [[buttons objectAtIndex:0] setKeyEquivalent:@"t"]; + // [[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask]; + // [[buttons objectAtIndex:1] setKeyEquivalent:@"\r"]; + [alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:@"truncateTableError"]; } // Get next index (beginning from the end) -- cgit v1.2.3