From 32b7c4df28e2eb3a4a8bcb71b3faae4f173f016c Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sat, 5 Mar 2011 00:14:43 +0000 Subject: Add support for auto saving expanded items. --- Source/SPConnectionController.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Source/SPConnectionController.m') diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 8424b427..49dcb542 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -167,9 +167,14 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v // Register double click action for the favorites outline view (double click favorite to connect) [favoritesOutlineView setTarget:self]; [favoritesOutlineView setDoubleAction:@selector(nodeDoubleClicked:)]; + + // Register drag types for the favorites outline view [favoritesOutlineView registerForDraggedTypes:[NSArray arrayWithObject:SPFavoritesPasteboardDragType]]; [favoritesOutlineView setDraggingSourceOperationMask:NSDragOperationMove forLocal:YES]; + // Preserve expanded group nodes + [favoritesOutlineView setAutosaveExpandedItems:YES]; + // Registered to be notified of changes to connection information [self addObserver:self forKeyPath:SPFavoriteNameKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; [self addObserver:self forKeyPath:SPFavoriteHostKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL]; @@ -1283,7 +1288,7 @@ static NSComparisonResult compareFavoritesUsingKey(id favorite1, id favorite2, v - (void)_reloadFavoritesViewData { [favoritesOutlineView reloadData]; - [favoritesOutlineView expandItem:[[favoritesRoot childNodes] objectAtIndex:0] expandChildren:YES]; + [favoritesOutlineView expandItem:[[favoritesRoot childNodes] objectAtIndex:0] expandChildren:NO]; [favoritesOutlineView scrollRowToVisible:[favoritesOutlineView selectedRow]]; } -- cgit v1.2.3