Initial support for creating a torrent copy (to recover torrent files after being placed in Support folder, basically). Next commit will refine it a bit.

This commit is contained in:
Mitchell Livingston 2006-06-10 23:06:30 +00:00
parent ae8e73fe72
commit a668c237a1
5 changed files with 33 additions and 4 deletions

View File

@ -99,12 +99,13 @@
- (void) removeTorrentDeleteData: (id) sender;
- (void) removeTorrentWithIndex: (NSIndexSet *) indexSet
deleteData: (BOOL) deleteData;
- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode
contextInfo: (NSDictionary *) dict;
- (void) confirmRemoveTorrents: (NSArray *) torrents
deleteData: (BOOL) deleteData;
- (void) copyTorrentFile: (id) sender;
- (void) revealFile: (id) sender;
- (void) showPreferenceWindow: (id) sender;

View File

@ -630,6 +630,32 @@ static void sleepCallBack( void * controller, io_service_t y,
[self removeTorrentWithIndex: [fTableView selectedRowIndexes] deleteData: YES];
}
- (void) copyTorrentFile: (id) sender
{
Torrent * torrent;
NSEnumerator * enumerator = [[self torrentsAtIndexes:
[fTableView selectedRowIndexes]] objectEnumerator];
while ((torrent = [enumerator nextObject]))
{
//warn user if torrent file can't be found
if (![[NSFileManager defaultManager] fileExistsAtPath: [torrent torrentLocation]])
{
#warning warn user of failure
continue;
}
//ask for copy location and name (save)
NSSavePanel * savePanel = [NSSavePanel savePanel];
[savePanel setRequiredFileType: @"torrent"];
[savePanel setCanSelectHiddenExtension: YES];
if ([savePanel runModalForDirectory: nil file: [torrent name]] == NSOKButton)
[[NSFileManager defaultManager] copyPath: [torrent torrentLocation]
toPath: [savePanel filename] handler: nil];
}
}
- (void) revealFile: (id) sender
{
Torrent * torrent;
@ -1142,7 +1168,7 @@ static void sleepCallBack( void * controller, io_service_t y,
//only enable some items if it is in a context menu or the window is useable
BOOL canUseMenu = [[[menuItem menu] title] isEqualToString: @"Context"]
|| ([fWindow isKeyWindow] && ![fToolbar customizationPaletteIsRunning]);
|| [fWindow isKeyWindow];
//enable show info
if (action == @selector(showInfo:))

View File

@ -4,6 +4,7 @@
ACTIONS = {
advancedChanged = id;
checkUpdate = id;
copyTorrentFile = id;
growlRegister = id;
linkForums = id;
linkHomepage = id;

View File

@ -11,9 +11,9 @@
<key>1480</key>
<string>423 269 420 60 0 0 1152 842 </string>
<key>29</key>
<string>195 519 451 44 0 0 1152 842 </string>
<string>189 691 451 44 0 0 1152 842 </string>
<key>456</key>
<string>212 488 153 168 0 0 1152 842 </string>
<string>252 356 167 199 0 0 1152 842 </string>
<key>581</key>
<string>324 628 112 68 0 0 1152 842 </string>
<key>589</key>
@ -29,6 +29,7 @@
<integer>3</integer>
<key>IBOpenObjects</key>
<array>
<integer>29</integer>
<integer>21</integer>
</array>
<key>IBSystem Version</key>

Binary file not shown.