From c47c24e3ca96b3ee125e05f9e819771e237f9de6 Mon Sep 17 00:00:00 2001 From: michael starke Date: Fri, 26 Feb 2016 14:38:16 +0100 Subject: [PATCH] fixed wrong target groups, consolidated node resolving --- MacPass/MPOutlineViewController.m | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/MacPass/MPOutlineViewController.m b/MacPass/MPOutlineViewController.m index 69ae59f9..f77125c2 100644 --- a/MacPass/MPOutlineViewController.m +++ b/MacPass/MPOutlineViewController.m @@ -135,10 +135,10 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; #pragma mark MPTargetNodeResolving - (NSArray *)currentTargetGroups { - // NSInteger row = self.outlineView.clickedRow; -// if( row > -1 ) { -// return @[ [[self.outlineView itemAtRow:row] representedObject] ]; -// } + /* there are instances where we get the KPKTree tree as selection, so filter this out! */ + if([self.treeController.selectedObjects.firstObject isKindOfClass:[KPKTree class]] ) { + return @[]; + } return self.treeController.selectedObjects; } @@ -167,8 +167,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; return; // Nothing we need to worry about } MPDocument *document = [[self windowController] document]; - document.selectedGroups = self.treeController.selectedObjects; - //document.selectedItem = document.selectedGroup; + document.selectedGroups = [self currentTargetGroups]; } # pragma mark MPDocument Notifications @@ -233,12 +232,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell"; - (void)outlineViewSelectionDidChange:(NSNotification *)notification { MPDocument *document = self.windowController.document; - if(![self.treeController.selectedObjects.firstObject isKindOfClass:[KPKTree class]]) { - document.selectedGroups = self.treeController.selectedObjects; - } - else { - document.selectedGroups = nil; - } + document.selectedGroups = [self currentTargetGroups]; } - (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item {