aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/Localizable.strings12
-rw-r--r--Source/TableRelations.m20
-rw-r--r--Source/TablesList.m15
3 files changed, 35 insertions, 12 deletions
diff --git a/Interfaces/English.lproj/Localizable.strings b/Interfaces/English.lproj/Localizable.strings
index 2b07c11e..3a273b00 100644
--- a/Interfaces/English.lproj/Localizable.strings
+++ b/Interfaces/English.lproj/Localizable.strings
@@ -67,6 +67,9 @@
/* delete rows informative message */
"Are you sure you want to delete the selected %d rows from this table. This action cannot be undone." = "Are you sure you want to delete the selected %d rows from this table. This action cannot be undone.";
+/* delete selected relation informative message */
+"Are you sure you want to delete the selected relations?\nThis action cannot be undone!" = "Are you sure you want to delete the selected relations?\nThis action cannot be undone!";
+
/* delete selected row informative message */
"Are you sure you want to delete the selected row from this table. This action cannot be undone." = "Are you sure you want to delete the selected row from this table. This action cannot be undone.";
@@ -130,6 +133,9 @@
/* message of panel when index cannot be created */
"Couldn't add index.\nMySQL said: %@" = "Couldn't add index.\nMySQL said: %@";
+/* message of panel when relation cannot be created */
+"Couldn't add relation.\nMySQL said: %@" = "Couldn't add relation.\nMySQL said: %@";
+
/* message of panel when table cannot be created with the given name */
"Couldn't add table %@.\nMySQL said: %@" = "Couldn't add table %1$@.\nMySQL said: %2$@";
@@ -169,6 +175,9 @@
/* message of panel when index cannot be removed */
"Couldn't remove index.\nMySQL said: %@" = "Couldn't remove index.\nMySQL said: %@";
+/* message of panel when relation cannot be removed */
+"Couldn't remove relation.\nMySQL said: %@" = "Couldn't remove relation.\nMySQL said: %@";
+
/* message of panel when field cannot be removed */
"Couldn't remove rows.\nMySQL said: %@" = "Couldn't remove rows.\nMySQL said: %@";
@@ -211,6 +220,9 @@
/* delete index message */
"Delete Index?" = "Delete Index?";
+/* delete relation message */
+"Delete relation?" = "Delete relation?";
+
/* delete rows message */
"Delete rows?" = "Delete rows?";
diff --git a/Source/TableRelations.m b/Source/TableRelations.m
index 8bd204cb..d95cf471 100644
--- a/Source/TableRelations.m
+++ b/Source/TableRelations.m
@@ -112,7 +112,7 @@
query = [query stringByAppendingString:[NSString stringWithFormat:@" ON UPDATE %@", onUpdate]];
}
- NSLog( query );
+ //NSLog( query );
[mySQLConnection queryString:query];
@@ -187,9 +187,9 @@
// 0 indicates success
if( code ) {
- NSRunAlertPanel(@"Error Adding Relation",
- [NSString stringWithFormat:@"There was a problem adding the relation.\n%@",[mySQLConnection getLastErrorMessage]],
- @"Dang!", nil, nil );
+ NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), //@"Error Adding Relation",
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't add relation.\nMySQL said: %@",@"message of panel when relation cannot be created"),[mySQLConnection getLastErrorMessage]],
+ NSLocalizedString(@"OK", @"OK button"), nil, nil );
} else {
[self refresh:nil];
}
@@ -202,9 +202,10 @@
- (IBAction)removeRow:(id)sender
{
if ( [relationsView numberOfSelectedRows] ) {
- int resp = NSRunAlertPanel(@"Remove Relations",
- @"Are you sure you want to remove the selected relations?",
- @"OK", @"Cancel", nil );
+ int resp = NSRunAlertPanel(NSLocalizedString(@"Delete relation",@"delete relation message"),
+ NSLocalizedString(@"Are you sure you want to delete the selected relations?\nThis action cannot be undone!",@"delete selected relation informative message"),
+ NSLocalizedString(@"Delete", @"delete button"),
+ NSLocalizedString(@"Cancel", @"cancel button"), nil );
if( resp == NSAlertDefaultReturn ) {
NSString *thisTable = [tablesListInstance tableName];
NSIndexSet *selectedSet = [relationsView selectedRowIndexes];
@@ -219,6 +220,11 @@
if ( ! [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
NSLog(@"error: %@", [mySQLConnection getLastErrorMessage]);
+ NSRunAlertPanel(NSLocalizedString(@"Error", @"error"),
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove relation.\nMySQL said: %@",@"message of panel when relation cannot be removed"),[mySQLConnection getLastErrorMessage]],
+ NSLocalizedString(@"OK", @"OK button"), nil, nil );
+ // abort loop
+ break;
}
row = [selectedSet indexLessThanIndex:row];
}
diff --git a/Source/TablesList.m b/Source/TablesList.m
index 4da85d7f..6c81be4f 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -505,11 +505,13 @@
/**
* Method for alert sheets. Invoked when user wants to delete a table.
*/
-- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
+- (void)sheetDidEnd:(NSAlert *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
{
+
if ( [contextInfo isEqualToString:@"addRow"] ) {
alertSheetOpened = NO;
} else if ( [contextInfo isEqualToString:@"removeRow"] ) {
+ [[sheet window] orderOut:nil];
if ( returnCode == NSAlertDefaultReturn ) {
[self removeTable];
}
@@ -572,7 +574,8 @@
currentIndex = [indexes indexLessThanIndex:currentIndex];
}
- [tablesListView deselectAll:self];
+ //[tablesListView deselectAll:self];
+
//[tableSourceInstance loadTable:nil];
//[tableContentInstance loadTable:nil];
//[tableStatusInstance loadTable:nil];
@@ -583,15 +586,17 @@
[tableDocumentInstance name], [tableDocumentInstance database]]];
if ( error ) {
- /* the first sheet is not closed and we try and run this
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't remove table.\nMySQL said: %@", @"message of panel when table cannot be removed"), errorText]);
- */
+
+ /*
NSRunAlertPanel(NSLocalizedString(@"Error", @"error"),
[NSString stringWithFormat:NSLocalizedString(@"Couldn't remove table.\nMySQL said: %@", @"message of panel when table cannot be removed"), errorText],
NSLocalizedString(@"OK", @"OK button"), nil, nil, nil );
+ */
}
-
+
+ [tablesListView deselectAll:self];
}
/**