mirror of
https://github.com/transmission/transmission
synced 2024-12-24 08:43:27 +00:00
fix #233 (move menu item applies to all items)
This commit is contained in:
parent
6011450518
commit
f36d558ad4
4 changed files with 24 additions and 29 deletions
|
@ -144,7 +144,7 @@
|
|||
- (void) removeDeleteDataAndTorrent: (id) sender;
|
||||
|
||||
- (void) moveDataFiles: (id) sender;
|
||||
- (void) moveDataFileForTorrents: (NSMutableArray *) torrents;
|
||||
- (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSArray *) torrents;
|
||||
|
||||
- (void) copyTorrentFiles: (id) sender;
|
||||
- (void) copyTorrentFileForTorrents: (NSMutableArray *) torrents;
|
||||
|
|
|
@ -1183,43 +1183,38 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
- (void) moveDataFiles: (id) sender
|
||||
{
|
||||
[self moveDataFileForTorrents: [[NSMutableArray alloc] initWithArray:
|
||||
[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]]]];
|
||||
}
|
||||
|
||||
- (void) moveDataFileForTorrents: (NSMutableArray *) torrents
|
||||
{
|
||||
if ([torrents count] <= 0)
|
||||
{
|
||||
[torrents release];
|
||||
return;
|
||||
}
|
||||
|
||||
Torrent * torrent = [torrents objectAtIndex: 0];
|
||||
|
||||
NSOpenPanel * panel = [NSOpenPanel openPanel];
|
||||
|
||||
[panel setPrompt: NSLocalizedString(@"Select", "Move torrent -> prompt")];
|
||||
[panel setAllowsMultipleSelection: NO];
|
||||
[panel setCanChooseFiles: NO];
|
||||
[panel setCanChooseDirectories: YES];
|
||||
[panel setCanCreateDirectories: YES];
|
||||
|
||||
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\"",
|
||||
"Move torrent -> select destination folder"), [torrent name]]];
|
||||
|
||||
NSArray * torrents = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] retain];
|
||||
int count = [torrents count];
|
||||
if (count == 1)
|
||||
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\".",
|
||||
"Move torrent -> select destination folder"), [[torrents objectAtIndex: 0] name]]];
|
||||
else
|
||||
[panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for %d data files.",
|
||||
"Move torrent -> select destination folder"), count]];
|
||||
|
||||
[panel beginSheetForDirectory: nil file: [torrent name] modalForWindow: fWindow modalDelegate: self
|
||||
[panel beginSheetForDirectory: nil file: nil modalForWindow: fWindow modalDelegate: self
|
||||
didEndSelector: @selector(moveDataFileChoiceClosed:returnCode:contextInfo:) contextInfo: torrents];
|
||||
}
|
||||
|
||||
- (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSMutableArray *) torrents
|
||||
- (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSArray *) torrents
|
||||
{
|
||||
//move torrent data file to new location
|
||||
if (code == NSOKButton)
|
||||
[[torrents objectAtIndex: 0] moveTorrentDataFileTo: [[panel filenames] objectAtIndex: 0]];
|
||||
{
|
||||
//move torrent data file to new location
|
||||
NSEnumerator * enumerator = [torrents objectEnumerator];
|
||||
Torrent * torrent;
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
[torrent moveTorrentDataFileTo: [[panel filenames] objectAtIndex: 0]];
|
||||
}
|
||||
|
||||
[torrents removeObjectAtIndex: 0];
|
||||
[self performSelectorOnMainThread: @selector(moveDataFileForTorrents:) withObject: torrents waitUntilDone: NO];
|
||||
[torrents release];
|
||||
}
|
||||
|
||||
- (void) copyTorrentFiles: (id) sender
|
||||
|
|
|
@ -887,7 +887,7 @@
|
|||
{
|
||||
NSString * identifier = [tableColumn identifier];
|
||||
if ([identifier isEqualToString: @"Check"])
|
||||
{
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: 0];
|
||||
[torrent setFileCheckState: [object intValue] != NSOffState ? NSOnState : NSOffState
|
||||
forIndexes: [item objectForKey: @"Indexes"]];
|
||||
|
|
|
@ -797,11 +797,11 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
|
|||
{
|
||||
NSAlert * alert = [[NSAlert alloc] init];
|
||||
[alert setMessageText: NSLocalizedString(@"A folder cannot be moved to inside itself.",
|
||||
"Move inside iteself alert -> title")];
|
||||
"Move inside itself alert -> title")];
|
||||
[alert setInformativeText: [NSString stringWithFormat:
|
||||
NSLocalizedString(@"The move operation of \"%@\" cannot be done.",
|
||||
"Move inside iteself alert -> message"), [self name]]];
|
||||
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Move inside iteself alert -> button")];
|
||||
"Move inside itself alert -> message"), [self name]]];
|
||||
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Move inside itself alert -> button")];
|
||||
|
||||
[alert runModal];
|
||||
[alert release];
|
||||
|
|
Loading…
Reference in a new issue