aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-08-27 20:15:10 +0000
committerstuconnolly <stuart02@gmail.com>2009-08-27 20:15:10 +0000
commitb4132a93b4cc370434b22c3ed8c644e6c850d9ad (patch)
treea4a224fe42b8df788ce83682de9fab48fdb6eb97 /Source
parent0a7642665ea627738ac8a9b858c3ac45c5c0b941 (diff)
downloadsequelpro-b4132a93b4cc370434b22c3ed8c644e6c850d9ad.tar.gz
sequelpro-b4132a93b4cc370434b22c3ed8c644e6c850d9ad.tar.bz2
sequelpro-b4132a93b4cc370434b22c3ed8c644e6c850d9ad.zip
When creating a new relation, the ON UPDATE and ON DELETE drop downs should only contain valid MySQL options. Fixes issue #388.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableRelations.m16
1 files changed, 11 insertions, 5 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index b3ae6b50..5da03fcc 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -95,12 +95,12 @@
// If required add ON DELETE
if ([onDeletePopUpButton indexOfSelectedItem] > 0) {
- query = [query stringByAppendingString:[NSString stringWithFormat:@" ON DELETE %@", [onDeletePopUpButton titleOfSelectedItem]]];
+ query = [query stringByAppendingString:[NSString stringWithFormat:@" ON DELETE %@", [[onDeletePopUpButton titleOfSelectedItem] uppercaseString]]];
}
// If required add ON UPDATE
if ([onUpdatePopUpButton indexOfSelectedItem] > 0) {
- query = [query stringByAppendingString:[NSString stringWithFormat:@" ON UPDATE %@", [onUpdatePopUpButton titleOfSelectedItem]]];
+ query = [query stringByAppendingString:[NSString stringWithFormat:@" ON UPDATE %@", [[onUpdatePopUpButton titleOfSelectedItem] uppercaseString]]];
}
// Execute query
@@ -176,13 +176,19 @@
if ([relationsTableView numberOfSelectedRows] > 0) {
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Delete relation", @"delete relation message")
- defaultButton:NSLocalizedString(@"Delete", @"delete button")
- alternateButton:NSLocalizedString(@"Cancel", @"cancel button")
+ defaultButton:NSLocalizedString(@"Cancel", @"cancel button")
+ alternateButton:NSLocalizedString(@"Delete", @"delete button")
otherButton:nil
informativeTextWithFormat:NSLocalizedString(@"Are you sure you want to delete the selected relations? This action cannot be undone.", @"delete selected relation informative message")];
[alert setAlertStyle:NSCriticalAlertStyle];
+ NSArray *buttons = [alert buttons];
+
+ // Change the alert's cancel button to have the key equivalent of return
+ [[buttons objectAtIndex:0] setKeyEquivalent:@""];
+ [[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];
+
[alert beginSheetModalForWindow:tableWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:@"removeRelation"];
}
}
@@ -271,7 +277,7 @@
{
if ([contextInfo isEqualToString:@"removeRelation"]) {
- if (returnCode == NSAlertDefaultReturn) {
+ if (returnCode == NSAlertAlternateReturn) {
NSString *thisTable = [tablesListInstance tableName];
NSIndexSet *selectedSet = [relationsTableView selectedRowIndexes];