aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionControllerDelegate.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-05-24 09:36:20 +0000
committerstuconnolly <stuart02@gmail.com>2012-05-24 09:36:20 +0000
commit0c949f718f591798cba9028c9292aed2be7b9d89 (patch)
treea612860813ddd8ba3cf49cce8de6b7c464d80e9c /Source/SPConnectionControllerDelegate.m
parentb225cf4913e4fe20dfe57922fcbb8caa78878115 (diff)
downloadsequelpro-0c949f718f591798cba9028c9292aed2be7b9d89.tar.gz
sequelpro-0c949f718f591798cba9028c9292aed2be7b9d89.tar.bz2
sequelpro-0c949f718f591798cba9028c9292aed2be7b9d89.zip
Conection outline view fixes:
- When selecting a group node, instead of hiding the connection details, reset them to an empty state. - When removing a favorite make sure the details view is also set to an empty state. - Remove setting the outline view item's text colour, which should fix display issues on 10.7 Addresses points 1 & 5 on issue #1339.
Diffstat (limited to 'Source/SPConnectionControllerDelegate.m')
-rw-r--r--Source/SPConnectionControllerDelegate.m36
1 files changed, 17 insertions, 19 deletions
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index 796edc12..bc065171 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -33,8 +33,6 @@
#import "SPGroupNode.h"
#import "SPTreeNode.h"
-#define CELL(cell) (SPTableTextFieldCell *)cell
-
static NSString *SPDatabaseImage = @"database-small";
@interface SPConnectionController ()
@@ -47,6 +45,7 @@ static NSString *SPDatabaseImage = @"database-small";
- (NSString *)_stripInvalidCharactersFromString:(NSString *)subject;
+- (void)_resetConnectionDetailsInputInterface;
- (void)_setNodeIsExpanded:(BOOL)expanded fromNotification:(NSNotification *)notification;
@end
@@ -79,7 +78,7 @@ static NSString *SPDatabaseImage = @"database-small";
}
- (void)outlineViewSelectionDidChange:(NSNotification *)notification
-{
+{
NSInteger selected = [favoritesOutlineView numberOfSelectedRows];
if (selected == 1) {
@@ -92,14 +91,15 @@ static NSString *SPDatabaseImage = @"database-small";
[addToFavoritesButton setEnabled:NO];
favoriteNameFieldWasTouched = YES;
-
- [connectionResizeContainer setHidden:NO];
- [connectionInstructionsTextField setStringValue:NSLocalizedString(@"Enter connection details below, or choose a favorite", @"enter connection details label")];
}
- else {
- [connectionResizeContainer setHidden:YES];
- [connectionInstructionsTextField setStringValue:NSLocalizedString(@"Please choose a favorite", @"please choose a favorite connection view label")];
+ else {
+ [addToFavoritesButton setEnabled:YES];
+
+ [self _resetConnectionDetailsInputInterface];
}
+
+ [connectionResizeContainer setHidden:NO];
+ [connectionInstructionsTextField setStringValue:NSLocalizedString(@"Enter connection details below, or choose a favorite", @"enter connection details label")];
}
else if (selected > 1) {
[connectionResizeContainer setHidden:YES];
@@ -111,16 +111,8 @@ static NSString *SPDatabaseImage = @"database-small";
{
SPTreeNode *node = (SPTreeNode *)item;
- [CELL(cell) setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
-
- [CELL(cell) setTextColor:([favoritesOutlineView isEnabled]) ? [NSColor blackColor] : [NSColor grayColor]];
-
- if (![[node parentNode] parentNode]) {
- [CELL(cell) setImage:nil];
- }
- else {
- [CELL(cell) setImage:(![node isGroup]) ? [NSImage imageNamed:SPDatabaseImage] : folderImage];
- }
+ [(SPTableTextFieldCell *)cell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [(SPTableTextFieldCell *)cell setImage:(![[node parentNode] parentNode]) ? nil : (![node isGroup]) ? [NSImage imageNamed:SPDatabaseImage] : folderImage];
}
- (CGFloat)outlineView:(NSOutlineView *)outlineView heightOfRowByItem:(id)item
@@ -624,6 +616,12 @@ static NSString *SPDatabaseImage = @"database-small";
#pragma mark -
#pragma mark Private API
+/**
+ * Sets the expanded state of the node from the supplied outline view notification.
+ *
+ * @param expanded The state of the node
+ * @param notification The notification genrated from the state change
+ */
- (void)_setNodeIsExpanded:(BOOL)expanded fromNotification:(NSNotification *)notification
{
SPGroupNode *node = [[[notification userInfo] valueForKey:@"NSObject"] representedObject];