Changeset 2198 for trunk/macosx/Controller.m
- Timestamp:
- Jun 25, 2007, 10:26:33 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/macosx/Controller.m
r2188 r2198 1184 1184 - (void) moveDataFiles: (id) sender 1185 1185 { 1186 [self moveDataFileForTorrents: [[NSMutableArray alloc] initWithArray:1187 [fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]]]];1188 }1189 1190 - (void) moveDataFileForTorrents: (NSMutableArray *) torrents1191 {1192 if ([torrents count] <= 0)1193 {1194 [torrents release];1195 return;1196 }1197 1198 Torrent * torrent = [torrents objectAtIndex: 0];1199 1200 1186 NSOpenPanel * panel = [NSOpenPanel openPanel]; 1201 1202 1187 [panel setPrompt: NSLocalizedString(@"Select", "Move torrent -> prompt")]; 1203 1188 [panel setAllowsMultipleSelection: NO]; … … 1205 1190 [panel setCanChooseDirectories: YES]; 1206 1191 [panel setCanCreateDirectories: YES]; 1207 1208 [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\"", 1209 "Move torrent -> select destination folder"), [torrent name]]]; 1210 1211 [panel beginSheetForDirectory: nil file: [torrent name] modalForWindow: fWindow modalDelegate: self 1192 1193 NSArray * torrents = [[fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]] retain]; 1194 int count = [torrents count]; 1195 if (count == 1) 1196 [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\".", 1197 "Move torrent -> select destination folder"), [[torrents objectAtIndex: 0] name]]]; 1198 else 1199 [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for %d data files.", 1200 "Move torrent -> select destination folder"), count]]; 1201 1202 [panel beginSheetForDirectory: nil file: nil modalForWindow: fWindow modalDelegate: self 1212 1203 didEndSelector: @selector(moveDataFileChoiceClosed:returnCode:contextInfo:) contextInfo: torrents]; 1213 1204 } 1214 1205 1215 - (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSMutableArray *) torrents 1216 { 1217 //move torrent data file to new location 1206 - (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSArray *) torrents 1207 { 1218 1208 if (code == NSOKButton) 1219 [[torrents objectAtIndex: 0] moveTorrentDataFileTo: [[panel filenames] objectAtIndex: 0]]; 1220 1221 [torrents removeObjectAtIndex: 0]; 1222 [self performSelectorOnMainThread: @selector(moveDataFileForTorrents:) withObject: torrents waitUntilDone: NO]; 1209 { 1210 //move torrent data file to new location 1211 NSEnumerator * enumerator = [torrents objectEnumerator]; 1212 Torrent * torrent; 1213 while ((torrent = [enumerator nextObject])) 1214 [torrent moveTorrentDataFileTo: [[panel filenames] objectAtIndex: 0]]; 1215 } 1216 1217 [torrents release]; 1223 1218 } 1224 1219
Note: See TracChangeset
for help on using the changeset viewer.