Changeset 9407
- Timestamp:
- Oct 25, 2009, 9:30:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/MessageWindowController.m
r9342 r9407 315 315 NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"Index" ascending: YES] autorelease]; 316 316 NSArray * descriptors = [[NSArray alloc] initWithObjects: descriptor, nil]; 317 NSArray * sortedMessages = [ fMessages sortedArrayUsingDescriptors: descriptors];317 NSArray * sortedMessages = [[fMessages sortedArrayUsingDescriptors: descriptors] retain]; 318 318 [descriptors release]; 319 320 //create the text to output321 NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [fMessages count]];322 for (NSDictionary * message in sortedMessages)323 [messageStrings addObject: [self stringForMessage: message]];324 325 NSString * fileString = [[messageStrings componentsJoinedByString: @"\n"] retain];326 319 327 320 NSSavePanel * panel = [NSSavePanel savePanel]; … … 331 324 [panel beginSheetForDirectory: nil file: NSLocalizedString(@"untitled", "Save log panel -> default file name") 332 325 modalForWindow: [self window] modalDelegate: self 333 didEndSelector: @selector(writeToFileSheetClosed:returnCode:contextInfo:) contextInfo: fileString];334 } 335 336 - (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (NS String *) string326 didEndSelector: @selector(writeToFileSheetClosed:returnCode:contextInfo:) contextInfo: sortedMessages]; 327 } 328 329 - (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (NSInteger) code contextInfo: (NSArray *) messages 337 330 { 338 331 if (code == NSOKButton) 339 332 { 340 if (![string writeToFile: [panel filename] atomically: YES encoding: NSUTF8StringEncoding error: nil]) 333 //create the text to output 334 NSMutableArray * messageStrings = [NSMutableArray arrayWithCapacity: [fMessages count]]; 335 for (NSDictionary * message in messages) 336 [messageStrings addObject: [self stringForMessage: message]]; 337 338 NSString * fileString = [messageStrings componentsJoinedByString: @"\n"]; 339 340 if (![fileString writeToFile: [panel filename] atomically: YES encoding: NSUTF8StringEncoding error: nil]) 341 341 { 342 342 NSAlert * alert = [[NSAlert alloc] init]; … … 353 353 } 354 354 355 [ stringrelease];355 [messages release]; 356 356 } 357 357
Note: See TracChangeset
for help on using the changeset viewer.