Added double click action to select the group of the currently selected entry.

This feature is mainly aimed to ease navigation when browsing search results
This commit is contained in:
Michael Starke
2019-08-14 12:08:18 +02:00
parent c523ba716f
commit 2d3e81a5c1
3 changed files with 32 additions and 2 deletions

View File

@@ -143,6 +143,22 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
}
}
- (void)selectGroup:(KPKGroup *)group {
NSMutableArray *parents = [[NSMutableArray alloc] init];
NSUUID *groupUUID = group.uuid;
while(group.parent) {
[parents insertObject:group.parent atIndex:0];
group = group.parent;
}
NSTreeNode *node = [self.outlineView itemAtRow:0];
for(KPKGroup *group in parents) {
NSUInteger row = [self _rowForUUID:group.uuid node:node];
[self.outlineView expandItem:[self.outlineView itemAtRow:row]];
}
NSUInteger rowToSelect = [self _rowForUUID:groupUUID node:node];
[self.outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:rowToSelect] byExtendingSelection:NO];
}
- (void)_expandItems:(NSTreeNode *)node {
id nodeItem = node.representedObject;
if([nodeItem isKindOfClass:KPKTree.class]) {