aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Interfaces/English.lproj/Console.xib19
-rw-r--r--Interfaces/English.lproj/ContentFilterManager.xib20
-rw-r--r--Source/SPTableRelations.m121
-rw-r--r--Source/SPTablesList.m9
4 files changed, 87 insertions, 82 deletions
diff --git a/Interfaces/English.lproj/Console.xib b/Interfaces/English.lproj/Console.xib
index dbf9017a..777528e5 100644
--- a/Interfaces/English.lproj/Console.xib
+++ b/Interfaces/English.lproj/Console.xib
@@ -12,7 +12,9 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="79"/>
+ <integer value="64"/>
+ <integer value="49"/>
+ <integer value="4"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -88,7 +90,7 @@
<object class="NSButton" id="591384017">
<reference key="NSNextResponder" ref="215475093"/>
<int key="NSvFlags">289</int>
- <string key="NSFrame">{{447, 2}, {118, 17}}</string>
+ <string key="NSFrame">{{399, 2}, {166, 17}}</string>
<reference key="NSSuperview" ref="215475093"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="95087038">
@@ -533,7 +535,7 @@
</object>
</object>
</object>
- <int key="NSSelectedIndex">5</int>
+ <int key="NSSelectedIndex">1</int>
<bool key="NSPullDown">YES</bool>
<int key="NSPreferredEdge">1</int>
<bool key="NSUsesItemFromMenu">YES</bool>
@@ -571,14 +573,14 @@
<string key="NSFrameAutosaveName"/>
</object>
<object class="NSCustomView" id="841319465">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSButton" id="926588109">
<reference key="NSNextResponder" ref="841319465"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{10, 6}, {151, 18}}</string>
+ <string key="NSFrame">{{10, 8}, {260, 18}}</string>
<reference key="NSSuperview" ref="841319465"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="570624841">
@@ -605,7 +607,7 @@
<object class="NSButton" id="296628662">
<reference key="NSNextResponder" ref="841319465"/>
<int key="NSvFlags">268</int>
- <string key="NSFrame">{{10, 30}, {154, 18}}</string>
+ <string key="NSFrame">{{10, 32}, {260, 18}}</string>
<reference key="NSSuperview" ref="841319465"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="640143248">
@@ -625,7 +627,8 @@
</object>
</object>
</object>
- <string key="NSFrameSize">{178, 54}</string>
+ <string key="NSFrameSize">{278, 56}</string>
+ <reference key="NSSuperview"/>
<string key="NSClassName">NSView</string>
</object>
<object class="NSMenu" id="1011399888">
@@ -1304,7 +1307,7 @@
<boolean value="YES"/>
<string>{575, 130}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{568, 619}, {178, 54}}</string>
+ <string>{{568, 617}, {278, 56}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
diff --git a/Interfaces/English.lproj/ContentFilterManager.xib b/Interfaces/English.lproj/ContentFilterManager.xib
index 774453df..0c6c417e 100644
--- a/Interfaces/English.lproj/ContentFilterManager.xib
+++ b/Interfaces/English.lproj/ContentFilterManager.xib
@@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">10D573</string>
+ <string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">762</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
- <string key="IBDocument.HIToolboxVersion">460.00</string>
+ <string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
@@ -21,6 +21,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <integer value="280"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -58,7 +59,7 @@
<string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string>
<string key="NSWindowContentMinSize">{500, 371}</string>
<object class="NSView" key="NSWindowView" id="1006">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -463,7 +464,7 @@
<object class="NSButton" id="334702287">
<reference key="NSNextResponder" ref="954707656"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{16, 199}, {187, 18}}</string>
+ <string key="NSFrame">{{16, 199}, {252, 18}}</string>
<reference key="NSSuperview" ref="954707656"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="734314778">
@@ -547,7 +548,7 @@
<object class="NSPopUpButton" id="513522987">
<reference key="NSNextResponder" ref="954707656"/>
<int key="NSvFlags">292</int>
- <string key="NSFrame">{{20, 165}, {124, 25}}</string>
+ <string key="NSFrame">{{20, 165}, {146, 25}}</string>
<reference key="NSSuperview" ref="954707656"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="964598175">
@@ -871,7 +872,7 @@
<object class="NSButton" id="556514169">
<reference key="NSNextResponder" ref="954707656"/>
<int key="NSvFlags">289</int>
- <string key="NSFrame">{{196, 13}, {70, 28}}</string>
+ <string key="NSFrame">{{187, 13}, {84, 28}}</string>
<reference key="NSSuperview" ref="954707656"/>
<int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool>
@@ -897,7 +898,7 @@
<object class="NSButton" id="602197876">
<reference key="NSNextResponder" ref="954707656"/>
<int key="NSvFlags">289</int>
- <string key="NSFrame">{{126, 13}, {70, 28}}</string>
+ <string key="NSFrame">{{105, 13}, {84, 28}}</string>
<reference key="NSSuperview" ref="954707656"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="615814080">
@@ -979,6 +980,7 @@
</object>
</object>
<string key="NSFrameSize">{500, 371}</string>
+ <reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMinSize">{500, 393}</string>
@@ -1495,7 +1497,6 @@
<reference ref="350107303"/>
<reference ref="713893232"/>
<reference ref="407061848"/>
- <reference ref="556514169"/>
<reference ref="149454412"/>
<reference ref="935426286"/>
<reference ref="291991287"/>
@@ -1503,6 +1504,7 @@
<reference ref="513522987"/>
<reference ref="308055338"/>
<reference ref="334702287"/>
+ <reference ref="556514169"/>
<reference ref="602197876"/>
</object>
<reference key="parent" ref="588484039"/>
@@ -3184,7 +3186,7 @@
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>{15, 15}</string>
+ <string>{10, 10}</string>
<string>{9, 8}</string>
<string>{7, 2}</string>
<string>{15, 15}</string>
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index 4aa6d17c..cca7f213 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -106,7 +106,7 @@
* Add a new relation using the selected values.
*/
- (IBAction)confirmAddRelation:(id)sender
-{
+{
[self closeRelationSheet:self];
NSString *thisTable = [tablesListInstance tableName];
@@ -137,11 +137,11 @@
SPBeginAlertSheet(NSLocalizedString(@"Error creating relation", @"error creating relation message"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil, [NSApp mainWindow], nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"The specified relation was unable to be created.\n\nMySQL said: %@", @"error creating relation informative message"), [connection getLastErrorMessage]]);
+ [NSString stringWithFormat:NSLocalizedString(@"The specified relation was unable to be created.\n\nMySQL said: %@", @"error creating relation informative message"), [connection getLastErrorMessage]]);
}
else {
[self _refreshRelationDataForcingCacheRefresh:YES];
- }
+ }
}
/**
@@ -164,7 +164,7 @@
* Called whenever the user selected to add a new relation.
*/
- (IBAction)addRelation:(id)sender
-{
+{
// Set up the controls
[addRelationTableBox setTitle:[NSString stringWithFormat:@"Table: %@", [tablesListInstance tableName]]];
@@ -179,7 +179,7 @@
[result dataSeek:0];
for (NSInteger i = 0; i < [result numOfRows]; i++)
- {
+ {
[refTablePopUpButton addItemWithTitle:[[result fetchRowAsArray] objectAtIndex:0]];
}
@@ -198,22 +198,22 @@
- (IBAction)removeRelation:(id)sender
{
if ([relationsTableView numberOfSelectedRows] > 0) {
-
+
NSAlert *alert = [NSAlert alertWithMessageText:NSLocalizedString(@"Delete relation", @"delete relation message")
defaultButton:NSLocalizedString(@"Delete", @"delete button")
alternateButton:NSLocalizedString(@"Cancel", @"cancel 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:@"d"];
[[buttons objectAtIndex:0] setKeyEquivalentModifierMask:NSCommandKeyMask];
[[buttons objectAtIndex:1] setKeyEquivalent:@"\r"];
-
+
[alert beginSheetModalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:@"removeRelation"];
}
}
@@ -234,30 +234,29 @@
BOOL enableInteraction = ![[tableDocumentInstance selectedToolbarItemIdentifier] isEqualToString:SPMainToolbarTableRelations] || ![tableDocumentInstance isWorking];
// To begin enable all interface elements
- [addRelationButton setEnabled:enableInteraction];
+ [addRelationButton setEnabled:enableInteraction];
[refreshRelationsButton setEnabled:enableInteraction];
[relationsTableView setEnabled:YES];
// Get the current table's storage engine
NSString *engine = [tableDataInstance statusValueForKey:@"Engine"];
-
+
if (([tablesListInstance tableType] == SPTableTypeTable) && ([[engine lowercaseString] isEqualToString:@"innodb"])) {
-
+
// Update the text label
[labelTextField setStringValue:[NSString stringWithFormat:@"Relations for table: %@", [tablesListInstance tableName]]];
-
+
[addRelationButton setEnabled:enableInteraction];
[refreshRelationsButton setEnabled:enableInteraction];
[relationsTableView setEnabled:YES];
- }
- else {
- [addRelationButton setEnabled:NO];
- [refreshRelationsButton setEnabled:NO];
+ } else {
+ [addRelationButton setEnabled:NO];
+ [refreshRelationsButton setEnabled:NO];
[relationsTableView setEnabled:NO];
-
- [labelTextField setStringValue:([tablesListInstance tableType] == SPTableTypeTable) ? @"This table currently does not support relations. Only tables that use the InnoDB storage engine support them." : @""];
- }
-
+
+ [labelTextField setStringValue:([tablesListInstance tableType] == SPTableTypeTable) ? NSLocalizedString(@"This table currently does not support relations. Only tables that use the InnoDB storage engine support them.", @"This table currently does not support relations. Only tables that use the InnoDB storage engine support them.") : @""];
+ }
+
[self _refreshRelationDataForcingCacheRefresh:NO];
}
@@ -359,21 +358,21 @@
[data addObject:headings];
[headings release];
-
+
// Get the relation data
for (NSDictionary *relation in relationData)
{
NSMutableArray *temp = [[NSMutableArray alloc] init];
-
+
[temp addObject:[relation objectForKey:@"name"]];
[temp addObject:[relation objectForKey:@"columns"]];
[temp addObject:[relation objectForKey:@"fk_table"]];
[temp addObject:[relation objectForKey:@"fk_columns"]];
[temp addObject:([relation objectForKey:@"on_update"]) ? [relation objectForKey:@"on_update"] : @""];
[temp addObject:([relation objectForKey:@"on_delete"]) ? [relation objectForKey:@"on_delete"] : @""];
-
+
[data addObject:temp];
-
+
[temp release];
}
@@ -386,35 +385,35 @@
- (void)alertDidEnd:(NSAlert *)alert returnCode:(NSInteger)returnCode contextInfo:(NSString *)contextInfo
{
if ([contextInfo isEqualToString:@"removeRelation"]) {
-
+
if (returnCode == NSAlertDefaultReturn) {
-
+
NSString *thisTable = [tablesListInstance tableName];
NSIndexSet *selectedSet = [relationsTableView selectedRowIndexes];
-
+
NSUInteger row = [selectedSet lastIndex];
-
+
while (row != NSNotFound)
{
NSString *relationName = [[relationData objectAtIndex:row] objectForKey:@"name"];
NSString *query = [NSString stringWithFormat:@"ALTER TABLE %@ DROP FOREIGN KEY %@", [thisTable backtickQuotedString], [relationName backtickQuotedString]];
-
+
[connection queryString:query];
-
+
if ([connection queryErrored]) {
-
+
SPBeginAlertSheet(NSLocalizedString(@"Unable to delete relation", @"error deleting relation message"),
NSLocalizedString(@"OK", @"OK button"),
nil, nil, [NSApp mainWindow], nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"The selected relation couldn't be deleted.\n\nMySQL said: %@", @"error deleting relation informative message"), [connection getLastErrorMessage]]);
-
+ [NSString stringWithFormat:NSLocalizedString(@"The selected relation couldn't be deleted.\n\nMySQL said: %@", @"error deleting relation informative message"), [connection getLastErrorMessage]]);
+
// Abort loop
break;
}
-
+
row = [selectedSet indexLessThanIndex:row];
}
-
+
[self _refreshRelationDataForcingCacheRefresh:YES];
}
}
@@ -424,21 +423,21 @@
* This method is called as part of Key Value Observing which is used to watch for prefernce changes which effect the interface.
*/
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
-{
+{
// Display table veiew vertical gridlines preference changed
if ([keyPath isEqualToString:SPDisplayTableViewVerticalGridlines]) {
[relationsTableView setGridStyleMask:([[change objectForKey:NSKeyValueChangeNewKey] boolValue]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone];
}
// Use monospaced fonts preference changed
else if ([keyPath isEqualToString:SPUseMonospacedFonts]) {
-
+
BOOL useMonospacedFont = [[change objectForKey:NSKeyValueChangeNewKey] boolValue];
-
+
for (NSTableColumn *column in [relationsTableView tableColumns])
{
[[column dataCell] setFont:(useMonospacedFont) ? [NSFont fontWithName:SPDefaultMonospacedFontName size:[NSFont smallSystemFontSize]] : [NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
}
-
+
[relationsTableView reloadData];
}
}
@@ -451,7 +450,7 @@
// Remove row
if ([menuItem action] == @selector(removeRelation:)) {
[menuItem setTitle:([relationsTableView numberOfSelectedRows] > 1) ? NSLocalizedString(@"Delete Relations", @"delete relations menu item") : NSLocalizedString(@"Delete Relation", @"delete relation menu item")];
-
+
return ([relationsTableView numberOfSelectedRows] > 0);
}
@@ -464,12 +463,12 @@
* Dealloc.
*/
- (void)dealloc
-{
+{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:SPUseMonospacedFonts];
[relationData release], relationData = nil;
-
+
[super dealloc];
}
@@ -485,11 +484,11 @@
[relationData removeAllObjects];
if ([tablesListInstance tableType] == SPTableTypeTable) {
-
+
if (clearAllCaches) [tableDataInstance updateInformationForCurrentTable];
-
+
NSArray *constraints = [tableDataInstance getConstraints];
-
+
for (NSDictionary *constraint in constraints)
{
[relationData addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@@ -500,7 +499,7 @@
([constraint objectForKey:@"update"] ? [constraint objectForKey:@"update"] : @""), @"on_update",
([constraint objectForKey:@"delete"] ? [constraint objectForKey:@"delete"] : @""), @"on_delete",
nil]];
-
+
}
}
@@ -515,40 +514,40 @@
{
NSString *column = [columnPopUpButton titleOfSelectedItem];
NSString *table = [refTablePopUpButton titleOfSelectedItem];
-
+
[tableDataInstance resetAllData];
[tableDataInstance updateInformationForCurrentTable];
-
+
NSDictionary *columnInfo = [[tableDataInstance columnWithName:column] copy];
-
+
[refColumnPopUpButton setEnabled:NO];
[confirmAddRelationButton setEnabled:NO];
-
+
[refColumnPopUpButton removeAllItems];
-
+
[tableDataInstance resetAllData];
NSDictionary *tableInfo = [tableDataInstance informationForTable:table];
-
+
NSArray *columns = [tableInfo objectForKey:@"columns"];
-
+
NSMutableArray *validColumns = [NSMutableArray array];
-
+
// Only add columns of the same data type
for (NSDictionary *aColumn in columns)
- {
+ {
if ([[columnInfo objectForKey:@"type"] isEqualToString:[aColumn objectForKey:@"type"]]) {
- [validColumns addObject:[aColumn objectForKey:@"name"]];
+ [validColumns addObject:[aColumn objectForKey:@"name"]];
}
}
-
+
// Add the valid columns
if ([validColumns count] > 0) {
[refColumnPopUpButton addItemsWithTitles:validColumns];
-
+
[refColumnPopUpButton setEnabled:YES];
[confirmAddRelationButton setEnabled:YES];
}
-
+
[columnInfo release];
}
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index 509e3b83..d0d39eec 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -869,9 +869,10 @@
[separatorTableMenuItem setHidden:YES];
[separatorTableMenuItem2 setHidden:YES];
[showCreateSyntaxMenuItem setHidden:YES];
-
- NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTitle:@"Table"] submenu];
-
+
+ // Get main menu "Table"'s submenu
+ NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTag:SPMainMenuTable] submenu];
+
[[tableSubMenu itemAtIndex:6] setTitle:NSLocalizedString(@"Check Selected Items", @"check selected items menu item")];
[[tableSubMenu itemAtIndex:7] setTitle:NSLocalizedString(@"Repair Selected Items", @"repair selected items menu item")];
@@ -926,7 +927,7 @@
// Set gear menu items Remove/Duplicate table/view and mainMenu > Table items
// according to the table types
- NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTitle:@"Table"] submenu];
+ NSMenu *tableSubMenu = [[[NSApp mainMenu] itemWithTag:SPMainMenuTable] submenu];
// Enable/disable the various menu items depending on the selected item. Also update their titles.
// Note, that this should ideally be moved to menu item validation as opposed to using fixed item positions.