Changeset 323


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

Initial support for creating a torrent copy (to recover torrent files after being placed in Support folder, basically). Next commit will refine it a bit.

Location:
trunk/macosx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.h

    r310 r323  
    100100- (void) removeTorrentWithIndex:        (NSIndexSet *) indexSet
    101101                deleteData:             (BOOL) deleteData;
    102                
    103102- (void) removeSheetDidEnd: (NSWindow *) sheet returnCode: (int) returnCode
    104103                        contextInfo: (NSDictionary *) dict;
    105104- (void) confirmRemoveTorrents: (NSArray *) torrents
    106105            deleteData: (BOOL) deleteData;
     106
     107- (void) copyTorrentFile: (id) sender;
    107108
    108109- (void) revealFile: (id) sender;
  • trunk/macosx/Controller.m

    r318 r323  
    631631}
    632632
     633- (void) copyTorrentFile: (id) sender
     634{
     635    Torrent * torrent;
     636    NSEnumerator * enumerator = [[self torrentsAtIndexes:
     637            [fTableView selectedRowIndexes]] objectEnumerator];
     638   
     639    while ((torrent = [enumerator nextObject]))
     640    {
     641        //warn user if torrent file can't be found
     642        if (![[NSFileManager defaultManager] fileExistsAtPath: [torrent torrentLocation]])
     643        {
     644            #warning warn user of failure
     645            continue;
     646        }
     647       
     648        //ask for copy location and name (save)
     649        NSSavePanel * savePanel = [NSSavePanel savePanel];
     650        [savePanel setRequiredFileType: @"torrent"];
     651        [savePanel setCanSelectHiddenExtension: YES];
     652       
     653        if ([savePanel runModalForDirectory: nil file: [torrent name]] == NSOKButton)
     654            [[NSFileManager defaultManager] copyPath: [torrent torrentLocation]
     655                toPath: [savePanel filename] handler: nil];
     656    }
     657}
     658
    633659- (void) revealFile: (id) sender
    634660{
     
    11431169    //only enable some items if it is in a context menu or the window is useable
    11441170    BOOL canUseMenu = [[[menuItem menu] title] isEqualToString: @"Context"]
    1145                         || ([fWindow isKeyWindow] && ![fToolbar customizationPaletteIsRunning]);
     1171                        || [fWindow isKeyWindow];
    11461172
    11471173    //enable show info
  • trunk/macosx/English.lproj/MainMenu.nib/classes.nib

    r310 r323  
    55                advancedChanged = id;
    66                checkUpdate = id;
     7                copyTorrentFile = id;
    78                growlRegister = id;
    89                linkForums = id;
  • trunk/macosx/English.lproj/MainMenu.nib/info.nib

    r310 r323  
    1212                <string>423 269 420 60 0 0 1152 842 </string>
    1313                <key>29</key>
    14                 <string>195 519 451 44 0 0 1152 842 </string>
     14                <string>189 691 451 44 0 0 1152 842 </string>
    1515                <key>456</key>
    16                 <string>212 488 153 168 0 0 1152 842 </string>
     16                <string>252 356 167 199 0 0 1152 842 </string>
    1717                <key>581</key>
    1818                <string>324 628 112 68 0 0 1152 842 </string>
     
    3030        <key>IBOpenObjects</key>
    3131        <array>
     32                <integer>29</integer>
    3233                <integer>21</integer>
    3334        </array>
Note: See TracChangeset for help on using the changeset viewer.