diff options
author | stuconnolly <stuart02@gmail.com> | 2009-11-11 22:51:40 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2009-11-11 22:51:40 +0000 |
commit | 876432a34ce9e99c45b16a2d42df5a0af8baec2c (patch) | |
tree | 7975276f6e55e829c54a72d1cb087ca824ec30ac | |
parent | f3ebf339d5649b25a75b65295e52c760751b690c (diff) | |
download | sequelpro-876432a34ce9e99c45b16a2d42df5a0af8baec2c.tar.gz sequelpro-876432a34ce9e99c45b16a2d42df5a0af8baec2c.tar.bz2 sequelpro-876432a34ce9e99c45b16a2d42df5a0af8baec2c.zip |
Change the main window's non-connected/connecting state title to 'Sequel Pro' and only change it to 'Connecting...' when we are actually trying to establish a connection. Fixes issue #456.
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 66 | ||||
-rw-r--r-- | Source/SPConnectionController.h | 11 | ||||
-rw-r--r-- | Source/SPConnectionController.m | 15 | ||||
-rw-r--r-- | Source/TableDocument.m | 32 |
4 files changed, 85 insertions, 39 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 60d1a3f2..eaa6a5de 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -3,7 +3,7 @@ <data> <int key="IBDocument.SystemTarget">1050</int> <string key="IBDocument.SystemVersion">10C540</string> - <string key="IBDocument.InterfaceBuilderVersion">732</string> + <string key="IBDocument.InterfaceBuilderVersion">740</string> <string key="IBDocument.AppKitVersion">1038.25</string> <string key="IBDocument.HIToolboxVersion">458.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> @@ -16,21 +16,21 @@ </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>732</string> - <string>732</string> + <string>740</string> + <string>740</string> <string>1.2.1</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="1246"/> <integer value="321"/> + <integer value="1246"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> <string>com.brandonwalkin.BWToolkit</string> - <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.WebKitIBPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -57,10 +57,10 @@ <int key="NSWindowBacking">2</int> <string key="NSWindowRect">{{462, 293}, {944, 550}}</string> <int key="NSWTFlags">1886912512</int> - <string key="NSWindowTitle">Connecting...</string> + <string key="NSWindowTitle">Sequel Pro</string> <string key="NSWindowClass">NSWindow</string> <string key="NSViewClass">View</string> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{780, 480}</string> <object class="NSView" key="NSWindowView" id="579726586"> <reference key="NSNextResponder"/> @@ -238,7 +238,7 @@ <string key="NSColorName">controlColor</string> <object class="NSColor" key="NSColor" id="1001122760"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes> + <bytes key="NSWhite">MC42NjY2NjY2ODY1AA</bytes> </object> </object> <reference key="NSTextColor" ref="454249633"/> @@ -4871,7 +4871,7 @@ </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{780, 502}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName"/> </object> <object class="NSWindowTemplate" id="554105051"> @@ -6042,7 +6042,7 @@ <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="329225443"> <reference key="NSNextResponder"/> @@ -6323,7 +6323,7 @@ </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="734744289"> <int key="NSWindowStyleMask">1</int> @@ -6335,7 +6335,7 @@ <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="234287744"> <nil key="NSNextResponder"/> @@ -6491,7 +6491,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="787219800"> <int key="NSWindowStyleMask">1</int> @@ -6501,7 +6501,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowTitle">New Relation</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="842408319"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -7102,7 +7102,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSFrameSize">{302, 307}</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="1066802919"> <int key="NSWindowStyleMask">3</int> @@ -7114,7 +7114,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 50}</string> <object class="NSView" key="NSWindowView" id="525490268"> <nil key="NSNextResponder"/> @@ -7234,7 +7234,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{213, 72}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="553728448"> <int key="NSWindowStyleMask">9</int> @@ -7246,7 +7246,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="1052076676"> <nil key="NSNextResponder"/> @@ -7381,7 +7381,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="202784209"> <int key="NSWindowStyleMask">15</int> @@ -7393,7 +7393,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{350, 200}</string> <object class="NSView" key="NSWindowView" id="226131408"> <nil key="NSNextResponder"/> @@ -7697,7 +7697,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{350, 222}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="828950706"> <int key="NSWindowStyleMask">15</int> @@ -7709,7 +7709,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{350, 200}</string> <object class="NSView" key="NSWindowView" id="749598685"> <nil key="NSNextResponder"/> @@ -7911,7 +7911,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> <string key="NSMinSize">{350, 222}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="466147946"> <int key="NSWindowStyleMask">9</int> @@ -7923,7 +7923,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{213, 107}</string> <object class="NSView" key="NSWindowView" id="860968037"> <nil key="NSNextResponder"/> @@ -8072,7 +8072,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1440, 878}}</string> <string key="NSMinSize">{213, 129}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="78186995"> <int key="NSWindowStyleMask">31</int> @@ -8082,7 +8082,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowTitle">MySQL Help</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{351, 120}</string> <object class="NSView" key="NSWindowView" id="539508428"> <nil key="NSNextResponder"/> @@ -8476,7 +8476,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1280, 1002}}</string> <string key="NSMinSize">{351, 136}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSFrameAutosaveName">MYSQL_HELP_WINDOW</string> </object> <object class="NSWindowTemplate" id="176945499"> @@ -8489,7 +8489,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSMutableString" key="NSViewClass"> <characters key="NS.bytes">View</characters> </object> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{350, 250}</string> <object class="NSView" key="NSWindowView" id="1024486775"> <nil key="NSNextResponder"/> @@ -8880,7 +8880,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> </object> <string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string> <string key="NSMinSize">{350, 272}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSWindowTemplate" id="434046103"> <int key="NSWindowStyleMask">9</int> @@ -9013,7 +9013,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSWindowTitle">Secure Text Input Sheet</string> <string key="NSWindowClass">NSPanel</string> <nil key="NSViewClass"/> - <string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <object class="NSView" key="NSWindowView" id="978976687"> <nil key="NSNextResponder"/> <int key="NSvFlags">256</int> @@ -9117,7 +9117,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSFrameSize">{338, 138}</string> </object> <string key="NSScreenRect">{{0, 0}, {1280, 778}}</string> - <string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string> + <string key="NSMaxSize">{3.40282e+38, 3.40282e+38}</string> </object> <object class="NSCustomView" id="139279766"> <nil key="NSNextResponder"/> @@ -10983,7 +10983,7 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string key="NSColorName">disabledControlTextColor</string> <object class="NSColor" key="NSColor"> <int key="NSColorSpace">3</int> - <bytes key="NSWhite">MC4zMzMzMzMzMzMzAA</bytes> + <bytes key="NSWhite">MC4zMzMzMzMzNDMzAA</bytes> </object> </object> </object> @@ -26116,7 +26116,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <object class="NSArray" key="dict.sortedKeys"> <bool key="EncodedWithXMLCoder">YES</bool> <string>addField:</string> - <string>addIndex:</string> <string>chooseIndexType:</string> <string>closeKeySheet:</string> <string>closeSheet:</string> @@ -26137,7 +26136,6 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string> <string>id</string> <string>id</string> <string>id</string> - <string>id</string> </object> </object> <object class="NSMutableDictionary" key="outlets"> diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index 3fe45e9a..e4a26a06 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -45,8 +45,18 @@ enum spconnection_types @end +@interface NSObject (SPConnectionControllerDelegate) + +- (void)connectionControllerInitiatingConnection:(id)controller; +- (void)connectionControllerConnectAttemptFailed:(id)controller; + +@end + + @interface SPConnectionController : NSObject { + id delegate; + TableDocument *tableDocument; NSWindow *documentWindow; NSSplitView *contentView; @@ -103,6 +113,7 @@ enum spconnection_types IBOutlet NSTextField *progressIndicatorText; } +@property (readwrite, assign) id delegate; @property (readwrite, assign) int type; @property (readwrite, retain) NSString *name; @property (readwrite, retain) NSString *host; diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index fb357f17..8299e024 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -32,6 +32,7 @@ @implementation SPConnectionController +@synthesize delegate; @synthesize type; @synthesize name; @synthesize host; @@ -146,7 +147,7 @@ * connection proxies in use. */ - (IBAction)initiateConnection:(id)sender -{ +{ // Ensure that host is not empty if this is a TCP/IP or SSH connection if (([self type] == SP_CONNECTION_TCPIP || [self type] == SP_CONNECTION_SSHTUNNEL) && ![[self host] length]) { NSRunAlertPanel(NSLocalizedString(@"Insufficient connection details", @"insufficient details message"), NSLocalizedString(@"Insufficient details provided to establish a connection. Please provide at least a host.", @"insufficient details informative message"), NSLocalizedString(@"OK", @"OK button"), nil, nil); @@ -161,7 +162,7 @@ // Ensure that a socket connection is not inadvertently used if (![self checkHost]) return; - + // Basic details have validated - start the connection process animating [addToFavoritesButton setHidden:YES]; [helpButton setHidden:YES]; @@ -193,6 +194,11 @@ [connectionSSHKeychainItemAccount release], connectionSSHKeychainItemAccount = nil; } } + + // Inform the delegate that we are starting the connection process + if (delegate && [delegate respondsToSelector:@selector(connectionControllerInitiatingConnection:)]) { + [delegate connectionControllerInitiatingConnection:self]; + } // Initiate the SSH connection process for tunnels if ([self type] == SP_CONNECTION_SSHTUNNEL) { @@ -395,6 +401,11 @@ } if (errorDetail) [errorDetailText setString:errorDetail]; + + // Inform the delegate that the connection attempt failed + if (delegate && [delegate respondsToSelector:@selector(connectionControllerConnectAttemptFailed:)]) { + [delegate connectionControllerConnectAttemptFailed:self]; + } // Display the connection error message NSBeginAlertSheet(theTitle, NSLocalizedString(@"OK", @"OK button"), (errorDetail) ? NSLocalizedString(@"Show Detail", @"Show detail button") : nil, (isSSHTunnelBindError) ? NSLocalizedString(@"Use Standard Connection", @"use standard connection button") : nil, documentWindow, self, nil, @selector(errorSheetDidEnd:returnCode:contextInfo:), @"connect", theErrorMessage); diff --git a/Source/TableDocument.m b/Source/TableDocument.m index 71ac951f..b8071060 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -163,6 +163,9 @@ // Set up the connection controller connectionController = [[SPConnectionController alloc] initWithDocument:self]; + + // Set the connection controller's delegate + [connectionController setDelegate:self]; // Register observers for when the DisplayTableViewVerticalGridlines preference changes [prefs addObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines options:NSKeyValueObservingOptionNew context:NULL]; @@ -3480,10 +3483,12 @@ */ - (NSString *)displaySPName { - if (!_isConnected) return [NSString stringWithFormat:@"%@%@", - ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ — ",[[[[self fileURL] absoluteString] lastPathComponent] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] : @"", - NSLocalizedString(@"Connecting…", @"window title string indicating that sp is connecting")]; + if (!_isConnected) { + return [NSString stringWithFormat:@"%@%@", + ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ — ",[[[[self fileURL] absoluteString] lastPathComponent] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]] : @"", @"Sequel Pro"]; + } + return [NSString stringWithFormat:@"%@(MySQL %@) %@%@%@", ([[[self fileURL] absoluteString] length]) ? [NSString stringWithFormat:@"%@ — ",[self displayName]] : @"", mySQLVersion, @@ -3594,6 +3599,27 @@ } #pragma mark - +#pragma mark + +/** + * Invoked by the connection controller when it starts the process of initiating a connection. + */ +- (void)connectionControllerInitiatingConnection:(id)controller +{ + // Update the window title to indicate that we are try to establish a connection + [tableWindow setTitle:NSLocalizedString(@"Connecting…", @"window title string indicating that sp is connecting")]; +} + +/** + * Invoked by the connection controller when the attempt to initiate a connection failed. + */ +- (void)connectionControllerConnectAttemptFailed:(id)controller +{ + // Reset the window title + [tableWindow setTitle:[self displaySPName]]; +} + +#pragma mark - #pragma mark Database name field delegate methods /** |