Changeset 522


Ignore:
Timestamp:
Jul 4, 2006, 7:37:12 PM (16 years ago)
Author:
livings124
Message:

Change code for remove dialog a bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r521 r522  
    529529                    downloading++;
    530530            }
    531     }
    532 
    533     if ([fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0)
    534     {
    535         NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
    536             torrents, @"Torrents",
    537             [NSNumber numberWithBool: deleteData], @"DeleteData",
    538             [NSNumber numberWithBool: deleteTorrent], @"DeleteTorrent", nil];
    539 
    540         NSString * title, * message;
    541        
    542         int selected = [fTableView numberOfSelectedRows];
    543         if (selected == 1)
     531
     532        if ([fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0)
    544533        {
    545             title = [NSString stringWithFormat: @"Comfirm Removal of \"%@\"",
    546                         [[fTorrents objectAtIndex: [fTableView selectedRow]] name]];
    547             message = @"This transfer is active."
    548                         " Once removed, continuing the transfer will require the torrent file."
    549                         " Do you really want to remove it?";
     534            NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
     535                torrents, @"Torrents",
     536                [NSNumber numberWithBool: deleteData], @"DeleteData",
     537                [NSNumber numberWithBool: deleteTorrent], @"DeleteTorrent", nil];
     538
     539            NSString * title, * message;
     540           
     541            int selected = [fTableView numberOfSelectedRows];
     542            if (selected == 1)
     543            {
     544                title = [NSString stringWithFormat: @"Comfirm Removal of \"%@\"",
     545                            [[fTorrents objectAtIndex: [fTableView selectedRow]] name]];
     546                message = @"This transfer is active."
     547                            " Once removed, continuing the transfer will require the torrent file."
     548                            " Do you really want to remove it?";
     549            }
     550            else
     551            {
     552                title = [NSString stringWithFormat: @"Comfirm Removal of %d Transfers", selected];
     553                if (selected == active)
     554                    message = [NSString stringWithFormat:
     555                        @"There are %d active transfers.", active];
     556                else
     557                    message = [NSString stringWithFormat:
     558                        @"There are %d transfers (%d active).", selected, active];
     559                message = [message stringByAppendingString:
     560                    @" Once removed, continuing the transfers will require the torrent files."
     561                    " Do you really want to remove them?"];
     562            }
     563
     564            NSBeginAlertSheet(title, @"Remove", @"Cancel", nil, fWindow, self,
     565                @selector(removeSheetDidEnd:returnCode:contextInfo:), nil, dict, message);
     566            return;
    550567        }
    551         else
    552         {
    553             title = [NSString stringWithFormat: @"Comfirm Removal of %d Transfers", selected];
    554             if (selected == active)
    555                 message = [NSString stringWithFormat:
    556                     @"There are %d active transfers.", active];
    557             else
    558                 message = [NSString stringWithFormat:
    559                     @"There are %d transfers (%d active).", selected, active];
    560             message = [message stringByAppendingString:
    561                 @" Once removed, continuing the transfers will require the torrent files."
    562                 " Do you really want to remove them?"];
    563         }
    564 
    565         NSBeginAlertSheet(title, @"Remove", @"Cancel", nil, fWindow, self,
    566             @selector(removeSheetDidEnd:returnCode:contextInfo:), nil, dict, message);
    567     }
    568     else
    569         [self confirmRemove: torrents deleteData: deleteData deleteTorrent: deleteTorrent];
    570 }
    571 
    572 - (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode
    573                         contextInfo: (NSDictionary *) dict
     568    }
     569   
     570    [self confirmRemove: torrents deleteData: deleteData deleteTorrent: deleteTorrent];
     571}
     572
     573- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode contextInfo: (NSDictionary *) dict
    574574{
    575575    [NSApp stopModal];
     
    586586}
    587587
    588 - (void) confirmRemove: (NSArray *) torrents
    589         deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent
     588- (void) confirmRemove: (NSArray *) torrents deleteData: (BOOL) deleteData deleteTorrent: (BOOL) deleteTorrent
    590589{
    591590    //don't want any of these starting then stopping
Note: See TracChangeset for help on using the changeset viewer.