From 299e8821edf9a1705a556c482a2a0ea4d6f9a0a8 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Wed, 17 Feb 2010 15:54:12 +0000 Subject: =?UTF-8?q?=E2=80=A2=20TableDump=20-=20introduced=20new=20method:?= =?UTF-8?q?=20-=20(void)showErrorSheetWithMessage:(NSString*)message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to unify it and made all error sheets doc-modal (not app-modal) - Close button of the errorSheet now also listens at ESC --- Source/TableDump.m | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) (limited to 'Source/TableDump.m') diff --git a/Source/TableDump.m b/Source/TableDump.m index 4854aad3..2a39aca5 100644 --- a/Source/TableDump.m +++ b/Source/TableDump.m @@ -113,7 +113,8 @@ */ - (IBAction)closeSheet:(id)sender { - [NSApp stopModalWithCode:[sender tag]]; + [NSApp endSheet:[sender window] returnCode:[sender tag]]; + [[sender window] orderOut:self]; } /** @@ -734,11 +735,7 @@ // Display any errors if ([errors length]) { - [errorsView setString:errors]; - [NSApp beginSheet:errorsSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; - [NSApp runModalForWindow:errorsSheet]; - [NSApp endSheet:errorsSheet]; - [errorsSheet orderOut:nil]; + [self showErrorSheetWithMessage:errors]; } // Update available databases @@ -1051,11 +1048,7 @@ // Display any errors if ([errors length]) { - [errorsView setString:errors]; - [NSApp beginSheet:errorsSheet modalForWindow:tableWindow modalDelegate:self didEndSelector:nil contextInfo:nil]; - [NSApp runModalForWindow:errorsSheet]; - [NSApp endSheet:errorsSheet]; - [errorsSheet orderOut:nil]; + [self showErrorSheetWithMessage:errors]; } // Import finished Growl notification @@ -1741,13 +1734,7 @@ // Show errors sheet if there have been errors if ( [errors length] ) { - [errorsView setString:errors]; - [NSApp beginSheet:errorsSheet - modalForWindow:tableWindow modalDelegate:self - didEndSelector:nil contextInfo:nil]; - [NSApp runModalForWindow:errorsSheet]; - [NSApp endSheet:errorsSheet]; - [errorsSheet orderOut:nil]; + [self showErrorSheetWithMessage:errors]; } [tableDocumentInstance setQueryMode:SPInterfaceQueryMode]; @@ -2556,13 +2543,7 @@ // Show the errors sheet if there have been errors if ( [errors length] ) { - [errorsView setString:errors]; - [NSApp beginSheet:errorsSheet - modalForWindow:tableWindow modalDelegate:self - didEndSelector:nil contextInfo:nil]; - [NSApp runModalForWindow:errorsSheet]; - [NSApp endSheet:errorsSheet]; - [errorsSheet orderOut:nil]; + [self showErrorSheetWithMessage:errors]; } [tableDocumentInstance setQueryMode:SPInterfaceQueryMode]; @@ -2838,6 +2819,17 @@ return items; } +- (void)showErrorSheetWithMessage:(NSString*)message +{ + [errorsView setString:message]; + [NSApp beginSheet:errorsSheet + modalForWindow:tableWindow + modalDelegate:self + didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) + contextInfo:nil]; + [errorsSheet makeKeyWindow]; +} + #pragma mark - #pragma mark New Export methods -- cgit v1.2.3