adium 2772:d17d8a241b66: Behave like finder in our outline views...
commits at adium.im
commits at adium.im
Sat Oct 24 18:39:06 UTC 2009
details: http://hg.adium.im/adium/rev/d17d8a241b66
revision: 2772:d17d8a241b66
author: Zachary West <zacw at adium.im>
date: Sat Oct 24 14:38:12 2009 -0400
Behave like finder in our outline views: when pressing the left arrow on a child that isn't expanded, select its parent.
diffs (29 lines):
diff -r 7e41d8e52be8 -r d17d8a241b66 Frameworks/AIUtilities Framework/Source/AIOutlineView.m
--- a/Frameworks/AIUtilities Framework/Source/AIOutlineView.m Sat Oct 24 12:13:13 2009 -0400
+++ b/Frameworks/AIUtilities Framework/Source/AIOutlineView.m Sat Oct 24 14:38:12 2009 -0400
@@ -93,13 +93,22 @@
}
} else if (pressedChar == NSLeftArrowFunctionKey) { //left
- NSEnumerator *enumerator = [[self arrayOfSelectedItems] objectEnumerator];
- id object;
- while ((object = [enumerator nextObject])) {
+ NSArray *selectedItems = [self arrayOfSelectedItems];
+
+ BOOL anyCollapsable = NO;
+ for (id object in selectedItems) {
if ([self isExpandable:object] && [self isItemExpanded:object]) {
+ anyCollapsable = YES;
[self collapseItem:object];
}
}
+
+ if (!anyCollapsable && selectedItems.count == 1) {
+ id parentObject = [self parentForItem:[selectedItems objectAtIndex:0]];
+
+ if (parentObject)
+ [self selectItemsInArray:[NSArray arrayWithObject:parentObject]];
+ }
} else if (pressedChar == NSRightArrowFunctionKey) { //right
NSEnumerator *enumerator = [[self arrayOfSelectedItems] objectEnumerator];
More information about the commits
mailing list