diff options
author | stuconnolly <stuart02@gmail.com> | 2011-05-07 22:23:41 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2011-05-07 22:23:41 +0000 |
commit | 2d68227fd525a377796b6e825bf78bbda7f611b2 (patch) | |
tree | 510776dc2a15039f3b09f4c2a009487588c8537d /Source/SPTableContent.m | |
parent | dfb28b2af2478e5b249de0b2b4381479e55f2980 (diff) | |
download | sequelpro-2d68227fd525a377796b6e825bf78bbda7f611b2.tar.gz sequelpro-2d68227fd525a377796b6e825bf78bbda7f611b2.tar.bz2 sequelpro-2d68227fd525a377796b6e825bf78bbda7f611b2.zip |
Add an 'Add New Row' menu item to the table content context menu. Completes the implementation of issue #939.
Diffstat (limited to 'Source/SPTableContent.m')
-rw-r--r-- | Source/SPTableContent.m | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index e3c990d3..572a430e 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -4645,16 +4645,23 @@ */ - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { + SEL action = [menuItem action]; + // Remove row - if ([menuItem action] == @selector(removeRow:)) { - [menuItem setTitle:([tableContentView numberOfSelectedRows] > 1) ? @"Delete Rows" : @"Delete Row"]; + if (action == @selector(removeRow:)) { + [menuItem setTitle:([tableContentView numberOfSelectedRows] > 1) ? NSLocalizedString(@"Delete Rows", @"delete rows menu item plural") : NSLocalizedString(@"Delete Row", @"delete row menu item singular")]; return ([tableContentView numberOfSelectedRows] > 0 && [tablesListInstance tableType] == SPTableTypeTable); } // Duplicate row - if ([menuItem action] == @selector(copyRow:)) { - return ([tableContentView numberOfSelectedRows] == 1 && [tablesListInstance tableType] == SPTableTypeTable); + if (action == @selector(copyRow:)) { + return (([tableContentView numberOfSelectedRows]) == 1 && ([tablesListInstance tableType] == SPTableTypeTable)); + } + + // Add new row + if (action == @selector(addRow:)) { + return ((![tableContentView numberOfSelectedRows]) && ([tablesListInstance tableType] == SPTableTypeTable)); } return YES; |