Changeset 2198


Ignore:
Timestamp:
Jun 25, 2007, 10:26:33 PM (14 years ago)
Author:
livings124
Message:

fix #233 (move menu item applies to all items)

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r2169 r2198  
    145145
    146146- (void) moveDataFiles: (id) sender;
    147 - (void) moveDataFileForTorrents: (NSMutableArray *) torrents;
     147- (void) moveDataFileChoiceClosed: (NSOpenPanel *) panel returnCode: (int) code contextInfo: (NSArray *) torrents;
    148148
    149149- (void) copyTorrentFiles: (id) sender;
  • trunk/macosx/Controller.m

    r2188 r2198  
    11841184- (void) moveDataFiles: (id) sender
    11851185{
    1186     [self moveDataFileForTorrents: [[NSMutableArray alloc] initWithArray:
    1187             [fDisplayedTorrents objectsAtIndexes: [fTableView selectedRowIndexes]]]];
    1188 }
    1189 
    1190 - (void) moveDataFileForTorrents: (NSMutableArray *) torrents
    1191 {
    1192     if ([torrents count] <= 0)
    1193     {
    1194         [torrents release];
    1195         return;
    1196     }
    1197 
    1198     Torrent * torrent = [torrents objectAtIndex: 0];
    1199 
    12001186    NSOpenPanel * panel = [NSOpenPanel openPanel];
    1201    
    12021187    [panel setPrompt: NSLocalizedString(@"Select", "Move torrent -> prompt")];
    12031188    [panel setAllowsMultipleSelection: NO];
     
    12051190    [panel setCanChooseDirectories: YES];
    12061191    [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
    12121203        didEndSelector: @selector(moveDataFileChoiceClosed:returnCode:contextInfo:) contextInfo: torrents];
    12131204}
    12141205
    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{
    12181208    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];
    12231218}
    12241219
  • trunk/macosx/InfoWindowController.m

    r2194 r2198  
    888888    NSString * identifier = [tableColumn identifier];
    889889    if ([identifier isEqualToString: @"Check"])
    890     { 
     890    {
    891891        Torrent * torrent = [fTorrents objectAtIndex: 0];
    892892        [torrent setFileCheckState: [object intValue] != NSOffState ? NSOnState : NSOffState
  • trunk/macosx/Torrent.m

    r2196 r2198  
    798798            NSAlert * alert = [[NSAlert alloc] init];
    799799            [alert setMessageText: NSLocalizedString(@"A folder cannot be moved to inside itself.",
    800                                                         "Move inside iteself alert -> title")];
     800                                                        "Move inside itself alert -> title")];
    801801            [alert setInformativeText: [NSString stringWithFormat:
    802802                            NSLocalizedString(@"The move operation of \"%@\" cannot be done.",
    803                                                 "Move inside iteself alert -> message"), [self name]]];
    804             [alert addButtonWithTitle: NSLocalizedString(@"OK", "Move inside iteself alert -> button")];
     803                                                "Move inside itself alert -> message"), [self name]]];
     804            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Move inside itself alert -> button")];
    805805           
    806806            [alert runModal];
Note: See TracChangeset for help on using the changeset viewer.