mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
revert r13121 for the time being
This commit is contained in:
parent
575a57525c
commit
97c9f72cda
1 changed files with 16 additions and 44 deletions
|
@ -114,7 +114,6 @@ typedef enum
|
|||
#define GROWL_AUTO_ADD @"Torrent Auto Added"
|
||||
#define GROWL_AUTO_SPEED_LIMIT @"Speed Limit Auto Changed"
|
||||
|
||||
#warning remove when Lion-only
|
||||
#define TORRENT_TABLE_VIEW_DATA_TYPE @"TorrentTableViewDataType"
|
||||
|
||||
#define ROW_HEIGHT_REGULAR 62.0
|
||||
|
@ -399,7 +398,7 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
[fClearCompletedButton setToolTip: NSLocalizedString(@"Remove all transfers that have completed seeding.",
|
||||
"Main window -> 3rd bottom left button (remove all) tooltip")];
|
||||
|
||||
[fTableView registerForDraggedTypes: [NSArray arrayWithObjects: TORRENT_TABLE_VIEW_DATA_TYPE, NSPasteboardTypeString, nil]];
|
||||
[fTableView registerForDraggedTypes: [NSArray arrayWithObject: TORRENT_TABLE_VIEW_DATA_TYPE]];
|
||||
[fWindow registerForDraggedTypes: [NSArray arrayWithObjects: NSFilenamesPboardType, NSURLPboardType, nil]];
|
||||
|
||||
//you would think this would be called later in this method from updateUI, but it's not reached in awakeFromNib
|
||||
|
@ -2476,7 +2475,6 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
}
|
||||
}
|
||||
|
||||
#warning remove when Lion-only
|
||||
- (BOOL) outlineView: (NSOutlineView *) outlineView writeItems: (NSArray *) items toPasteboard: (NSPasteboard *) pasteboard
|
||||
{
|
||||
//only allow reordering of rows if sorting by order
|
||||
|
@ -2498,23 +2496,11 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (id <NSPasteboardWriting>) outlineView: (NSOutlineView *) outlineView pasteboardWriterForItem: (id) item
|
||||
- (NSDragOperation) outlineView: (NSOutlineView *) outlineView validateDrop: (id < NSDraggingInfo >) info proposedItem: (id) item
|
||||
proposedChildIndex: (NSInteger) index
|
||||
{
|
||||
//only allow reordering of rows if sorting by order
|
||||
if ([item isKindOfClass: [Torrent class]] && ([fDefaults boolForKey: @"SortByGroup"] || [[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER]))
|
||||
{
|
||||
NSPasteboardItem * pbItem = [[[NSPasteboardItem alloc] init] autorelease];
|
||||
#warning might make more sense to use TORRENT_TABLE_VIEW_DATA_TYPE
|
||||
[pbItem setData: [NSKeyedArchiver archivedDataWithRootObject: [NSNumber numberWithInteger: [fTableView rowForItem: item]]] forType: NSPasteboardTypeString];
|
||||
return pbItem;
|
||||
}
|
||||
else
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSDragOperation) outlineView: (NSOutlineView *) outlineView validateDrop: (id <NSDraggingInfo>) info proposedItem: (id) item proposedChildIndex: (NSInteger) index
|
||||
{
|
||||
if ([info draggingSource] == outlineView)
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
{
|
||||
if ([fDefaults boolForKey: @"SortByGroup"])
|
||||
{
|
||||
|
@ -2553,35 +2539,21 @@ static void sleepCallback(void * controller, io_service_t y, natural_t messageTy
|
|||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
- (BOOL) outlineView: (NSOutlineView *) outlineView acceptDrop: (id <NSDraggingInfo>) info item: (id) item childIndex: (NSInteger) newRow
|
||||
- (BOOL) outlineView: (NSOutlineView *) outlineView acceptDrop: (id < NSDraggingInfo >) info item: (id) item
|
||||
childIndex: (NSInteger) newRow
|
||||
{
|
||||
if ([info draggingSource] == outlineView)
|
||||
NSPasteboard * pasteboard = [info draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
{
|
||||
//remember selected rows
|
||||
NSArray * selectedValues = [fTableView selectedValues];
|
||||
|
||||
NSMutableArray * movingTorrents;
|
||||
if ([[[info draggingPasteboard] types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
|
||||
{
|
||||
NSAssert(![NSApp isOnLionOrBetter], @"Dragging using pre-Lion functionality on Lion or greater");
|
||||
|
||||
NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [[info draggingPasteboard] dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
|
||||
NSIndexSet * indexes = [NSKeyedUnarchiver unarchiveObjectWithData: [pasteboard dataForType: TORRENT_TABLE_VIEW_DATA_TYPE]];
|
||||
|
||||
//get the torrents to move
|
||||
movingTorrents = [NSMutableArray arrayWithCapacity: [indexes count]];
|
||||
NSMutableArray * movingTorrents = [NSMutableArray arrayWithCapacity: [indexes count]];
|
||||
for (NSUInteger i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
[movingTorrents addObject: [fTableView itemAtRow: i]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSAssert([NSApp isOnLionOrBetter], @"Dragging using Lion functionality on pre-Lion");
|
||||
|
||||
movingTorrents = [NSMutableArray arrayWithCapacity: info.numberOfValidItemsForDrop];
|
||||
[info enumerateDraggingItemsWithOptions: 0 forView: outlineView classes: [NSArray arrayWithObject: [NSPasteboardItem class]] searchOptions: nil usingBlock: ^(NSDraggingItem * draggingItem, NSInteger index, BOOL * stop) {
|
||||
NSNumber * rowNumber = [NSKeyedUnarchiver unarchiveObjectWithData: [draggingItem.item dataForType: NSPasteboardTypeString]];
|
||||
[movingTorrents addObject: [fTableView itemAtRow: [rowNumber integerValue]]];
|
||||
}];
|
||||
}
|
||||
|
||||
//reset groups
|
||||
if (item)
|
||||
|
|
Loading…
Reference in a new issue