Option to save log.

This commit is contained in:
Mitchell Livingston 2006-08-22 23:00:53 +00:00
parent 7b6577ea1e
commit 68a9a6ba85
6 changed files with 29 additions and 10 deletions

View File

@ -93,6 +93,7 @@
A2305AAC0A3DCCEF00AB2D77 /* ProgressBarEndGreen.png in Resources */ = {isa = PBXBuildFile; fileRef = A2305AA70A3DCCEF00AB2D77 /* ProgressBarEndGreen.png */; };
A2305AAD0A3DCCEF00AB2D77 /* ProgressBarEndGray.png in Resources */ = {isa = PBXBuildFile; fileRef = A2305AA80A3DCCEF00AB2D77 /* ProgressBarEndGray.png */; };
A232D29E0A70903E00973B12 /* Filter.png in Resources */ = {isa = PBXBuildFile; fileRef = A232D29D0A70903E00973B12 /* Filter.png */; };
A23BBEB70A9BBE77003F7274 /* BarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A27431D90A68538400FA780A /* BarButton.m */; };
A246004D0A6DCE4600D19088 /* SpeedLimitButtonPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004C0A6DCE4600D19088 /* SpeedLimitButtonPressed.png */; };
A24600510A6DCE6600D19088 /* SpeedLimitButtonBlue.png in Resources */ = {isa = PBXBuildFile; fileRef = A246004F0A6DCE6600D19088 /* SpeedLimitButtonBlue.png */; };
A24600520A6DCE6600D19088 /* SpeedLimitButtonGraphite.png in Resources */ = {isa = PBXBuildFile; fileRef = A24600500A6DCE6600D19088 /* SpeedLimitButtonGraphite.png */; };
@ -119,7 +120,6 @@
A261F1E40A69A1B10002815A /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = A261F1DB0A69A1610002815A /* Growl.framework */; };
A26D450B0A0503AC00A10BB3 /* peermessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D1838A309DEC0430047D688 /* peermessages.h */; };
A2710E770A86796000CE4F7D /* PrefsWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A2710E750A86796000CE4F7D /* PrefsWindow.m */; };
A27431DB0A68538400FA780A /* BarButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A27431D90A68538400FA780A /* BarButton.m */; };
A27A53570A06A76400E1F16F /* StatusSep.png in Resources */ = {isa = PBXBuildFile; fileRef = A27A53560A06A76400E1F16F /* StatusSep.png */; };
A27ABC240A6ADE410020EC71 /* ImageBackgroundView.m in Sources */ = {isa = PBXBuildFile; fileRef = A27ABC220A6ADE410020EC71 /* ImageBackgroundView.m */; };
A289EB0C0A33C56D00B082A3 /* ButtonBorder.png in Resources */ = {isa = PBXBuildFile; fileRef = A289EB0B0A33C56D00B082A3 /* ButtonBorder.png */; };
@ -828,10 +828,10 @@
A21610FC0A050B1700E8E4C1 /* MenuButton.m in Sources */,
A200B9200A22798F007BBB1E /* InfoWindowController.m in Sources */,
A2AF1C390A3D0F6200F1575D /* FileTableView.m in Sources */,
A27431DB0A68538400FA780A /* BarButton.m in Sources */,
A27ABC240A6ADE410020EC71 /* ImageBackgroundView.m in Sources */,
A2710E770A86796000CE4F7D /* PrefsWindow.m in Sources */,
A256588D0A9A695400E8A03B /* MessageWindowController.m in Sources */,
A23BBEB70A9BBE77003F7274 /* BarButton.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -864,14 +864,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
[panel setRequiredFileType: @"torrent"];
[panel setCanSelectHiddenExtension: YES];
[panel beginSheetForDirectory: nil file: [torrent name]
modalForWindow: fWindow modalDelegate: self didEndSelector:
@selector(saveTorrentCopySheetClosed:returnCode:contextInfo:) contextInfo: torrents];
[panel beginSheetForDirectory: nil file: [torrent name] modalForWindow: fWindow modalDelegate: self
didEndSelector: @selector(saveTorrentCopySheetClosed:returnCode:contextInfo:) contextInfo: torrents];
}
}
- (void) saveTorrentCopySheetClosed: (NSSavePanel *) panel returnCode: (int) code
contextInfo: (NSMutableArray *) torrents
- (void) saveTorrentCopySheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (NSMutableArray *) torrents
{
//if save successful, copy torrent to new location with name of data file
if (code == NSOKButton)
@ -879,8 +877,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
toPath: [panel filename] handler: nil];
[torrents removeObjectAtIndex: 0];
[self performSelectorOnMainThread: @selector(copyTorrentFileForTorrents:)
withObject: torrents waitUntilDone: NO];
[self performSelectorOnMainThread: @selector(copyTorrentFileForTorrents:) withObject: torrents waitUntilDone: NO];
}
- (void) revealFile: (id) sender

View File

@ -2,7 +2,7 @@
IBClasses = (
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {changeLevel = id; clearLog = id; };
ACTIONS = {changeLevel = id; clearLog = id; writeToFile = id; };
CLASS = MessageWindowController;
LANGUAGE = ObjC;
OUTLETS = {

View File

@ -40,4 +40,6 @@
- (void) changeLevel: (id) sender;
- (void) clearLog: (id) sender;
- (void) writeToFile: (id) sender;
@end

View File

@ -145,4 +145,24 @@
[fTextView setString: @""];
}
- (void) writeToFile: (id) sender
{
NSString * string = [[fTextView string] retain];
NSSavePanel * panel = [NSSavePanel savePanel];
[panel setRequiredFileType: @"txt"];
[panel setCanSelectHiddenExtension: YES];
[panel beginSheetForDirectory: nil file: @"untitled" modalForWindow: [self window] modalDelegate: self
didEndSelector: @selector(writeToFileSheetClosed:returnCode:contextInfo:) contextInfo: string];
}
- (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (NSString *) string
{
if (code == NSOKButton)
[string writeToFile: [panel filename] atomically: YES encoding: NSUTF8StringEncoding error: nil];
[string release];
}
@end