aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/TableSource.h2
-rw-r--r--Source/TableSource.m31
2 files changed, 27 insertions, 6 deletions
diff --git a/Source/TableSource.h b/Source/TableSource.h
index 9776620e..06528e04 100644
--- a/Source/TableSource.h
+++ b/Source/TableSource.h
@@ -63,6 +63,8 @@
NSUserDefaults *prefs;
}
+-(void)showErrorSheetWithTitle:(id)error;
+
//table methods
- (void)loadTable:(NSString *)aTable;
- (IBAction)reloadTable:(id)sender;
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 24fd13a5..2f66d1fb 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -847,10 +847,13 @@ fetches the result as an array with a dictionary for each row in it
[tablesListInstance setContentRequiresReload:YES];
[tableDataInstance resetColumnData];
} else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
- [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"],
- [mySQLConnection getLastErrorMessage]]);
+ [self performSelector:@selector(showErrorSheetWithTitle:)
+ withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"),
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
+ [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"],
+ [mySQLConnection getLastErrorMessage]],
+ nil]
+ afterDelay:0.3];
}
}
} else if ( [contextInfo isEqualToString:@"removeindex"] ) {
@@ -866,8 +869,12 @@ fetches the result as an array with a dictionary for each row in it
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
[self loadTable:selectedTable];
} else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove index.\nMySQL said: %@", @"message of panel when index cannot be removed"), [mySQLConnection getLastErrorMessage]]);
+ [self performSelector:@selector(showErrorSheetWithTitle:)
+ withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"),
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove index.\nMySQL said: %@", @"message of panel when index cannot be removed"),
+ [mySQLConnection getLastErrorMessage]],
+ nil]
+ afterDelay:0.3];
}
}
} else if ( [contextInfo isEqualToString:@"cannotremovefield"]) {
@@ -876,6 +883,18 @@ fetches the result as an array with a dictionary for each row in it
}
+/*
+ * Show Error sheet (can be called from inside of a endSheet selector)
+ * via [self performSelector:@selector(showErrorSheetWithTitle:) withObject: afterDelay:]
+ */
+-(void)showErrorSheetWithTitle:(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]);
+}
+
/**
* This method is called as part of Key Value Observing which is used to watch for preference changes which effect the interface.
*/