aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2011-04-03 09:34:29 +0000
committerstuconnolly <stuart02@gmail.com>2011-04-03 09:34:29 +0000
commit3ed8b33deeadcc98185911f41bc6bcb4e53b4719 (patch)
treeb0e20fd5a534a0e24fe00206163fdca5245882fd /Source
parentc7a4e604462e11bf26dc7b58645fa6429848e6fc (diff)
downloadsequelpro-3ed8b33deeadcc98185911f41bc6bcb4e53b4719.tar.gz
sequelpro-3ed8b33deeadcc98185911f41bc6bcb4e53b4719.tar.bz2
sequelpro-3ed8b33deeadcc98185911f41bc6bcb4e53b4719.zip
Bring outline view branch up to date with trunk (r3246:r3264).
Diffstat (limited to 'Source')
-rw-r--r--Source/SPAppController.m2
-rw-r--r--Source/SPContentFilterManager.m2
-rw-r--r--Source/SPDatabaseDocument.h2
-rw-r--r--Source/SPDatabaseDocument.m13
-rw-r--r--Source/SPFieldMapperController.m6
-rw-r--r--Source/SPQueryController.m2
-rw-r--r--Source/SPTableInfo.h1
-rw-r--r--Source/SPTableInfo.m9
-rw-r--r--Source/SPTableStructure.m15
9 files changed, 30 insertions, 22 deletions
diff --git a/Source/SPAppController.m b/Source/SPAppController.m
index 8ea656c5..d151a6e6 100644
--- a/Source/SPAppController.m
+++ b/Source/SPAppController.m
@@ -350,6 +350,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
[[self frontDocument] setStateFromConnectionFile:filename];
+ [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:filename]];
}
else if([[[filename pathExtension] lowercaseString] isEqualToString:[SPBundleFileExtension lowercaseString]]) {
@@ -471,6 +472,7 @@ YY_BUFFER_STATE yy_scan_string (const char *);
}
[spfs release];
+ [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:filename]];
}
else if([[[filename pathExtension] lowercaseString] isEqualToString:[SPColorThemeFileExtension lowercaseString]]) {
diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m
index edbed353..97c0b5d6 100644
--- a/Source/SPContentFilterManager.m
+++ b/Source/SPContentFilterManager.m
@@ -78,7 +78,7 @@
// Add global group row to contentFilters
[contentFilters addObject:[NSDictionary dictionaryWithObjectsAndKeys:
- @"Global", @"MenuLabel",
+ NSLocalizedString(@"Global",@"Content Filter Manager : Filter Entry List: 'Global' Header"), @"MenuLabel",
@"", @"headerOfFileURL",
@"", @"Clause",
@"", @"ConjunctionLabel",
diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h
index 2b7fb38a..485b224b 100644
--- a/Source/SPDatabaseDocument.h
+++ b/Source/SPDatabaseDocument.h
@@ -66,7 +66,7 @@
IBOutlet NSSearchField *listFilterField;
IBOutlet NSScrollView *tableInfoScrollView;
- IBOutlet NSScrollView *activitiesScrollView;
+ IBOutlet NSScrollView *documentActivityScrollView;
IBOutlet NSView *parentView;
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 02b59ebd..fce0bd3f 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -167,7 +167,7 @@
// Set the connection controller's delegate
[connectionController setDelegate:self];
-
+
// Register observers for when the DisplayTableViewVerticalGridlines preference changes
[prefs addObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL];
[prefs addObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL];
@@ -202,6 +202,9 @@
// Hide the tabs in the tab view (we only show them to allow switching tabs in interface builder)
[tableTabView setTabViewType:NSNoTabsNoBorder];
+ // Hide the activity list
+ [self setActivityPaneHidden:[NSNumber numberWithInteger:1]];
+
// Bind the background color of the create syntax text view to the users preference
[createTableSyntaxTextView setAllowsDocumentBackgroundColorChange:YES];
@@ -2173,8 +2176,7 @@
SPBeginAlertSheet(NSLocalizedString(@"Flushed Privileges", @"title of panel when successfully flushed privs"), NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil, NSLocalizedString(@"Successfully flushed privileges.", @"message of panel when successfully flushed privs"));
} else {
//error while flushing privileges
- SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't flush privileges.\nMySQL said: %@", @"message of panel when flushing privs failed"),
- [mySQLConnection getLastErrorMessage]]);
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't flush privileges.\nMySQL said: %@", @"message of panel when flushing privs failed"), [mySQLConnection getLastErrorMessage]]);
}
}
@@ -4439,7 +4441,6 @@
if (![self isSaveInBundle]) {
[self setFileURL:[NSURL fileURLWithPath:path]];
- [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:[NSURL fileURLWithPath:path]];
}
[spfDocData setObject:[NSNumber numberWithBool:([[data objectForKey:@"connection"] objectForKey:@"password"]) ? YES : NO] forKey:@"save_password"];
@@ -5100,9 +5101,9 @@
{
if(![hide integerValue] == 1) {
[tableInfoScrollView setHidden:YES];
- [activitiesScrollView setHidden:NO];
+ [documentActivityScrollView setHidden:NO];
} else {
- [activitiesScrollView setHidden:YES];
+ [documentActivityScrollView setHidden:YES];
[tableInfoScrollView setHidden:NO];
}
}
diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m
index de22b485..f6633172 100644
--- a/Source/SPFieldMapperController.m
+++ b/Source/SPFieldMapperController.m
@@ -1387,7 +1387,7 @@ static NSString *SPTableViewSqlColumnID = @"sql";
// Create a distance matrix for each file-table name
// distance will be calculated by using Levenshtein distance minus common prefix and suffix length
// and minus the length of a fuzzy regex search for a common sequence of characters
- NSUInteger i,j;
+ NSUInteger i,j,k;
NSMutableArray *distMatrix = [NSMutableArray array];
for(i=0; i < [tableHeaderNames count]; i++) {
CGFloat dist = 1e6f;
@@ -1406,8 +1406,8 @@ static NSString *SPTableViewSqlColumnID = @"sql";
NSMutableString *fuzzyRegexp = [[NSMutableString alloc] initWithCapacity:3];
unichar c;
- for(i=0; i<[headerName length]; i++) {
- c = [headerName characterAtIndex:i];
+ for(k=0; k<[headerName length]; k++) {
+ c = [headerName characterAtIndex:k];
if (c == '.' || c == '(' || c == ')' || c == '[' || c == ']' || c == '{' || c == '}')
[fuzzyRegexp appendFormat:@".*?\\%c",c];
else
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 721c27e9..346be3d6 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -529,7 +529,7 @@ static SPQueryController *sharedQueryController = nil;
{
// Register a new untiled document and return its URL
if(fileURL == nil) {
- NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:@"Untitled %ld", (unsigned long)untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
+ NSURL *new = [NSURL URLWithString:[[NSString stringWithFormat:NSLocalizedString(@"Untitled %ld",@"Title of a new Sequel Pro Document"), (unsigned long)untitledDocumentCounter] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
untitledDocumentCounter++;
if(![favoritesContainer objectForKey:[new absoluteString]]) {
diff --git a/Source/SPTableInfo.h b/Source/SPTableInfo.h
index 9328e05c..48e56e0c 100644
--- a/Source/SPTableInfo.h
+++ b/Source/SPTableInfo.h
@@ -33,7 +33,6 @@
IBOutlet NSTableView *activitiesTable;
IBOutlet NSScrollView *tableInfoScrollView;
- IBOutlet NSScrollView *activitiesScrollView;
IBOutlet NSView *containerView;
NSMutableArray *info;
diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m
index 6c7c216d..d06198b4 100644
--- a/Source/SPTableInfo.m
+++ b/Source/SPTableInfo.m
@@ -63,9 +63,6 @@
name:SPActivitiesUpdateNotification
object:nil];
- [tableInfoScrollView setHidden:NO];
- [activitiesScrollView setHidden:YES];
-
// Add activities header
[activities addObject:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"ACTIVITIES", @"header for activities pane"), @"name", nil]];
[activitiesTable reloadData];
@@ -364,12 +361,10 @@
if(rowIndex > 0) return NO;
if(![tableInfoScrollView isHidden]) {
- [tableInfoScrollView setHidden:YES];
- [activitiesScrollView setHidden:NO];
+ [tableDocumentInstance setActivityPaneHidden:[NSNumber numberWithInteger:0]];
[[NSApp mainWindow] makeFirstResponder:activitiesTable];
} else {
- [activitiesScrollView setHidden:YES];
- [tableInfoScrollView setHidden:NO];
+ [tableDocumentInstance setActivityPaneHidden:[NSNumber numberWithInteger:1]];
[[NSApp mainWindow] makeFirstResponder:infoTable];
}
diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m
index 904e4517..aab62af8 100644
--- a/Source/SPTableStructure.m
+++ b/Source/SPTableStructure.m
@@ -203,7 +203,6 @@
}
NSMutableArray *theTableFields = [[NSMutableArray alloc] init];
- [theTableFields setArray:[NSArray array]];
// Make a mutable copy out of the cached [tableDataInstance columns] since we're adding infos
for (id col in [tableDataInstance columns])
@@ -352,6 +351,10 @@
*/
- (IBAction)reloadTable:(id)sender
{
+
+ // Check whether a save of the current row is required
+ if ( ![[self onMainThread] saveRowOnDeselect] ) return;
+
[tableDataInstance resetAllData];
[tableDocumentInstance setStatusRequiresReload:YES];
@@ -379,9 +382,9 @@
[indexesController setTable:selectedTable];
// Reset the table store and display
+ [tableSourceView deselectAll:self];
[tableFields removeAllObjects];
[enumFields removeAllObjects];
- [tableSourceView deselectAll:self];
[indexesTableView deselectAll:self];
[addFieldButton setEnabled:NO];
[copyFieldButton setEnabled:NO];
@@ -846,6 +849,14 @@
*/
- (BOOL)saveRowOnDeselect
{
+
+ // Save any edits which have been made but not saved to the table yet;
+ // but not for any NSSearchFields which could cause a crash for undo, redo.
+ id currentFirstResponder = [[tableDocumentInstance parentWindow] firstResponder];
+ if (currentFirstResponder && [currentFirstResponder isKindOfClass:[NSView class]] && [(NSView *)currentFirstResponder isDescendantOf:tableSourceView]) {
+ [[tableDocumentInstance parentWindow] endEditingFor:nil];
+ }
+
// If no rows are currently being edited, or a save is already in progress, return success at once.
if (!isEditingRow || isSavingRow) return YES;
isSavingRow = YES;