Changeset 9790


Ignore:
Timestamp:
Dec 16, 2009, 3:19:09 AM (12 years ago)
Author:
livings124
Message:

#2680 "Group Name" cleared after choosing "Custom location"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/GroupsPrefsController.m

    r9320 r9790  
    3636
    3737- (void) updateSelectedGroup;
     38- (void) refreshCustomLocation;
    3839
    3940@end
     
    217218        [[GroupsController groups] setCustomDownloadLocation: path forIndex: index];
    218219        [[GroupsController groups] setUsesCustomDownloadLocation: YES forIndex: index];
    219         [self updateSelectedGroup]; //update the popup's icon/title
    220220    }
    221221    else
    222222    {
    223223        if (![[GroupsController groups] customDownloadLocationForIndex: index])
    224         {
    225224            [[GroupsController groups] setUsesCustomDownloadLocation: NO forIndex: index];
    226             [fCustomLocationEnableCheck setState: NSOffState];
    227             [fCustomLocationPopUp setEnabled: NO];
    228         }
    229     }
    230 
     225    }
     226   
     227    [self refreshCustomLocation];
     228   
    231229    [fCustomLocationPopUp selectItemAtIndex: 0];
    232230}
     
    315313    if ([fTableView numberOfSelectedRows] == 1)
    316314    {
    317         NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
     315        const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
    318316        [fSelectedColorView setColor: [[GroupsController groups] colorForIndex: index]];
    319317        [fSelectedColorView setEnabled: YES];
    320318        [fSelectedColorNameField setStringValue: [[GroupsController groups] nameForIndex: index]];
    321319        [fSelectedColorNameField setEnabled: YES];
    322         [fCustomLocationEnableCheck setState: [[GroupsController groups] usesCustomDownloadLocationForIndex: index]];
    323         [fCustomLocationEnableCheck setEnabled: YES];
    324         [fCustomLocationPopUp setEnabled: [fCustomLocationEnableCheck state] == NSOnState];
    325         if ([[GroupsController groups] customDownloadLocationForIndex: index])
    326         {
    327             NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index];
    328             ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
    329             [[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]];
    330             ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
    331             [[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]];
    332         }
    333         else
    334         {
    335             [[fCustomLocationPopUp itemAtIndex: 0] setTitle: @""];
    336             [[fCustomLocationPopUp itemAtIndex: 0] setImage: nil];
    337         }
     320       
     321        [self refreshCustomLocation];
    338322
    339323        [fAutoAssignRulesEnableCheck setState: [[GroupsController groups] usesAutoAssignRulesForIndex: index]];
     
    354338}
    355339
     340- (void) refreshCustomLocation
     341{
     342    const NSInteger index = [[GroupsController groups] indexForRow: [fTableView selectedRow]];
     343   
     344    [fCustomLocationEnableCheck setState: [[GroupsController groups] usesCustomDownloadLocationForIndex: index]];
     345    [fCustomLocationEnableCheck setEnabled: YES];
     346    [fCustomLocationPopUp setEnabled: [fCustomLocationEnableCheck state] == NSOnState];
     347   
     348    if ([[GroupsController groups] customDownloadLocationForIndex: index])
     349    {
     350        NSString * location = [[GroupsController groups] customDownloadLocationForIndex: index];
     351        ExpandedPathToPathTransformer * pathTransformer = [[[ExpandedPathToPathTransformer alloc] init] autorelease];
     352        [[fCustomLocationPopUp itemAtIndex: 0] setTitle: [pathTransformer transformedValue: location]];
     353        ExpandedPathToIconTransformer * iconTransformer = [[[ExpandedPathToIconTransformer alloc] init] autorelease];
     354        [[fCustomLocationPopUp itemAtIndex: 0] setImage: [iconTransformer transformedValue: location]];
     355    }
     356    else
     357    {
     358        [[fCustomLocationPopUp itemAtIndex: 0] setTitle: @""];
     359        [[fCustomLocationPopUp itemAtIndex: 0] setImage: nil];
     360    }
     361}
     362
    356363@end
Note: See TracChangeset for help on using the changeset viewer.