From a942125d2fa06461061807c7d869aa41758bb4ff Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Wed, 16 Dec 2009 03:19:09 +0000 Subject: [PATCH] #2680 "Group Name" cleared after choosing "Custom location" --- macosx/GroupsPrefsController.m | 53 +++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/macosx/GroupsPrefsController.m b/macosx/GroupsPrefsController.m index 7b4e91653..55f39d2e4 100644 --- a/macosx/GroupsPrefsController.m +++ b/macosx/GroupsPrefsController.m @@ -35,6 +35,7 @@ @interface GroupsPrefsController (Private) - (void) updateSelectedGroup; +- (void) refreshCustomLocation; @end @@ -216,18 +217,15 @@ NSString * path = [[openPanel filenames] objectAtIndex: 0]; [[GroupsController groups] setCustomDownloadLocation: path forIndex: index]; [[GroupsController groups] setUsesCustomDownloadLocation: YES forIndex: index]; - [self updateSelectedGroup]; //update the popup's icon/title } else { if (![[GroupsController groups] customDownloadLocationForIndex: index]) - { [[GroupsController groups] setUsesCustomDownloadLocation: NO forIndex: index]; - [fCustomLocationEnableCheck setState: NSOffState]; - [fCustomLocationPopUp setEnabled: NO]; - } } - + + [self refreshCustomLocation]; + [fCustomLocationPopUp selectItemAtIndex: 0]; } @@ -314,27 +312,13 @@ [fAddRemoveControl setEnabled: [fTableView numberOfSelectedRows] > 0 forSegment: REMOVE_TAG]; if ([fTableView numberOfSelectedRows] == 1) { - NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]]; + const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]]; [fSelectedColorView setColor: [[GroupsController groups] colorForIndex: index]]; [fSelectedColorView setEnabled: YES]; [fSelectedColorNameField setStringValue: [[GroupsController groups] nameForIndex: index]]; [fSelectedColorNameField setEnabled: YES]; - [fCustomLocationEnableCheck setState: [[GroupsController groups] usesCustomDownloadLocationForIndex: index]]; - [fCustomLocationEnableCheck setEnabled: YES]; - [fCustomLocationPopUp setEnabled: [fCustomLocationEnableCheck state] == NSOnState]; - if ([[GroupsController groups] customDownloadLocationForIndex: index]) - { - NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index]; - ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease]; - [[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]]; - ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease]; - [[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]]; - } - else - { - [[fCustomLocationPopUp itemAtIndex: 0] setTitle: @""]; - [[fCustomLocationPopUp itemAtIndex: 0] setImage: nil]; - } + + [self refreshCustomLocation]; [fAutoAssignRulesEnableCheck setState: [[GroupsController groups] usesAutoAssignRulesForIndex: index]]; [fAutoAssignRulesEnableCheck setEnabled: YES]; @@ -353,4 +337,27 @@ } } +- (void) refreshCustomLocation +{ + const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]]; + + [fCustomLocationEnableCheck setState: [[GroupsController groups] usesCustomDownloadLocationForIndex: index]]; + [fCustomLocationEnableCheck setEnabled: YES]; + [fCustomLocationPopUp setEnabled: [fCustomLocationEnableCheck state] == NSOnState]; + + if ([[GroupsController groups] customDownloadLocationForIndex: index]) + { + NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index]; + ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease]; + [[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]]; + ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease]; + [[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]]; + } + else + { + [[fCustomLocationPopUp itemAtIndex: 0] setTitle: @""]; + [[fCustomLocationPopUp itemAtIndex: 0] setImage: nil]; + } +} + @end -- 2.40.0