From aedee4ef796c779fe3b18fd28fc41cad88243b36 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Sat, 5 Dec 2009 00:13:50 +0000 Subject: - To improve the favourites/SPF split, hide the document icon and name for untitled documents --- Source/TableDocument.m | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Source/TableDocument.m b/Source/TableDocument.m index ba98a3d7..6d77b4e5 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -634,9 +634,10 @@ mySQLConnection = [theConnection retain]; // Set the fileURL and init the preferences (query favs, filters, and history) if available for that URL - [self setFileURL:[[SPQueryController sharedQueryController] registerDocumentWithFileURL:[self fileURL] andContextInfo:[spfPreferences retain]]]; - - [spfPreferences release]; + [self setFileURL:[[SPQueryController sharedQueryController] registerDocumentWithFileURL:[self fileURL] andContextInfo:spfPreferences]]; + + // ...but hide the icon while the document is temporary + if ([self isUntitled]) [[tableWindow standardWindowButton:NSWindowDocumentIconButton] setImage:nil]; // Set the connection encoding NSString *encodingName = [prefs objectForKey:SPDefaultEncoding]; @@ -3435,6 +3436,14 @@ if (_isWorkingLevel) [self centerTaskWindow]; } +/** + * Invoked when the user command-clicks on the window title to see the document path + */ +- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu +{ + return ![self isUntitled]; +} + /* * Invoked if user chose "Save" from 'Do you want save changes you made...' sheet * which is called automatically if [self isDocumentEdited] == YES and user wanted to close an Untitled doc. @@ -3469,12 +3478,12 @@ { if (!_isConnected) { return [NSString stringWithFormat:@"%@%@", - ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ — ",[[[[self fileURL] absoluteString] lastPathComponent] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] : @"", @"Sequel Pro"]; + ([[[self fileURL] absoluteString] length] && ![self isUntitled]) ? [NSString stringWithFormat:@"%@ — ",[[[[self fileURL] absoluteString] lastPathComponent] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] : @"", @"Sequel Pro"]; } return [NSString stringWithFormat:@"%@(MySQL %@) %@%@%@", - ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ — ",[self displayName]] : @"", + ([[[self fileURL] absoluteString] length] && ![self isUntitled]) ? [NSString stringWithFormat:@"%@ — ",[self displayName]] : @"", mySQLVersion, [self name], ([self database]?[NSString stringWithFormat:@"/%@",[self database]]:@""), -- cgit v1.2.3