Changeset 13488


Ignore:
Timestamp:
Sep 9, 2012, 12:42:10 PM (9 years ago)
Author:
livings124
Message:

#4874 Deleting multiple torrents from the WebUI fails

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r13487 r13488  
    11/******************************************************************************
    22 * $Id$
    3  * 
     3 *
    44 * Copyright (c) 2005-2012 Transmission authors and contributors
    55 *
     
    139139{
    140140    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: [[NSNumber alloc] initWithBool: active], @"Active",
    141                                 [[NSNumber alloc] initWithBool: byUser], @"ByUser", nil];
     141                           [[NSNumber alloc] initWithBool: byUser], @"ByUser", nil];
    142142    [(Controller *)controller performSelectorOnMainThread: @selector(altSpeedToggledCallbackIsLimited:)
    143         withObject: dict waitUntilDone: NO];
     143                                               withObject: dict waitUntilDone: NO];
    144144}
    145145
    146146static tr_rpc_callback_status rpcCallback(tr_session * handle UNUSED, tr_rpc_callback_type type, struct tr_torrent * torrentStruct,
    147                                             void * controller)
     147                                          void * controller)
    148148{
    149149    [(Controller *)controller rpcCallback: type forTorrentStruct: torrentStruct];
     
    171171        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Transmission already running alert -> button")];
    172172        [alert setMessageText: NSLocalizedString(@"Transmission is already running.",
    173                                                 "Transmission already running alert -> title")];
     173                                                 "Transmission already running alert -> title")];
    174174        [alert setInformativeText: NSLocalizedString(@"There is already a copy of Transmission running. "
    175             "This copy cannot be opened until that instance is quit.", "Transmission already running alert -> message")];
     175                                                     "This copy cannot be opened until that instance is quit.", "Transmission already running alert -> message")];
    176176        [alert setAlertStyle: NSCriticalAlertStyle];
    177177       
     
    184184   
    185185    [[NSUserDefaults standardUserDefaults] registerDefaults: [NSDictionary dictionaryWithContentsOfFile:
    186         [[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]];
     186                                                              [[NSBundle mainBundle] pathForResource: @"Defaults" ofType: @"plist"]]];
    187187   
    188188    //set custom value transformers
     
    201201        [alert setMessageText: NSLocalizedString(@"Welcome to Transmission", "Legal alert -> title")];
    202202        [alert setInformativeText: NSLocalizedString(@"Transmission is a file-sharing program."
    203             " When you run a torrent, its data will be made available to others by means of upload."
    204             " You and you alone are fully responsible for exercising proper judgement and abiding by your local laws.",
    205             "Legal alert -> message")];
     203                                                     " When you run a torrent, its data will be made available to others by means of upload."
     204                                                     " You and you alone are fully responsible for exercising proper judgement and abiding by your local laws.",
     205                                                     "Legal alert -> message")];
    206206        [alert setAlertStyle: NSInformationalAlertStyle];
    207207       
     
    248248        tr_bencDictAddBool(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_ENABLED, [fDefaults boolForKey: @"SpeedLimitAuto"]);
    249249        tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_BEGIN, [PrefsController dateToTimeSum:
    250                                                                             [fDefaults objectForKey: @"SpeedLimitAutoOnDate"]]);
     250                                                                         [fDefaults objectForKey: @"SpeedLimitAutoOnDate"]]);
    251251        tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_END, [PrefsController dateToTimeSum:
    252                                                                             [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]]);
     252                                                                       [fDefaults objectForKey: @"SpeedLimitAutoOffDate"]]);
    253253        tr_bencDictAddInt(&settings, TR_PREFS_KEY_ALT_SPEED_TIME_DAY, [fDefaults integerForKey: @"SpeedLimitAutoDay"]);
    254254       
     
    269269        tr_bencDictAddBool(&settings, TR_PREFS_KEY_DHT_ENABLED, [fDefaults boolForKey: @"DHTGlobal"]);
    270270        tr_bencDictAddStr(&settings, TR_PREFS_KEY_DOWNLOAD_DIR, [[[fDefaults stringForKey: @"DownloadFolder"]
    271                                                                     stringByExpandingTildeInPath] UTF8String]);
     271                                                                  stringByExpandingTildeInPath] UTF8String]);
    272272        tr_bencDictAddBool(&settings, TR_PREFS_KEY_DOWNLOAD_QUEUE_ENABLED, [fDefaults boolForKey: @"Queue"]);
    273273        tr_bencDictAddInt(&settings, TR_PREFS_KEY_DOWNLOAD_QUEUE_SIZE, [fDefaults integerForKey: @"QueueDownloadNumber"]);
     
    311311       
    312312        tr_formatter_size_init(1000, [NSLocalizedString(@"KB", "File size - kilobytes") UTF8String],
    313                                         [NSLocalizedString(@"MB", "File size - megabytes") UTF8String],
    314                                         [NSLocalizedString(@"GB", "File size - gigabytes") UTF8String],
    315                                         [NSLocalizedString(@"TB", "File size - terabytes") UTF8String]);
    316 
     313                               [NSLocalizedString(@"MB", "File size - megabytes") UTF8String],
     314                               [NSLocalizedString(@"GB", "File size - gigabytes") UTF8String],
     315                               [NSLocalizedString(@"TB", "File size - terabytes") UTF8String]);
     316       
    317317        tr_formatter_speed_init(1000, [NSLocalizedString(@"KB/s", "Transfer speed (kilobytes per second)") UTF8String],
    318                                         [NSLocalizedString(@"MB/s", "Transfer speed (megabytes per second)") UTF8String],
    319                                         [NSLocalizedString(@"GB/s", "Transfer speed (gigabytes per second)") UTF8String],
    320                                         [NSLocalizedString(@"TB/s", "Transfer speed (terabytes per second)") UTF8String]); //why not?
    321 
     318                                [NSLocalizedString(@"MB/s", "Transfer speed (megabytes per second)") UTF8String],
     319                                [NSLocalizedString(@"GB/s", "Transfer speed (gigabytes per second)") UTF8String],
     320                                [NSLocalizedString(@"TB/s", "Transfer speed (terabytes per second)") UTF8String]); //why not?
     321       
    322322        tr_formatter_mem_init(1000, [NSLocalizedString(@"KB", "Memory size - kilobytes") UTF8String],
    323                                     [NSLocalizedString(@"MB", "Memory size - megabytes") UTF8String],
    324                                     [NSLocalizedString(@"GB", "Memory size - gigabytes") UTF8String],
    325                                     [NSLocalizedString(@"TB", "Memory size - terabytes") UTF8String]);
     323                              [NSLocalizedString(@"MB", "Memory size - megabytes") UTF8String],
     324                              [NSLocalizedString(@"GB", "Memory size - gigabytes") UTF8String],
     325                              [NSLocalizedString(@"TB", "Memory size - terabytes") UTF8String]);
    326326       
    327327        const char * configDir = tr_getDefaultConfigDir("Transmission");
     
    335335        //register for magnet URLs (has to be in init)
    336336        [[NSAppleEventManager sharedAppleEventManager] setEventHandler: self andSelector: @selector(handleOpenContentsEvent:replyEvent:)
    337             forEventClass: kInternetEventClass andEventID: kAEGetURL];
     337                                                         forEventClass: kInternetEventClass andEventID: kAEGetURL];
    338338       
    339339        fTorrents = [[NSMutableArray alloc] init];
     
    399399   
    400400    [fActionButton setToolTip: NSLocalizedString(@"Shortcuts for changing global settings.",
    401                                 "Main window -> 1st bottom left button (action) tooltip")];
     401                                                 "Main window -> 1st bottom left button (action) tooltip")];
    402402    [fSpeedLimitButton setToolTip: NSLocalizedString(@"Speed Limit overrides the total bandwidth limits with its own limits.",
    403                                 "Main window -> 2nd bottom left button (turtle) tooltip")];
     403                                                     "Main window -> 2nd bottom left button (turtle) tooltip")];
    404404    [fClearCompletedButton setToolTip: NSLocalizedString(@"Remove all transfers that have completed seeding.",
    405                                 "Main window -> 3rd bottom left button (remove all) tooltip")];
     405                                                         "Main window -> 3rd bottom left button (remove all) tooltip")];
    406406   
    407407    [fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
     
    437437    //this must be called after showStatusBar:
    438438    [fStatusBar updateWithDownload: 0.0 upload: 0.0];
    439 
     439   
    440440    //this should also be after the rest of the setup
    441441    [self updateForAutoSize];
     
    492492   
    493493    [nc addObserver: self selector: @selector(updateUI)
    494                     name: @"UpdateUI" object: nil];
     494               name: @"UpdateUI" object: nil];
    495495   
    496496    [nc addObserver: self selector: @selector(torrentFinishedDownloading:)
    497                     name: @"TorrentFinishedDownloading" object: nil];
     497               name: @"TorrentFinishedDownloading" object: nil];
    498498   
    499499    [nc addObserver: self selector: @selector(torrentRestartedDownloading:)
    500                     name: @"TorrentRestartedDownloading" object: nil];
     500               name: @"TorrentRestartedDownloading" object: nil];
    501501   
    502502    [nc addObserver: self selector: @selector(torrentFinishedSeeding:)
    503                     name: @"TorrentFinishedSeeding" object: nil];
     503               name: @"TorrentFinishedSeeding" object: nil];
    504504   
    505505    //avoids need of setting delegate
    506506    [nc addObserver: self selector: @selector(torrentTableViewSelectionDidChange:)
    507                     name: NSOutlineViewSelectionDidChangeNotification object: fTableView];
     507               name: NSOutlineViewSelectionDidChangeNotification object: fTableView];
    508508   
    509509    [nc addObserver: self selector: @selector(changeAutoImport)
    510                     name: @"AutoImportSettingChange" object: nil];
     510               name: @"AutoImportSettingChange" object: nil];
    511511   
    512512    [nc addObserver: self selector: @selector(updateForAutoSize)
    513                     name: @"AutoSizeSettingChange" object: nil];
     513               name: @"AutoSizeSettingChange" object: nil];
    514514   
    515515    [nc addObserver: self selector: @selector(updateForExpandCollape)
    516                     name: @"OutlineExpandCollapse" object: nil];
     516               name: @"OutlineExpandCollapse" object: nil];
    517517   
    518518    [nc addObserver: fWindow selector: @selector(makeKeyWindow)
    519                     name: @"MakeWindowKey" object: nil];
     519               name: @"MakeWindowKey" object: nil];
    520520   
    521521    [nc addObserver: self selector: @selector(fullUpdateUI)
    522                     name: @"UpdateQueue" object: nil];
     522               name: @"UpdateQueue" object: nil];
    523523   
    524524    [nc addObserver: self selector: @selector(applyFilter)
    525                     name: @"ApplyFilter" object: nil];
     525               name: @"ApplyFilter" object: nil];
    526526   
    527527    //open newly created torrent file
    528528    [nc addObserver: self selector: @selector(beginCreateFile:)
    529                     name: @"BeginCreateTorrentFile" object: nil];
     529               name: @"BeginCreateTorrentFile" object: nil];
    530530   
    531531    //open newly created torrent file
    532532    [nc addObserver: self selector: @selector(openCreatedFile:)
    533                     name: @"OpenCreatedTorrentFile" object: nil];
     533               name: @"OpenCreatedTorrentFile" object: nil];
    534534   
    535535    [nc addObserver: self selector: @selector(applyFilter)
    536                     name: @"UpdateGroups" object: nil];
    537 
     536               name: @"UpdateGroups" object: nil];
     537   
    538538    //timer to update the interface every second
    539539    [self updateUI];
    540540    fTimer = [NSTimer scheduledTimerWithTimeInterval: UPDATE_UI_SECONDS target: self
    541                 selector: @selector(updateUI) userInfo: nil repeats: YES];
     541                                            selector: @selector(updateUI) userInfo: nil repeats: YES];
    542542    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSModalPanelRunLoopMode];
    543543    [[NSRunLoop currentRunLoop] addTimer: fTimer forMode: NSEventTrackingRunLoopMode];
     
    557557    //register for dock icon drags (has to be in applicationDidFinishLaunching: to work)
    558558    [[NSAppleEventManager sharedAppleEventManager] setEventHandler: self andSelector: @selector(handleOpenContentsEvent:replyEvent:)
    559         forEventClass: kCoreEventClass andEventID: kAEOpenContents];
     559                                                     forEventClass: kCoreEventClass andEventID: kAEOpenContents];
    560560   
    561561    //if we were opened from a user notification, do the corresponding action
     
    592592           
    593593            NSString * donateMessage = [NSString stringWithFormat: @"%@\n\n%@",
    594                 NSLocalizedString(@"Transmission is a full-featured torrent application."
    595                     " A lot of time and effort have gone into development, coding, and refinement."
    596                     " If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
    597                 NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
     594                                        NSLocalizedString(@"Transmission is a full-featured torrent application."
     595                                                          " A lot of time and effort have gone into development, coding, and refinement."
     596                                                          " If you enjoy using it, please consider showing your love with a donation.", "Donation beg -> message"),
     597                                        NSLocalizedString(@"Donate or not, there will be no difference to your torrenting experience.", "Donation beg -> message")];
    598598           
    599599            [alert setInformativeText: donateMessage];
     
    646646        {
    647647            NSString * message = active == 1
    648                 ? NSLocalizedString(@"There is an active transfer that will be paused on quit."
    649                     " The transfer will automatically resume on the next launch.", "Confirm Quit panel -> message")
    650                 : [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers that will be paused on quit."
    651                     " The transfers will automatically resume on the next launch.", "Confirm Quit panel -> message"), active];
    652 
     648            ? NSLocalizedString(@"There is an active transfer that will be paused on quit."
     649                                " The transfer will automatically resume on the next launch.", "Confirm Quit panel -> message")
     650            : [NSString stringWithFormat: NSLocalizedString(@"There are %d active transfers that will be paused on quit."
     651                                                            " The transfers will automatically resume on the next launch.", "Confirm Quit panel -> message"), active];
     652           
    653653            NSBeginAlertSheet(NSLocalizedString(@"Are you sure you want to quit?", "Confirm Quit panel -> title"),
    654                                 NSLocalizedString(@"Quit", "Confirm Quit panel -> button"),
    655                                 NSLocalizedString(@"Cancel", "Confirm Quit panel -> button"), nil, fWindow, self,
    656                                 @selector(quitSheetDidEnd:returnCode:contextInfo:), nil, nil, @"%@", message);
     654                              NSLocalizedString(@"Quit", "Confirm Quit panel -> button"),
     655                              NSLocalizedString(@"Cancel", "Confirm Quit panel -> button"), nil, fWindow, self,
     656                              @selector(quitSheetDidEnd:returnCode:contextInfo:), nil, nil, @"%@", message);
    657657            return NSTerminateLater;
    658658        }
     
    673673    //stop the Bonjour service
    674674    [[BonjourController defaultController] stop];
    675 
     675   
    676676    //stop blocklist download
    677677    if ([BlocklistDownloader isRunning])
     
    684684   
    685685    if (fAutoImportTimer)
    686     {   
     686    {
    687687        if ([fAutoImportTimer isValid])
    688688            [fAutoImportTimer invalidate];
     
    720720    [fTableView saveCollapsedGroups];
    721721   
    722     //remaining calls the same as dealloc 
     722    //remaining calls the same as dealloc
    723723    [fInfoController release];
    724724    [fMessageController release];
     
    755755{
    756756    NSString * urlString = nil;
    757 
     757   
    758758    NSAppleEventDescriptor * directObject = [event paramDescriptorForKeyword: keyDirectObject];
    759759    if ([directObject descriptorType] == typeAEList)
     
    784784       
    785785        NSRunAlertPanel(NSLocalizedString(@"Torrent download failed", "Download not a torrent -> title"),
    786             [NSString stringWithFormat: NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.",
    787             "Download not a torrent -> message"), suggestedName,
    788             [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]],
    789             NSLocalizedString(@"OK", "Download not a torrent -> button"), nil, nil);
     786                        [NSString stringWithFormat: NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.",
     787                                                                      "Download not a torrent -> message"), suggestedName,
     788                         [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding]],
     789                        NSLocalizedString(@"OK", "Download not a torrent -> button"), nil, nil);
    790790       
    791791        [download release];
     
    793793    else
    794794        [download setDestination: [NSTemporaryDirectory() stringByAppendingPathComponent: [suggestedName lastPathComponent]]
    795                     allowOverwrite: NO];
     795                  allowOverwrite: NO];
    796796}
    797797
     
    804804{
    805805    NSRunAlertPanel(NSLocalizedString(@"Torrent download failed", "Torrent download error -> title"),
    806         [NSString stringWithFormat: NSLocalizedString(@"The torrent could not be downloaded from %@: %@.",
    807         "Torrent download failed -> message"),
    808         [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding],
    809         [error localizedDescription]], NSLocalizedString(@"OK", "Torrent download failed -> button"), nil, nil);
     806                    [NSString stringWithFormat: NSLocalizedString(@"The torrent could not be downloaded from %@: %@.",
     807                                                                  "Torrent download failed -> message"),
     808                     [[[[download request] URL] absoluteString] stringByReplacingPercentEscapesUsingEncoding: NSUTF8StringEncoding],
     809                     [error localizedDescription]], NSLocalizedString(@"OK", "Torrent download failed -> button"), nil, nil);
    810810   
    811811    [fPendingTorrentDownloads removeObjectForKey: [[download request] URL]];
     
    902902        //determine to show the options window
    903903        const BOOL showWindow = type == ADD_SHOW_OPTIONS || ([fDefaults boolForKey: @"DownloadAsk"]
    904                                     && (info.isMultifile || ![fDefaults boolForKey: @"DownloadAskMulti"])
    905                                     && (type != ADD_AUTO || ![fDefaults boolForKey: @"DownloadAskManual"]));
     904                                                             && (info.isMultifile || ![fDefaults boolForKey: @"DownloadAskMulti"])
     905                                                             && (type != ADD_AUTO || ![fDefaults boolForKey: @"DownloadAskManual"]));
    906906        tr_metainfoFree(&info);
    907907       
    908908        Torrent * torrent;
    909909        if (!(torrent = [[Torrent alloc] initWithPath: torrentPath location: location
    910                             deleteTorrentFile: showWindow ? NO : deleteTorrentFile lib: fLib]))
     910                                    deleteTorrentFile: showWindow ? NO : deleteTorrentFile lib: fLib]))
    911911            continue;
    912912       
     
    926926        {
    927927            AddWindowController * addController = [[AddWindowController alloc] initWithTorrent: torrent destination: location
    928                                                     lockDestination: lockDestination controller: self torrentFile: torrentPath
    929                                                     deleteTorrentCheckEnableInitially: deleteTorrentFile canToggleDelete: canToggleDelete];
     928                                                                               lockDestination: lockDestination controller: self torrentFile: torrentPath
     929                                                             deleteTorrentCheckEnableInitially: deleteTorrentFile canToggleDelete: canToggleDelete];
    930930            [addController showWindow: self];
    931931           
     
    949949        }
    950950    }
    951 
     951   
    952952    [self fullUpdateUI];
    953953}
     
    10181018    {
    10191019        AddMagnetWindowController * addController = [[AddMagnetWindowController alloc] initWithTorrent: torrent destination: location
    1020                                                         controller: self];
     1020                                                                                            controller: self];
    10211021        [addController showWindow: self];
    10221022       
     
    10391039        [fAddingTransfers addObject: torrent];
    10401040    }
    1041 
     1041   
    10421042    [self fullUpdateUI];
    10431043}
     
    10931093{
    10941094    NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: files, @"Filenames",
    1095                                 [NSNumber numberWithInt: ADD_MANUAL], @"AddType", nil];
     1095                           [NSNumber numberWithInt: ADD_MANUAL], @"AddType", nil];
    10961096    [self performSelectorOnMainThread: @selector(openFilesWithDict:) withObject: dict waitUntilDone: NO];
    10971097}
     
    11281128    NSAlert * alert = [[NSAlert alloc] init];
    11291129    [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"\"%@\" is not a valid torrent file.",
    1130                             "Open invalid alert -> title"), filename]];
     1130                                                                         "Open invalid alert -> title"), filename]];
    11311131    [alert setInformativeText:
    1132             NSLocalizedString(@"The torrent file cannot be opened because it contains invalid data.",
    1133                             "Open invalid alert -> message")];
     1132     NSLocalizedString(@"The torrent file cannot be opened because it contains invalid data.",
     1133                       "Open invalid alert -> message")];
    11341134    [alert setAlertStyle: NSWarningAlertStyle];
    11351135    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open invalid alert -> button")];
     
    11491149    [alert setMessageText: NSLocalizedString(@"Adding magnetized transfer failed.", "Magnet link failed -> title")];
    11501150    [alert setInformativeText: [NSString stringWithFormat: NSLocalizedString(@"There was an error when adding the magnet link \"%@\"."
    1151                                 " The transfer will not occur.", "Magnet link failed -> message"), address]];
     1151                                                                             " The transfer will not occur.", "Magnet link failed -> message"), address]];
    11521152    [alert setAlertStyle: NSWarningAlertStyle];
    11531153    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Magnet link failed -> button")];
     
    11661166    NSAlert * alert = [[NSAlert alloc] init];
    11671167    [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"A transfer of \"%@\" already exists.",
    1168                             "Open duplicate alert -> title"), name]];
     1168                                                                         "Open duplicate alert -> title"), name]];
    11691169    [alert setInformativeText:
    1170             NSLocalizedString(@"The transfer cannot be added because it is a duplicate of an already existing transfer.",
    1171                             "Open duplicate alert -> message")];
     1170     NSLocalizedString(@"The transfer cannot be added because it is a duplicate of an already existing transfer.",
     1171                       "Open duplicate alert -> message")];
    11721172    [alert setAlertStyle: NSWarningAlertStyle];
    11731173    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open duplicate alert -> button")];
     
    11881188    if (name)
    11891189        [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"A transfer of \"%@\" already exists.",
    1190                                 "Open duplicate magnet alert -> title"), name]];
     1190                                                                             "Open duplicate magnet alert -> title"), name]];
    11911191    else
    11921192        [alert setMessageText: NSLocalizedString(@"Magnet link is a duplicate of an existing transfer.",
    1193                                 "Open duplicate magnet alert -> title")];
     1193                                                 "Open duplicate magnet alert -> title")];
    11941194    [alert setInformativeText: [NSString stringWithFormat:
    1195             NSLocalizedString(@"The magnet link  \"%@\" cannot be added because it is a duplicate of an already existing transfer.",
    1196                             "Open duplicate magnet alert -> message"), address]];
     1195                                NSLocalizedString(@"The magnet link  \"%@\" cannot be added because it is a duplicate of an already existing transfer.",
     1196                                                  "Open duplicate magnet alert -> message"), address]];
    11971197    [alert setAlertStyle: NSWarningAlertStyle];
    11981198    [alert addButtonWithTitle: NSLocalizedString(@"OK", "Open duplicate magnet alert -> button")];
     
    12181218                if ((beforeCom = [urlString rangeOfString: @"/"].location) != NSNotFound)
    12191219                    urlString = [NSString stringWithFormat: @"http://www.%@.com/%@",
    1220                                     [urlString substringToIndex: beforeCom],
    1221                                     [urlString substringFromIndex: beforeCom + 1]];
     1220                                 [urlString substringToIndex: beforeCom],
     1221                                 [urlString substringFromIndex: beforeCom + 1]];
    12221222                else
    12231223                    urlString = [NSString stringWithFormat: @"http://www.%@.com/", urlString];
     
    12281228       
    12291229        NSURLRequest * request = [NSURLRequest requestWithURL: [NSURL URLWithString: urlString]
    1230                                     cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
     1230                                                  cachePolicy: NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval: 60];
    12311231       
    12321232        if ([fPendingTorrentDownloads objectForKey: [request URL]])
     
    12491249    {
    12501250        fUrlSheetController = [[URLSheetWindowController alloc] initWithController: self];
    1251    
     1251       
    12521252        [NSApp beginSheet: [fUrlSheetController window] modalForWindow: fWindow modalDelegate: self didEndSelector: @selector(urlSheetDidEnd:returnCode:contextInfo:) contextInfo: nil];
    12531253    }
     
    13341334    //don't want any of these starting then stopping
    13351335    for (Torrent * torrent in torrents)
    1336          if ([torrent waitingToStart])
    1337              [torrent stopTransfer];
     1336        if ([torrent waitingToStart])
     1337            [torrent stopTransfer];
    13381338   
    13391339    for (Torrent * torrent in torrents)
     
    13461346{
    13471347    [torrents retain];
    1348 
     1348   
    13491349    if ([fDefaults boolForKey: @"CheckRemove"])
    13501350    {
     
    13571357                    ++downloading;
    13581358            }
    1359 
     1359       
    13601360        if ([fDefaults boolForKey: @"CheckRemoveDownloading"] ? downloading > 0 : active > 0)
    13611361        {
    13621362            NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys:
    1363                                     torrents, @"Torrents",
    1364                                     [NSNumber numberWithBool: deleteData], @"DeleteData", nil];
     1363                                   torrents, @"Torrents",
     1364                                   [NSNumber numberWithBool: deleteData], @"DeleteData", nil];
    13651365           
    13661366            NSString * title, * message;
     
    13731373                if (deleteData)
    13741374                    title = [NSString stringWithFormat:
    1375                                 NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list"
    1376                                 " and trash the data file?", "Removal confirm panel -> title"), torrentName];
     1375                             NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list"
     1376                                               " and trash the data file?", "Removal confirm panel -> title"), torrentName];
    13771377                else
    13781378                    title = [NSString stringWithFormat:
    1379                                 NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list?",
    1380                                 "Removal confirm panel -> title"), torrentName];
     1379                             NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list?",
     1380                                               "Removal confirm panel -> title"), torrentName];
    13811381               
    13821382                message = NSLocalizedString(@"This transfer is active."
    1383                             " Once removed, continuing the transfer will require the torrent file or magnet link.",
    1384                             "Removal confirm panel -> message");
     1383                                            " Once removed, continuing the transfer will require the torrent file or magnet link.",
     1384                                            "Removal confirm panel -> message");
    13851385            }
    13861386            else
     
    13881388                if (deleteData)
    13891389                    title = [NSString stringWithFormat:
    1390                                 NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list"
    1391                                 " and trash the data files?", "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
     1390                             NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list"
     1391                                               " and trash the data files?", "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
    13921392                else
    13931393                    title = [NSString stringWithFormat:
    1394                                 NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list?",
    1395                                 "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
     1394                             NSLocalizedString(@"Are you sure you want to remove %@ transfers from the transfer list?",
     1395                                               "Removal confirm panel -> title"), [NSString formattedUInteger: selected]];
    13961396               
    13971397                if (selected == active)
    13981398                    message = [NSString stringWithFormat: NSLocalizedString(@"There are %@ active transfers.",
    1399                                 "Removal confirm panel -> message part 1"), [NSString formattedUInteger: active]];
     1399                                                                            "Removal confirm panel -> message part 1"), [NSString formattedUInteger: active]];
    14001400                else
    14011401                    message = [NSString stringWithFormat: NSLocalizedString(@"There are %@ transfers (%@ active).",
    1402                                 "Removal confirm panel -> message part 1"), [NSString formattedUInteger: selected], [NSString formattedUInteger: active]];
     1402                                                                            "Removal confirm panel -> message part 1"), [NSString formattedUInteger: selected], [NSString formattedUInteger: active]];
    14031403                message = [message stringByAppendingFormat: @" %@",
    1404                             NSLocalizedString(@"Once removed, continuing the transfers will require the torrent files or magnet links.",
    1405                             "Removal confirm panel -> message part 2")];
     1404                           NSLocalizedString(@"Once removed, continuing the transfers will require the torrent files or magnet links.",
     1405                                             "Removal confirm panel -> message part 2")];
    14061406            }
    14071407           
    14081408            NSBeginAlertSheet(title, NSLocalizedString(@"Remove", "Removal confirm panel -> button"),
    1409                 NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
    1410                 nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, @"%@", message);
     1409                              NSLocalizedString(@"Cancel", "Removal confirm panel -> button"), nil, fWindow, self,
     1410                              nil, @selector(removeSheetDidEnd:returnCode:contextInfo:), dict, @"%@", message);
    14111411            return;
    14121412        }
     
    14651465                if (!beganUpdate)
    14661466                {
     1467                    [NSAnimationContext beginGrouping]; //this has to be before we set the completion handler (#4874)
     1468                   
    14671469                    //we can't closeRemoveTorrent: until it's no longer in the GUI at all
    14681470                    [[NSAnimationContext currentContext] setCompletionHandler: ^{
     
    14711473                    }];
    14721474                   
    1473                     [NSAnimationContext beginGrouping];
     1475                   
    14741476                    [fTableView beginUpdates];
    14751477                    beganUpdate = YES;
     
    15121514    [self fullUpdateUI];
    15131515   
    1514     #warning why do we need them retained?
     1516#warning why do we need them retained?
    15151517    [torrents autorelease];
    15161518}
     
    15411543            NSString * torrentName = [(Torrent *)[torrents objectAtIndex: 0] name];
    15421544            message = [NSString stringWithFormat: NSLocalizedString(@"Are you sure you want to remove \"%@\" from the transfer list?",
    1543                                                                   "Remove completed confirm panel -> title"), torrentName];
     1545                                                                    "Remove completed confirm panel -> title"), torrentName];
    15441546           
    15451547            info = NSLocalizedString(@"Once removed, continuing the transfer will require the torrent file or magnet link.",
     
    15491551        {
    15501552            message = [NSString stringWithFormat: NSLocalizedString(@"Are you sure you want to remove %@ completed transfers from the transfer list?",
    1551                                                                   "Remove completed confirm panel -> title"), [NSString formattedUInteger: [torrents count]]];
     1553                                                                    "Remove completed confirm panel -> title"), [NSString formattedUInteger: [torrents count]]];
    15521554           
    15531555            info = NSLocalizedString(@"Once removed, continuing the transfers will require the torrent files or magnet links.",
     
    15941596    if (count == 1)
    15951597        [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for \"%@\".",
    1596                             "Move torrent -> select destination folder"), [(Torrent *)[torrents objectAtIndex: 0] name]]];
     1598                                                                         "Move torrent -> select destination folder"), [(Torrent *)[torrents objectAtIndex: 0] name]]];
    15971599    else
    15981600        [panel setMessage: [NSString stringWithFormat: NSLocalizedString(@"Select the new folder for %d data files.",
    1599                             "Move torrent -> select destination folder"), count]];
     1601                                                                         "Move torrent -> select destination folder"), count]];
    16001602   
    16011603    [panel beginSheetModalForWindow: fWindow completionHandler: ^(NSInteger result) {
     
    16471649            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file copy alert -> button")];
    16481650            [alert setMessageText: [NSString stringWithFormat: NSLocalizedString(@"Copy of \"%@\" Cannot Be Created",
    1649                                     "Torrent file copy alert -> title"), [torrent name]]];
    1650             [alert setInformativeText: [NSString stringWithFormat: 
    1651                     NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"),
     1651                                                                                 "Torrent file copy alert -> title"), [torrent name]]];
     1652            [alert setInformativeText: [NSString stringWithFormat:
     1653                                        NSLocalizedString(@"The torrent file (%@) cannot be found.", "Torrent file copy alert -> message"),
    16521654                                        [torrent torrentLocation]]];
    16531655            [alert setAlertStyle: NSWarningAlertStyle];
     
    17221724    if (![window isVisible])
    17231725        [window center];
    1724 
     1726   
    17251727    [window makeKeyAndOrderFront: nil];
    17261728}
     
    18061808            [fClearCompletedButton setHidden: !anyCompleted];
    18071809        }
    1808 
     1810       
    18091811        //update non-constant parts of info window
    18101812        if ([[fInfoController window] isVisible])
     
    18311833    if (totalCount != 1)
    18321834        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%@ transfers", "Status bar transfer count"),
    1833                                 [NSString formattedUInteger: totalCount]];
     1835                               [NSString formattedUInteger: totalCount]];
    18341836    else
    18351837        totalTorrentsString = NSLocalizedString(@"1 transfer", "Status bar transfer count");
     
    18421844       
    18431845        totalTorrentsString = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@", "Status bar transfer count"),
    1844                                 [NSString formattedUInteger: count], totalTorrentsString];
     1846                               [NSString formattedUInteger: count], totalTorrentsString];
    18451847    }
    18461848   
     
    19241926            NSAssert1(row != -1, @"expected a row to be found for torrent %@", torrent);
    19251927            [fTableView selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection:NO];
    1926             #warning focus the window
     1928#warning focus the window
    19271929        }
    19281930    }
     
    19921994        [GrowlApplicationBridge notifyWithTitle: notificationTitle
    19931995                                    description: [torrent name] notificationName: GROWL_DOWNLOAD_COMPLETE
    1994                                     iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
     1996                                       iconData: nil priority: 0 isSticky: NO clickContext: clickContext];
    19951997       
    19961998        NSLog(@"delegate: %@", [[NSUserNotificationCenterMtLion defaultUserNotificationCenter] delegate]);
     
    20012003        //bounce download stack
    20022004        [[NSDistributedNotificationCenter defaultCenter] postNotificationName: @"com.apple.DownloadFileFinished"
    2003             object: [torrent dataLocation]];
     2005                                                                       object: [torrent dataLocation]];
    20042006    }
    20052007   
     
    21712173    {
    21722174        NSSortDescriptor * stateDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"stateSortKey" ascending: !asc],
    2173                         * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc],
    2174                         * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc];
     2175        * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: !asc],
     2176        * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: !asc];
    21752177       
    21762178        descriptors = [NSArray arrayWithObjects: stateDescriptor, progressDescriptor, ratioDescriptor, nameDescriptor, nil];
     
    21792181    {
    21802182        NSSortDescriptor * progressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progress" ascending: asc],
    2181                         * ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc],
    2182                         * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc];
     2183        * ratioProgressDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"progressStopRatio" ascending: asc],
     2184        * ratioDescriptor = [NSSortDescriptor sortDescriptorWithKey: @"ratio" ascending: asc];
    21832185       
    21842186        descriptors = [NSArray arrayWithObjects: progressDescriptor, ratioProgressDescriptor, ratioDescriptor, nameDescriptor, nil];
     
    23972399    const BOOL wasGroupRows = [fDisplayedTorrents count] > 0 ? [[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [TorrentGroup class]] : groupRows;
    23982400   
    2399     #warning could probably be merged with later code somehow
     2401#warning could probably be merged with later code somehow
    24002402    //clear display cache for not-shown torrents
    24012403    if ([fDisplayedTorrents count] > 0)
     
    24322434    {
    24332435        NSMutableIndexSet * addIndexes = [NSMutableIndexSet indexSet],
    2434                         * removePreviousIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])];
     2436        * removePreviousIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])];
    24352437       
    24362438        //for each of the torrents to add, find if it already exists (and keep track of those we've already added & those we need to remove)
     
    24862488        NSAssert(groupRows && wasGroupRows, @"Should have had group rows and should remain with group rows");
    24872489       
    2488         #warning don't always do?
     2490#warning don't always do?
    24892491        beganUpdates = YES;
    24902492        if (onLion)
     
    26122614       
    26132615        //since we're not doing this the right way (boo buggy animation), we need to remember selected values
    2614         #warning when Lion-only and using views instead of cells, this likely won't be needed
     2616#warning when Lion-only and using views instead of cells, this likely won't be needed
    26152617        NSArray * selectedValues = [fTableView selectedValues];
    26162618       
     
    26512653            [fTableView insertItemsAtIndexes: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [fDisplayedTorrents count])] inParent: nil withAnimation: NSTableViewAnimationEffectFade];
    26522654       
    2653         if (groupRows) 
    2654         { 
    2655             //actually expand group rows 
    2656             for (TorrentGroup * group in fDisplayedTorrents) 
    2657                 [fTableView expandItem: group]; 
    2658         } 
     2655        if (groupRows)
     2656        {
     2657            //actually expand group rows
     2658            for (TorrentGroup * group in fDisplayedTorrents)
     2659                [fTableView expandItem: group];
     2660        }
    26592661       
    26602662        if (selectedValues)
     
    27792781        {
    27802782            item = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: NSLocalizedString(@"%d KB/s",
    2781                     "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
    2782                     keyEquivalent: @""];
     2783                                                                                                    "Action menu -> upload/download limit"), speedLimitActionValue[i]] action: @selector(setQuickLimitGlobal:)
     2784                                       keyEquivalent: @""];
    27832785            [item setTarget: self];
    27842786            [item setRepresentedObject: [NSNumber numberWithInt: speedLimitActionValue[i]]];
     
    27982800        {
    27992801            item = [[NSMenuItem alloc] initWithTitle: [NSString localizedStringWithFormat: @"%.2f", ratioLimitActionValue[i]]
    2800                     action: @selector(setQuickRatioGlobal:) keyEquivalent: @""];
     2802                                              action: @selector(setQuickRatioGlobal:) keyEquivalent: @""];
    28012803            [item setTarget: self];
    28022804            [item setRepresentedObject: [NSNumber numberWithFloat: ratioLimitActionValue[i]]];
     
    28382840{
    28392841    const BOOL isLimited = [[dict objectForKey: @"Active"] boolValue];
    2840 
     2842   
    28412843    [fDefaults setBool: isLimited forKey: @"SpeedLimit"];
    28422844    [fStatusBar updateSpeedFieldsToolTips];
     
    28442846    if (![[dict objectForKey: @"ByUser"] boolValue])
    28452847        [GrowlApplicationBridge notifyWithTitle: isLimited
    2846                 ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
    2847                 : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
    2848             description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
    2849             notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
     2848         ? NSLocalizedString(@"Speed Limit Auto Enabled", "Growl notification title")
     2849                                               : NSLocalizedString(@"Speed Limit Auto Disabled", "Growl notification title")
     2850                                    description: NSLocalizedString(@"Bandwidth settings changed", "Growl notification description")
     2851                               notificationName: GROWL_AUTO_SPEED_LIMIT iconData: nil priority: 0 isSticky: NO clickContext: nil];
    28502852   
    28512853    [dict release];
     
    29062908       
    29072909        //check again in 10 seconds in case torrent file wasn't complete
    2908         fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self 
    2909             selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
     2910        fAutoImportTimer = [[NSTimer scheduledTimerWithTimeInterval: 10.0 target: self
     2911                                                           selector: @selector(checkAutoImportDirectory) userInfo: nil repeats: NO] retain];
    29102912       
    29112913        [self checkAutoImportDirectory];
     
    29572959       
    29582960        if (!([[[NSWorkspace sharedWorkspace] typeOfFile: fullFile error: NULL] isEqualToString: @"org.bittorrent.torrent"]
    2959                 || [[fullFile pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame))
     2961              || [[fullFile pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame))
    29602962            continue;
    29612963       
     
    29822984               
    29832985                [GrowlApplicationBridge notifyWithTitle: notificationTitle
    2984                     description: file notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO
    2985                     clickContext: nil];
     2986                                            description: file notificationName: GROWL_AUTO_ADD iconData: nil priority: 0 isSticky: NO
     2987                                           clickContext: nil];
    29862988                break;
    2987            
     2989               
    29882990            case TR_PARSE_ERR:
    29892991                [fAutoImportedNames removeObject: file];
    29902992                break;
    2991            
     2993               
    29922994            case TR_PARSE_DUPLICATE: //let's ignore this (but silence a warning)
    29932995                break;
     
    30063008   
    30073009    NSString * location = [(NSURL *)[notification object] path],
    3008             * path = [fDefaults stringForKey: @"AutoImportDirectory"];
     3010    * path = [fDefaults stringForKey: @"AutoImportDirectory"];
    30093011   
    30103012    if (location && path && [[[location stringByDeletingLastPathComponent] stringByExpandingTildeInPath]
    3011                                     isEqualToString: [path stringByExpandingTildeInPath]])
     3013                             isEqualToString: [path stringByExpandingTildeInPath]])
    30123014        [fAutoImportedNames addObject: [location lastPathComponent]];
    30133015}
     
    30483050            NSInteger group = [item groupIndex];
    30493051            return group != -1 ? [[GroupsController groups] nameForIndex: group]
    3050                                 : NSLocalizedString(@"No Group", "Group table row");
     3052            : NSLocalizedString(@"No Group", "Group table row");
    30513053        }
    30523054        else if ([ident isEqualToString: @"Color"])
     
    30593061        else if ([ident isEqualToString: @"UL Image"])
    30603062            return [NSImage imageNamed: [fDefaults boolForKey: @"DisplayGroupRowRatio"]
    3061                                         ? @"YingYangGroupTemplate" : @"UpArrowGroupTemplate"];
     3063                    ? @"YingYangGroupTemplate" : @"UpArrowGroupTemplate"];
    30623064        else
    30633065        {
     
    30973099
    30983100- (NSDragOperation) outlineView: (NSOutlineView *) outlineView validateDrop: (id < NSDraggingInfo >) info proposedItem: (id) item
    3099     proposedChildIndex: (NSInteger) index
     3101             proposedChildIndex: (NSInteger) index
    31003102{
    31013103    NSPasteboard * pasteboard = [info draggingPasteboard];
     
    31513153        if (![NSApp isOnLionOrBetter])
    31523154            selectedValues = [fTableView selectedValues];
    3153    
     3155       
    31543156        NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
    31553157       
     
    32613263        {
    32623264            if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]
    3263                     || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     3265                || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    32643266            {
    32653267                torrent = YES;
     
    33233325        {
    33243326            if ([[[NSWorkspace sharedWorkspace] typeOfFile: file error: NULL] isEqualToString: @"org.bittorrent.torrent"]
    3325                     || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     3327                || [[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
    33263328            {
    33273329                torrent = YES;
     
    34353437        //we can't call minSize, since it might be set to the current size (auto size)
    34363438        const CGFloat minHeight = [self minWindowContentSizeAllowed]
    3437                                     + (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
     3439        + (NSHeight([fWindow frame]) - NSHeight([[fWindow contentView] frame])); //contentView to window
    34383440       
    34393441        if (windowSize.height <= minHeight)
     
    34543456        }
    34553457    }
    3456 
     3458   
    34573459    //convert points to pixels
    34583460    windowSize = [scrollView convertSize: windowSize toView: nil];
    3459 
     3461   
    34603462    windowFrame.origin.y -= (windowSize.height - windowFrame.size.height);
    34613463    windowFrame.size.height = windowSize.height;
     
    35323534   
    35333535    NSRect frame = [self windowFrameByAddingHeight: heightChange checkLimits: NO];
    3534     [fWindow setFrame: frame display: YES animate: animate]; 
     3536    [fWindow setFrame: frame display: YES animate: animate];
    35353537   
    35363538    //re-enable autoresize
     
    36253627   
    36263628    NSScrollView * scrollView = [fTableView enclosingScrollView];
    3627 
     3629   
    36283630    //set views to not autoresize
    36293631    const NSUInteger filterMask = [[fFilterBar view] autoresizingMask];
     
    37133715{
    37143716    /*if ([event type] == NSKeyDown)
    3715     {
    3716         [super keyDown: event];
    3717         return YES;
    3718     }*/
     3717     {
     3718     [super keyDown: event];
     3719     return YES;
     3720     }*/
    37193721   
    37203722    return NO;
     
    38623864        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseAllTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
    38633865        [segmentedCell setToolTip: NSLocalizedString(@"Pause all transfers",
    3864                                     "All toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
     3866                                                     "All toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    38653867       
    38663868        [segmentedCell setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    38673869        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarResumeAllTemplate"] forSegment: TOOLBAR_RESUME_TAG];
    38683870        [segmentedCell setToolTip: NSLocalizedString(@"Resume all transfers",
    3869                                     "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     3871                                                     "All toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
    38703872       
    38713873        [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause All", "All toolbar item -> label"),
    3872                                         NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
     3874                                NSLocalizedString(@"Resume All", "All toolbar item -> label"), nil]];
    38733875       
    38743876        [segmentedControl release];
     
    39043906        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarPauseSelectedTemplate"] forSegment: TOOLBAR_PAUSE_TAG];
    39053907        [segmentedCell setToolTip: NSLocalizedString(@"Pause selected transfers",
    3906                                     "Selected toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
     3908                                                     "Selected toolbar item -> tooltip") forSegment: TOOLBAR_PAUSE_TAG];
    39073909       
    39083910        [segmentedCell setTag: TOOLBAR_RESUME_TAG forSegment: TOOLBAR_RESUME_TAG];
    39093911        [segmentedControl setImage: [NSImage imageNamed: @"ToolbarResumeSelectedTemplate"] forSegment: TOOLBAR_RESUME_TAG];
    39103912        [segmentedCell setToolTip: NSLocalizedString(@"Resume selected transfers",
    3911                                     "Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
     3913                                                     "Selected toolbar item -> tooltip") forSegment: TOOLBAR_RESUME_TAG];
    39123914       
    39133915        [groupItem createMenu: [NSArray arrayWithObjects: NSLocalizedString(@"Pause Selected", "Selected toolbar item -> label"),
    3914                                         NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
     3916                                NSLocalizedString(@"Resume Selected", "Selected toolbar item -> label"), nil]];
    39153917       
    39163918        [segmentedControl release];
     
    39563958{
    39573959    NSInteger tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
    3958                     ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
     3960    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
    39593961    switch (tagValue)
    39603962    {
     
    39713973{
    39723974    NSInteger tagValue = [sender isKindOfClass: [NSSegmentedControl class]]
    3973                     ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
     3975    ? [(NSSegmentedCell *)[sender cell] tagForSegment: [sender selectedSegment]] : [(NSControl *)sender tag];
    39743976    switch (tagValue)
    39753977    {
     
    40104012    if ([ident isEqualToString: TOOLBAR_REMOVE])
    40114013        return [fTableView numberOfSelectedRows] > 0;
    4012 
     4014   
    40134015    //enable pause all item
    40144016    if ([ident isEqualToString: TOOLBAR_PAUSE_ALL])
     
    40194021        return NO;
    40204022    }
    4021 
     4023   
    40224024    //enable resume all item
    40234025    if ([ident isEqualToString: TOOLBAR_RESUME_ALL])
     
    40284030        return NO;
    40294031    }
    4030 
     4032   
    40314033    //enable pause item
    40324034    if ([ident isEqualToString: TOOLBAR_PAUSE_SELECTED])
     
    40674069        return YES;
    40684070    }
    4069 
     4071   
    40704072    return YES;
    40714073}
     
    40834085    //only enable some items if it is in a context menu or the window is useable
    40844086    BOOL canUseTable = [fWindow isKeyWindow] || [[menuItem menu] supermenu] != [NSApp mainMenu];
    4085 
     4087   
    40864088    //enable open items
    40874089    if (action == @selector(openShowSheet:) || action == @selector(openURLShowSheet:))
     
    41544156    }
    41554157   
    4156     #warning remove when menu is removed (10.7-only)
     4158#warning remove when menu is removed (10.7-only)
    41574159    if (action == @selector(toggleStatusString:))
    41584160    {
     
    41834185        if (limit)
    41844186            [menuItem setTitle: [NSString stringWithFormat: NSLocalizedString(@"Limit (%d KB/s)",
    4185                                     "Action menu -> upload/download limit"),
    4186                                     [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]]];
     4187                                                                              "Action menu -> upload/download limit"),
     4188                                 [fDefaults integerForKey: upload ? @"UploadLimit" : @"DownloadLimit"]]];
    41874189       
    41884190        [menuItem setState: [fDefaults boolForKey: upload ? @"CheckUpload" : @"CheckDownload"] ? limit : !limit];
     
    41954197        if (check)
    41964198            [menuItem setTitle: [NSString localizedStringWithFormat: NSLocalizedString(@"Stop at Ratio (%.2f)",
    4197                                     "Action menu -> ratio stop"), [fDefaults floatForKey: @"RatioLimit"]]];
     4199                                                                                       "Action menu -> ratio stop"), [fDefaults floatForKey: @"RatioLimit"]]];
    41984200       
    41994201        [menuItem setState: [fDefaults boolForKey: @"RatioCheck"] ? check : !check];
    42004202        return YES;
    42014203    }
    4202 
     4204   
    42034205    //enable show info
    42044206    if (action == @selector(showInfo:))
    42054207    {
    42064208        NSString * title = [[fInfoController window] isVisible] ? NSLocalizedString(@"Hide Inspector", "View menu -> Inspector")
    4207                             : NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
     4209        : NSLocalizedString(@"Show Inspector", "View menu -> Inspector");
    42084210        [menuItem setTitle: title];
    4209 
     4211       
    42104212        return YES;
    42114213    }
     
    42194221    {
    42204222        NSString * title = !fStatusBar ? NSLocalizedString(@"Show Status Bar", "View menu -> Status Bar")
    4221                             : NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
     4223        : NSLocalizedString(@"Hide Status Bar", "View menu -> Status Bar");
    42224224        [menuItem setTitle: title];
    4223 
     4225       
    42244226        return [fWindow isVisible];
    42254227    }
     
    42294231    {
    42304232        NSString * title = !fFilterBar ? NSLocalizedString(@"Show Filter Bar", "View menu -> Filter Bar")
    4231                             : NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
     4233        : NSLocalizedString(@"Hide Filter Bar", "View menu -> Filter Bar");
    42324234        [menuItem setTitle: title];
    4233 
     4235       
    42344236        return [fWindow isVisible];
    42354237    }
     
    42424244    if (action == @selector(revealFile:))
    42434245        return canUseTable && [fTableView numberOfSelectedRows] > 0;
    4244 
     4246   
    42454247    //enable remove items
    42464248    if (action == @selector(removeNoDelete:) || action == @selector(removeDeleteData:))
     
    42594261            }
    42604262        }
    4261    
     4263       
    42624264        //append or remove ellipsis when needed
    42634265        NSString * title = [menuItem title], * ellipsis = [NSString ellipsis];
     
    42974299        return NO;
    42984300    }
    4299 
     4301   
    43004302    //enable pause all item
    43014303    if (action == @selector(stopAllTorrents:))
     
    43214323        if (![fDefaults boolForKey: @"Queue"] && ![fDefaults boolForKey: @"QueueSeed"])
    43224324            return NO;
    4323    
     4325       
    43244326        for (Torrent * torrent in fTorrents)
    43254327            if ([torrent waitingToStart])
     
    43394341        return NO;
    43404342    }
    4341 
     4343   
    43424344    //enable pause item
    43434345    if (action == @selector(stopSelectedTorrents:))
     
    43454347        if (!canUseTable)
    43464348            return NO;
    4347    
     4349       
    43484350        for (Torrent * torrent in [fTableView selectedTorrents])
    43494351            if ([torrent isActive] || [torrent waitingToStart])
     
    43574359        if (!canUseTable)
    43584360            return NO;
    4359    
     4361       
    43604362        for (Torrent * torrent in [fTableView selectedTorrents])
    43614363            if (![torrent isActive] && ![torrent waitingToStart])
     
    43814383        if (!canUseTable)
    43824384            return NO;
    4383            
     4385       
    43844386        for (Torrent * torrent in [fTableView selectedTorrents])
    43854387            if (![torrent isMagnet])
     
    44284430        //text consistent with Finder
    44294431        NSString * title = !visible ? NSLocalizedString(@"Quick Look", "View menu -> Quick Look")
    4430                                     : NSLocalizedString(@"Close Quick Look", "View menu -> Quick Look");
     4432        : NSLocalizedString(@"Close Quick Look", "View menu -> Quick Look");
    44314433        [menuItem setTitle: title];
    44324434       
     
    44524454                    break;
    44534455                }
    4454 
     4456           
    44554457            IOAllowPowerChange(fRootPort, (long) messageArgument);
    44564458            break;
    4457 
     4459           
    44584460        case kIOMessageCanSystemSleep:
    44594461            if ([fDefaults boolForKey: @"SleepPrevent"])
     
    44704472            IOAllowPowerChange(fRootPort, (long) messageArgument);
    44714473            break;
    4472 
     4474           
    44734475        case kIOMessageSystemHasPoweredOn:
    44744476            //resume sleeping transfers after we wake up
     
    45454547{
    45464548    NSUInteger groups = ([fDisplayedTorrents count] > 0 && ![[fDisplayedTorrents objectAtIndex: 0] isKindOfClass: [Torrent class]])
    4547                         ? [fDisplayedTorrents count] : 0;
     4549    ? [fDisplayedTorrents count] : 0;
    45484550   
    45494551    CGFloat heightChange = (GROUP_SEPARATOR_HEIGHT + [fTableView intercellSpacing].height) * groups
    4550                         + ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
    4551                         - NSHeight([[fTableView enclosingScrollView] frame]);
     4552    + ([fTableView rowHeight] + [fTableView intercellSpacing].height) * ([fTableView numberOfRows] - groups)
     4553    - NSHeight([[fTableView enclosingScrollView] frame]);
    45524554   
    45534555    return [self windowFrameByAddingHeight: heightChange checkLimits: YES];
     
    45764578   
    45774579    NSSize minSize = [fWindow contentMinSize],
    4578             maxSize = [fWindow contentMaxSize];
     4580    maxSize = [fWindow contentMaxSize];
    45794581    minSize.height = height;
    45804582    maxSize.height = height;
     
    45874589{
    45884590    CGFloat contentMinHeight = NSHeight([[fWindow contentView] frame]) - NSHeight([[fTableView enclosingScrollView] frame])
    4589                                 + [fTableView rowHeight] + [fTableView intercellSpacing].height;
     4591    + [fTableView rowHeight] + [fTableView intercellSpacing].height;
    45904592    return contentMinHeight;
    45914593}
     
    46514653   
    46524654    return @{GROWL_NOTIFICATIONS_ALL : notifications,
    4653                 GROWL_NOTIFICATIONS_DEFAULT : notifications };
     4655    GROWL_NOTIFICATIONS_DEFAULT : notifications };
    46544656}
    46554657
     
    46614663    NSString * type = [clickContext objectForKey: @"Type"], * location;
    46624664    if (([type isEqualToString: GROWL_DOWNLOAD_COMPLETE] || [type isEqualToString: GROWL_SEEDING_COMPLETE])
    4663             && (location = [clickContext objectForKey: @"Location"]))
     4665        && (location = [clickContext objectForKey: @"Location"]))
    46644666    {
    46654667        NSURL * file = [NSURL fileURLWithPath: location];
     
    46944696            case TR_RPC_TORRENT_ADDED:
    46954697                [self performSelectorOnMainThread: @selector(rpcAddTorrentStruct:) withObject:
    4696                     [[NSValue valueWithPointer: torrentStruct] retain] waitUntilDone: NO];
     4698                 [[NSValue valueWithPointer: torrentStruct] retain] waitUntilDone: NO];
    46974699                break;
    4698            
     4700               
    46994701            case TR_RPC_TORRENT_STARTED:
    47004702            case TR_RPC_TORRENT_STOPPED:
    47014703                [self performSelectorOnMainThread: @selector(rpcStartedStoppedTorrent:) withObject: torrent waitUntilDone: NO];
    47024704                break;
    4703            
     4705               
    47044706            case TR_RPC_TORRENT_REMOVING:
    47054707                [self performSelectorOnMainThread: @selector(rpcRemoveTorrent:) withObject: torrent waitUntilDone: NO];
    47064708                break;
    4707            
     4709               
    47084710            case TR_RPC_TORRENT_TRASHING:
    47094711                [self performSelectorOnMainThread: @selector(rpcRemoveTorrentDeleteData:) withObject: torrent waitUntilDone: NO];
    47104712                break;
    4711            
     4713               
    47124714            case TR_RPC_TORRENT_CHANGED:
    47134715                [self performSelectorOnMainThread: @selector(rpcChangedTorrent:) withObject: torrent waitUntilDone: NO];
    47144716                break;
    4715            
     4717               
    47164718            case TR_RPC_TORRENT_MOVED:
    47174719                [self performSelectorOnMainThread: @selector(rpcMovedTorrent:) withObject: torrent waitUntilDone: NO];
    47184720                break;
    4719            
     4721               
    47204722            case TR_RPC_SESSION_QUEUE_POSITIONS_CHANGED:
    47214723                [self performSelectorOnMainThread: @selector(rpcUpdateQueue) withObject: nil waitUntilDone: NO];
    47224724                break;
    4723            
     4725               
    47244726            case TR_RPC_SESSION_CHANGED:
    47254727                [fPrefsController performSelectorOnMainThread: @selector(rpcUpdatePrefs) withObject: nil waitUntilDone: NO];
    47264728                break;
    4727            
     4729               
    47284730            case TR_RPC_SESSION_CLOSE:
    47294731                fQuitRequested = YES;
    47304732                [NSApp performSelectorOnMainThread: @selector(terminate:) withObject: self waitUntilDone: NO];
    47314733                break;
    4732            
     4734               
    47334735            default:
    47344736                NSAssert1(NO, @"Unknown RPC command received: %d", type);
Note: See TracChangeset for help on using the changeset viewer.