Changeset 503


Ignore:
Timestamp:
Jul 2, 2006, 9:53:36 PM (16 years ago)
Author:
livings124
Message:

Remember selected rows after drag (same as when sorting).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r502 r503  
    11831183    else
    11841184    {
    1185         #warning redo selected torrents
     1185        //remember selected rows if needed
     1186        NSArray * selectedTorrents = nil;
     1187        int numSelected = [fTableView numberOfSelectedRows];
     1188        if (numSelected > 0 && numSelected < [fTorrents count])
     1189            selectedTorrents = [self torrentsAtIndexes: [fTableView selectedRowIndexes]];
    11861190   
    11871191        NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData:
     
    12151219       
    12161220        [fTableView reloadData];
     1221       
     1222        //set selected rows if needed
     1223        if (selectedTorrents)
     1224        {
     1225            Torrent * torrent;
     1226            NSEnumerator * enumerator = [selectedTorrents objectEnumerator];
     1227            NSMutableIndexSet * indexSet = [[NSMutableIndexSet alloc] init];
     1228            while ((torrent = [enumerator nextObject]))
     1229                [indexSet addIndex: [fTorrents indexOfObject: torrent]];
     1230           
     1231            [fTableView selectRowIndexes: indexSet byExtendingSelection: NO];
     1232            [indexSet release];
     1233        }
    12171234    }
    12181235   
Note: See TracChangeset for help on using the changeset viewer.