Changeset 13126


Ignore:
Timestamp:
Jan 2, 2012, 11:55:10 PM (9 years ago)
Author:
livings124
Message:

revert r13121 for the time being

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r13122 r13126  
    115115#define GROWL_AUTO_SPEED_LIMIT  @"Speed Limit Auto Changed"
    116116
    117 #warning remove when Lion-only
    118117#define TORRENT_TABLE_VIEW_DATA_TYPE    @"TorrentTableViewDataType"
    119118
     
    400399                                "Main window -> 3rd bottom left button (remove all) tooltip")];
    401400   
    402     [fTableView registerForDraggedTypes: [NSArray arrayWithObjects: TORRENT_TABLE_VIEW_DATA_TYPE, NSPasteboardTypeString, nil]];
     401    [fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
    403402    [fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]];
    404403   
     
    24772476}
    24782477
    2479 #warning remove when Lion-only
    24802478- (BOOL) outlineView: (NSOutlineView *) outlineView writeItems: (NSArray *) items toPasteboard: (NSPasteboard *) pasteboard
    24812479{
     
    24922490        }
    24932491       
    2494         [pasteboard declareTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE] owner: self]; 
     2492        [pasteboard declareTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE] owner: self];
    24952493        [pasteboard setData: [NSKeyedArchiver archivedDataWithRootObject: indexSet] forType: TORRENT_TABLE_VIEW_DATA_TYPE];
    24962494        return YES;
     
    24992497}
    25002498
    2501 - (id <NSPasteboardWriting>) outlineView: (NSOutlineView *) outlineView pasteboardWriterForItem: (id) item
    2502 {
    2503     //only allow reordering of rows if sorting by order
    2504     if ([item isKindOfClass: [Torrent class]] && ([fDefaults boolForKey: @"SortByGroup"] || [[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER]))
    2505     {
    2506         NSPasteboardItem * pbItem = [[[NSPasteboardItem alloc] init] autorelease];
    2507         #warning might make more sense to use TORRENT_TABLE_VIEW_DATA_TYPE
    2508         [pbItem setData: [NSKeyedArchiver archivedDataWithRootObject: [NSNumber numberWithInteger: [fTableView rowForItem: item]]] forType: NSPasteboardTypeString];
    2509         return pbItem;
    2510     }
    2511     else
    2512         return nil;
    2513 }
    2514 
    2515 - (NSDragOperation) outlineView: (NSOutlineView *) outlineView validateDrop: (id <NSDraggingInfo>) info proposedItem: (id) item proposedChildIndex: (NSInteger) index
    2516 {
    2517     if ([info draggingSource] == outlineView)
     2499- (NSDragOperation) outlineView: (NSOutlineView *) outlineView validateDrop: (id < NSDraggingInfo >) info proposedItem: (id) item
     2500    proposedChildIndex: (NSInteger) index
     2501{
     2502    NSPasteboard * pasteboard = [info draggingPasteboard];
     2503    if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
    25182504    {
    25192505        if ([fDefaults boolForKey: @"SortByGroup"])
     
    25542540}
    25552541
    2556 - (BOOL) outlineView: (NSOutlineView *) outlineView acceptDrop: (id <NSDraggingInfo>) info item: (id) item childIndex: (NSInteger) newRow
    2557 {
    2558     if ([info draggingSource] == outlineView)
     2542- (BOOL) outlineView: (NSOutlineView *) outlineView acceptDrop: (id < NSDraggingInfo >) info item: (id) item
     2543    childIndex: (NSInteger) newRow
     2544{
     2545    NSPasteboard * pasteboard = [info draggingPasteboard];
     2546    if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
    25592547    {
    25602548        //remember selected rows
    25612549        NSArray * selectedValues = [fTableView selectedValues];
    2562        
    2563         NSMutableArray * movingTorrents;
    2564         if ([[[info draggingPasteboard] types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
    2565         {
    2566             NSAssert(![NSApp isOnLionOrBetter], @"Dragging using pre-Lion functionality on Lion or greater");
    2567            
    2568             NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [[info draggingPasteboard] dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
    2569            
    2570             //get the torrents to move
    2571             movingTorrents = [NSMutableArray arrayWithCapacity: [indexes count]];
    2572             for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
    2573                 [movingTorrents addObject: [fTableView itemAtRow: i]];   
    2574         }
    2575         else
    2576         {
    2577             NSAssert([NSApp isOnLionOrBetter], @"Dragging using Lion functionality on pre-Lion");
    2578            
    2579             movingTorrents = [NSMutableArray arrayWithCapacity: info.numberOfValidItemsForDrop];
    2580             [info enumerateDraggingItemsWithOptions: 0 forView: outlineView classes: [NSArray arrayWithObject: [NSPasteboardItem class]] searchOptions: nil usingBlock: ^(NSDraggingItem * draggingItem, NSInteger index, BOOL * stop) {
    2581                 NSNumber * rowNumber = [NSKeyedUnarchiver unarchiveObjectWithData: [draggingItem.item dataForType: NSPasteboardTypeString]];
    2582                 [movingTorrents addObject: [fTableView itemAtRow: [rowNumber integerValue]]];
    2583             }];
    2584         }
     2550   
     2551        NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
     2552       
     2553        //get the torrents to move
     2554        NSMutableArray * movingTorrents = [NSMutableArray arrayWithCapacity: [indexes count]];
     2555        for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
     2556            [movingTorrents addObject: [fTableView itemAtRow: i]];
    25852557       
    25862558        //reset groups
Note: See TracChangeset for help on using the changeset viewer.