aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TableDocument.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-12-05 00:13:50 +0000
committerrowanbeentje <rowan@beent.je>2009-12-05 00:13:50 +0000
commitaedee4ef796c779fe3b18fd28fc41cad88243b36 (patch)
tree9e6b7515231ac377594348292ecda0ce7a2b5008 /Source/TableDocument.m
parent11eca30d1b8abf87575bb59ef3f1a7e2478ab21a (diff)
downloadsequelpro-aedee4ef796c779fe3b18fd28fc41cad88243b36.tar.gz
sequelpro-aedee4ef796c779fe3b18fd28fc41cad88243b36.tar.bz2
sequelpro-aedee4ef796c779fe3b18fd28fc41cad88243b36.zip
- To improve the favourites/SPF split, hide the document icon and name for untitled documents
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r--Source/TableDocument.m19
1 files 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]]:@""),