diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-06-23 19:33:06 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-06-23 19:33:06 +0000 |
commit | ed2d754e46bd6a104f1b093b979720727e95dcb5 (patch) | |
tree | 7edc96255734d21fc886945b83d31a1000f43468 /Source/TableContent.m | |
parent | e3dd3a976de60bb6dfcaf7643c376e574a6a3906 (diff) | |
download | sequelpro-ed2d754e46bd6a104f1b093b979720727e95dcb5.tar.gz sequelpro-ed2d754e46bd6a104f1b093b979720727e95dcb5.tar.bz2 sequelpro-ed2d754e46bd6a104f1b093b979720727e95dcb5.zip |
• fixed several problems for alerting an error sheet inside of a didEndSelector: of an other sheet
Diffstat (limited to 'Source/TableContent.m')
-rw-r--r-- | Source/TableContent.m | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m index 06ff12bd..91ecdd53 100644 --- a/Source/TableContent.m +++ b/Source/TableContent.m @@ -1838,9 +1838,12 @@ if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) { [self reloadTable:self]; } else { - NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, - [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove rows.\nMySQL said: %@", @"message of panel when field cannot be removed"), - [mySQLConnection getLastErrorMessage]]); + [self performSelector:@selector(showErrorSheetWith:) + withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"), + [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove rows.\nMySQL said: %@", @"message of panel when field cannot be removed"), + [mySQLConnection getLastErrorMessage]], + nil] + afterDelay:0.3]; } } } else if ( [contextInfo isEqualToString:@"removerow"] ) { @@ -1869,9 +1872,13 @@ } if ( errors ) { - NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"%d rows have not been removed. Reload the table to be sure that the rows exist and use a primary key for your table.", @"message of panel when not all selected fields have been deleted"), errors]); + [self performSelector:@selector(showErrorSheetWith:) + withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Warning", @"warning"), + [NSString stringWithFormat:NSLocalizedString(@"%d row%@ ha%@ not been removed. Reload the table to be sure that the rows exist and use a primary key for your table.", @"message of panel when not all selected fields have been deleted"), errors, (errors>1)?@"s":@"", (errors>1)?@"ve":@"s"], + nil] + afterDelay:0.3]; } - + //do deleting (after enumerating) if ( [prefs boolForKey:@"ReloadAfterRemovingRow"] ) { [self reloadTableValues:self]; @@ -1919,6 +1926,19 @@ } /* + * Show Error sheet (can be called from inside of a endSheet selector) + * via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:] + */ +-(void)showErrorSheetWith:(id)error +{ + // error := first object is the title , second the message, only one button OK + NSBeginAlertSheet([error objectAtIndex:0], NSLocalizedString(@"OK", @"OK button"), + nil, nil, tableWindow, self, nil, nil, nil, + [error objectAtIndex:1]); +} + + +/* * Returns the number of rows in the selected table * Queries the number from MySQL if enabled in prefs and result is limited, otherwise just return the fullResult count. */ |