Subversion Repositories TruePreview

[/] [trunk/] [Source/] [TruePreviewPreferencesModule.m] - Diff between revs 17 and 23

Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | View Log

Rev 17 Rev 23
Line 50... Line 50...
 
 
  while (theDisplayName = [theEnum nextObject]) {
  while (theDisplayName = [theEnum nextObject]) {
    NSMutableDictionary* theAccount = [NSMutableDictionary dictionaryWithObjectsAndKeys:
    NSMutableDictionary* theAccount = [NSMutableDictionary dictionaryWithObjectsAndKeys:
      theDisplayName, @"displayName",
      theDisplayName, @"displayName",
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"delay",
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"delay",
 
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"reply",
 
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"forward",
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"window",
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"window",
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"scroll",
      [NSNumber numberWithInt:TRUEPREVIEW_DELAY_DEFAULT], @"scroll",
      nil
      nil
    ];
    ];
   
   
Line 64... Line 66...
  // watch the array for changes to save the user defaults
  // watch the array for changes to save the user defaults
  [theAccounts
  [theAccounts
    addObserver:self
    addObserver:self
    toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
    toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
    forKeyPath:@"delay"
    forKeyPath:@"delay"
 
    options:0
 
    context:theAccounts
 
  ];
 
  [theAccounts
 
    addObserver:self
 
    toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
 
    forKeyPath:@"reply"
 
    options:0
 
    context:theAccounts
 
  ];
 
  [theAccounts
 
    addObserver:self
 
    toObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [theAccounts count])]
 
    forKeyPath:@"forward"
    options:0
    options:0
    context:theAccounts
    context:theAccounts
  ];
  ];
  [theAccounts
  [theAccounts
    addObserver:self
    addObserver:self
Line 92... Line 108...
- (void)observeValueForKeyPath:(NSString*)inPath
- (void)observeValueForKeyPath:(NSString*)inPath
    ofObject:(id)inObject
    ofObject:(id)inObject
    change:(NSDictionary*)inChange
    change:(NSDictionary*)inChange
    context:(void*)inContext {
    context:(void*)inContext {
  NSMutableDictionary* theAccountDict = [NSMutableDictionary dictionary];
  NSMutableDictionary* theAccountDict = [NSMutableDictionary dictionary];
  NSEnumerator* theAccountEnum = [(NSArray*)inContext objectEnumerator];
 
  NSDictionary* theAccount = nil;
 
 
 
  // build the account settings dictionary to save in the user defaults
  // build the account settings dictionary to save in the user defaults
  while (theAccount = [theAccountEnum nextObject]) {
  for (NSDictionary* theAccount in (NSArray*)inContext) {
    [theAccountDict setObject:theAccount forKey:[theAccount objectForKey:@"displayName"]];
    [theAccountDict setObject:theAccount forKey:[theAccount objectForKey:@"displayName"]];
  }
  }
 
 
  [[NSUserDefaults standardUserDefaults] setObject:theAccountDict forKey:@"TruePreviewAccountSettings"];
  [[NSUserDefaults standardUserDefaults] setObject:theAccountDict forKey:@"TruePreviewAccountSettings"];
  [[NSUserDefaults standardUserDefaults] synchronize];
  [[NSUserDefaults standardUserDefaults] synchronize];