mirror of
https://github.com/transmission/transmission
synced 2025-02-20 13:16:53 +00:00
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:
parent
ae8e73fe72
commit
a668c237a1
5 changed files with 33 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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:))
|
||||
|
|
1
macosx/English.lproj/MainMenu.nib/classes.nib
generated
1
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -4,6 +4,7 @@
|
|||
ACTIONS = {
|
||||
advancedChanged = id;
|
||||
checkUpdate = id;
|
||||
copyTorrentFile = id;
|
||||
growlRegister = id;
|
||||
linkForums = id;
|
||||
linkHomepage = id;
|
||||
|
|
5
macosx/English.lproj/MainMenu.nib/info.nib
generated
5
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -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>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Reference in a new issue