adium 2161:a81bcb7482ed: Fix expanding/collapsing a group by its...

commits at adium.im commits at adium.im
Tue May 12 17:55:49 UTC 2009


details:	http://hg.adium.im/adium/rev/a81bcb7482ed
revision:	2161:a81bcb7482ed
author:		Zachary West <zacw at adium.im>
date:		Tue May 12 13:50:07 2009 -0400

Fix expanding/collapsing a group by its default action (when hitting <return> on it).
Subject: adium 2162:0d2f143f88c5: Fix the context-menu expansion of meta contacts ("Expand/Collapse Combined Contact").

details:	http://hg.adium.im/adium/rev/0d2f143f88c5
revision:	2162:0d2f143f88c5
author:		Zachary West <zacw at adium.im>
date:		Tue May 12 13:55:31 2009 -0400

Fix the context-menu expansion of meta contacts ("Expand/Collapse Combined Contact").

diffstat:

 Frameworks/Adium Framework/Source/AIAbstractListController.m |  30 ++++++++++-----
 Source/AIListWindowController.m                              |  12 +++--
 2 files changed, 27 insertions(+), 15 deletions(-)

diffs (69 lines):

diff -r 9362bd2e35e6 -r 0d2f143f88c5 Frameworks/Adium Framework/Source/AIAbstractListController.m
--- a/Frameworks/Adium Framework/Source/AIAbstractListController.m	Tue May 12 10:43:16 2009 -0400
+++ b/Frameworks/Adium Framework/Source/AIAbstractListController.m	Tue May 12 13:55:31 2009 -0400
@@ -267,23 +267,33 @@
 
 - (void)performExpandItem:(NSNotification *)notification
 {
-	id item = [notification object];
-	if ([contactListView rowForItem:item] != -1) {
+	AIListObject *listObject = [notification object];
+	
+	NSAssert([listObject conformsToProtocol:@protocol(AIContainingObject)], @"Attempted to expand a non-containing object.");
+	
+	if (!listObject.proxyObjects.count) {
+		//The item is not visible in the list, but we want it to be expanded next time that it is
+		[(id <AIContainingObject>)listObject setExpanded:YES];	
+	}
+	
+	for (AIProxyListObject *item in listObject.proxyObjects) {
 		[contactListView expandItem:item];
-	} else {
-		//The item is not visible in the list, but we want it to be expanded next time that it is
-		[item setExpanded:YES];	
 	}
 }
 
 - (void)performCollapseItem:(NSNotification *)notification
 {
-	id item = [notification object];
-	if ([contactListView rowForItem:item] != -1) {
+	AIListObject *listObject = [notification object];
+
+	NSAssert([listObject conformsToProtocol:@protocol(AIContainingObject)], @"Attempted to collapse a non-containing object.");
+	
+	if (!listObject.proxyObjects.count) {
+		//The item is not visible in the list, but we want it to be collapsed next time that it is
+		[(id <AIContainingObject>)listObject setExpanded:NO];	
+	}
+		
+	for (AIProxyListObject *item in listObject.proxyObjects) {
 		[contactListView collapseItem:item];
-	} else {
-		//The item is not visible in the list, but we want it to be collapsed next time that it is
-		[item setExpanded:NO];	
 	}
 }
 
diff -r 9362bd2e35e6 -r 0d2f143f88c5 Source/AIListWindowController.m
--- a/Source/AIListWindowController.m	Tue May 12 10:43:16 2009 -0400
+++ b/Source/AIListWindowController.m	Tue May 12 13:55:31 2009 -0400
@@ -510,11 +510,13 @@
 {	
     if ([selectedObject isKindOfClass:[AIListGroup class]]) {
         //Expand or collapse the group
-        if ([sender isItemExpanded:selectedObject]) {
-            [sender collapseItem:selectedObject];
-        } else {
-            [sender expandItem:selectedObject];
-        }
+		for (AIProxyListObject *proxyObject in selectedObject.proxyObjects) {
+			if ([sender isItemExpanded:proxyObject]) {
+				[sender collapseItem:proxyObject];
+			} else {
+				[sender expandItem:proxyObject];					
+			}
+		}
 
 	} else if ([selectedObject isMemberOfClass:[AIListBookmark class]]) {
 		//Hide any tooltip the contactListController is currently showing




More information about the commits mailing list