aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/TableContent.m30
-rw-r--r--Source/TableDocument.m19
-rw-r--r--Source/TableSource.h1
-rw-r--r--Source/TableSource.m6
4 files changed, 46 insertions, 10 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.
*/
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index 0bf9613e..93b22cae 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -784,7 +784,12 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[mySQLConnection queryString:[NSString stringWithFormat:@"DROP DATABASE %@", [[self database] backtickQuotedString]]];
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
// error while deleting db
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove database.\nMySQL said: %@", @"message of panel when removing db failed"), [mySQLConnection getLastErrorMessage]]);
+ [self performSelector:@selector(showErrorSheetWith:)
+ withObject:[NSArray arrayWithObjects:NSLocalizedString(@"Error", @"error"),
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove database.\nMySQL said: %@", @"message of panel when removing db failed"),
+ [mySQLConnection getLastErrorMessage]],
+ nil]
+ afterDelay:0.3];
return;
}
@@ -797,6 +802,18 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
}
}
+/*
+ * 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]);
+}
+
- (IBAction)connectSheetShowHelp:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.sequelpro.com/docs/Getting_Connected"]];
diff --git a/Source/TableSource.h b/Source/TableSource.h
index 06528e04..aeef8190 100644
--- a/Source/TableSource.h
+++ b/Source/TableSource.h
@@ -63,7 +63,6 @@
NSUserDefaults *prefs;
}
--(void)showErrorSheetWithTitle:(id)error;
//table methods
- (void)loadTable:(NSString *)aTable;
diff --git a/Source/TableSource.m b/Source/TableSource.m
index 648d53f6..130f9d54 100644
--- a/Source/TableSource.m
+++ b/Source/TableSource.m
@@ -849,7 +849,7 @@ fetches the result as an array with a dictionary for each row in it
[tablesListInstance setContentRequiresReload:YES];
[tableDataInstance resetColumnData];
} else {
- [self performSelector:@selector(showErrorSheetWithTitle:)
+ [self performSelector:@selector(showErrorSheetWith:)
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"],
@@ -871,7 +871,7 @@ fetches the result as an array with a dictionary for each row in it
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
[self loadTable:selectedTable];
} else {
- [self performSelector:@selector(showErrorSheetWithTitle:)
+ [self performSelector:@selector(showErrorSheetWith:)
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]],
@@ -889,7 +889,7 @@ 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
+-(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"),