Changeset 324


Ignore:
Timestamp:
Jun 10, 2006, 11:29:47 PM (16 years ago)
Author:
livings124
Message:

Validate menu item and show warning on failure for "Copy Torrent"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r323 r324  
    642642        if (![[NSFileManager defaultManager] fileExistsAtPath: [torrent torrentLocation]])
    643643        {
    644             #warning warn user of failure
     644            NSAlert * alert = [[NSAlert alloc] init];
     645            [alert addButtonWithTitle: @"OK"];
     646            [alert setMessageText: [NSString stringWithFormat:
     647                    @"Copy of \"%@\" Cannot Be Created", [torrent name]]];
     648            [alert setInformativeText: [NSString stringWithFormat:
     649                    @"The torrent file (%@) cannot be found.", [torrent torrentLocation]]];
     650            [alert setAlertStyle: NSWarningAlertStyle];
     651           
     652            [alert runModal];
     653           
    645654            continue;
    646655        }
    647656       
    648         //ask for copy location and name (save)
     657        //save with extension
    649658        NSSavePanel * savePanel = [NSSavePanel savePanel];
    650659        [savePanel setRequiredFileType: @"torrent"];
    651660        [savePanel setCanSelectHiddenExtension: YES];
    652661       
     662        //if save successful, copy torrent to new location with name of data file
    653663        if ([savePanel runModalForDirectory: nil file: [torrent name]] == NSOKButton)
    654664            [[NSFileManager defaultManager] copyPath: [torrent torrentLocation]
     
    12961306    if (action == @selector(setSort:) || (action == @selector(advancedChanged:)))
    12971307        return canUseMenu;
     1308   
     1309    //enable copy torrent file item
     1310    if( action == @selector(copyTorrentFile:) )
     1311    {
     1312        return canUseMenu && [fTableView numberOfSelectedRows] > 0;
     1313    }
    12981314
    12991315    return YES;
Note: See TracChangeset for help on using the changeset viewer.