aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-02-19 18:11:59 +0100
committerMax <post@wickenrode.com>2015-02-19 18:11:59 +0100
commit5f3c003919903c597b2d6aeb7fcc064b0d6d9ef3 (patch)
tree11acdc1c1616870f42f8e983f9c5f76a0b3f2ccb
parentfc02994e768eece82442bed8e6d21134d392b7a1 (diff)
downloadsequelpro-5f3c003919903c597b2d6aeb7fcc064b0d6d9ef3.tar.gz
sequelpro-5f3c003919903c597b2d6aeb7fcc064b0d6d9ef3.tar.bz2
sequelpro-5f3c003919903c597b2d6aeb7fcc064b0d6d9ef3.zip
Fix a bug that could cause items in the favorite list to be color-labeled when they don't have a label assigned
-rw-r--r--Source/SPConnectionControllerDelegate.m19
-rw-r--r--Source/SPFavoriteTextFieldCell.m2
2 files changed, 12 insertions, 9 deletions
diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m
index 8cef86e9..f0813292 100644
--- a/Source/SPConnectionControllerDelegate.m
+++ b/Source/SPConnectionControllerDelegate.m
@@ -147,38 +147,41 @@ static NSString *SPQuickConnectImageWhite = @"quick-connect-icon-white.pdf";
- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item
{
- SPTreeNode *node = (SPTreeNode *)item;
+ SPTreeNode *node = (SPTreeNode *)item;
+ SPFavoriteTextFieldCell *favoriteCell = (SPFavoriteTextFieldCell *)cell;
// Draw entries with the small system font by default
- [(SPTableTextFieldCell *)cell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [cell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
// Set an image as appropriate; the quick connect image for that entry, no image for other
// top-level items, the folder image for group nodes, or the database image for other nodes.
if (![[node parentNode] parentNode]) {
if (node == quickConnectItem) {
if ([outlineView rowForItem:item] == [outlineView selectedRow]) {
- [(SPTableTextFieldCell *)cell setImage:[NSImage imageNamed:SPQuickConnectImageWhite]];
+ [favoriteCell setImage:[NSImage imageNamed:SPQuickConnectImageWhite]];
}
else {
- [(SPTableTextFieldCell *)cell setImage:[NSImage imageNamed:SPQuickConnectImage]];
+ [favoriteCell setImage:[NSImage imageNamed:SPQuickConnectImage]];
}
}
else {
- [(SPTableTextFieldCell *)cell setImage:nil];
+ [favoriteCell setImage:nil];
}
+ [favoriteCell setLabelColor:nil];
}
else {
if ([node isGroup]) {
- [(SPTableTextFieldCell *)cell setImage:folderImage];
+ [favoriteCell setImage:folderImage];
+ [favoriteCell setLabelColor:nil];
}
else {
- [(SPTableTextFieldCell *)cell setImage:[NSImage imageNamed:SPDatabaseImage]];
+ [favoriteCell setImage:[NSImage imageNamed:SPDatabaseImage]];
NSColor *bgColor = nil;
NSNumber *colorIndexObj = [[[node representedObject] nodeFavorite] objectForKey:SPFavoriteColorIndexKey];
if(colorIndexObj != nil) {
bgColor = [[SPFavoriteColorSupport sharedInstance] colorForIndex:[colorIndexObj integerValue]];
}
- [(SPFavoriteTextFieldCell *)cell setLabelColor:bgColor];
+ [favoriteCell setLabelColor:bgColor];
}
}
diff --git a/Source/SPFavoriteTextFieldCell.m b/Source/SPFavoriteTextFieldCell.m
index cf9f6a05..5eb6c103 100644
--- a/Source/SPFavoriteTextFieldCell.m
+++ b/Source/SPFavoriteTextFieldCell.m
@@ -49,7 +49,7 @@ extern BOOL isOSAtLeast10_10_0(void);
SPFavoriteTextFieldCell *cell = (SPFavoriteTextFieldCell *)[super copyWithZone:zone];
cell->drawsDividerUnderCell = drawsDividerUnderCell;
- cell->labelColor = nil; //TODO copying the color sometimes causes a drawing bug
+ cell->labelColor = [labelColor copyWithZone:zone];
return cell;
}