allow changing groups by dragging (regardless of sort)
This commit is contained in:
parent
b147256596
commit
320f43211f
1
NEWS
1
NEWS
|
@ -3,6 +3,7 @@ NEWS file for Transmission <http://www.transmissionbt.com/>
|
|||
1.30 (2008/mm/dd)
|
||||
http://trac.transmissionbt.com/query?group=component&milestone=1.30
|
||||
- Mac
|
||||
+ Torrents can be dragged to different groups
|
||||
+ Status strings are toggled from the action button (they are no longer clickable)
|
||||
|
||||
1.20 (2008/05/09)
|
||||
|
|
|
@ -2578,7 +2578,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
- (BOOL) outlineView: (NSOutlineView *) outlineView writeItems: (NSArray *) items toPasteboard: (NSPasteboard *) pasteboard
|
||||
{
|
||||
//only allow reordering of rows if sorting by order
|
||||
if ([[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER])
|
||||
if (([fDefaults boolForKey: @"SortByGroup"] && [NSApp isOnLeopardOrBetter])
|
||||
|| [[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER])
|
||||
{
|
||||
NSMutableIndexSet * indexSet = [NSMutableIndexSet indexSet];
|
||||
NSEnumerator * enumerator = [items objectEnumerator];
|
||||
|
@ -2611,10 +2612,17 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
else if ([item isKindOfClass: [Torrent class]])
|
||||
{
|
||||
NSDictionary * group = [fTableView parentForItem: item];
|
||||
if ([[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER])
|
||||
index = [[group objectForKey: @"Torrents"] indexOfObject: item] + 1;
|
||||
else
|
||||
index = NSOutlineViewDropOnItemIndex;
|
||||
item = group;
|
||||
}
|
||||
else;
|
||||
else
|
||||
{
|
||||
if (![[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER])
|
||||
index = NSOutlineViewDropOnItemIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2649,19 +2657,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
for (i = [indexes firstIndex]; i != NSNotFound; i = [indexes indexGreaterThanIndex: i])
|
||||
[movingTorrents addObject: [fTableView itemAtRow: i]];
|
||||
|
||||
//find torrent to place under
|
||||
NSArray * groupTorrents = item ? [item objectForKey: @"Torrents"] : fDisplayedTorrents;
|
||||
Torrent * topTorrent = nil;
|
||||
for (i = newRow-1; i >= 0; i--)
|
||||
{
|
||||
Torrent * tempTorrent = [groupTorrents objectAtIndex: i];
|
||||
if (![movingTorrents containsObject: tempTorrent])
|
||||
{
|
||||
topTorrent = tempTorrent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//reset groups
|
||||
if (item)
|
||||
{
|
||||
|
@ -2677,10 +2672,26 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
[torrent setGroupValue: groupValue];
|
||||
}
|
||||
//part 1 of avoiding weird crash
|
||||
//part 2 of avoiding weird crash
|
||||
[fTableView reloadItem: nil reloadChildren: YES];
|
||||
}
|
||||
|
||||
//reorder queue order
|
||||
if ([[fDefaults stringForKey: @"Sort"] isEqualToString: SORT_ORDER])
|
||||
{
|
||||
//find torrent to place under
|
||||
NSArray * groupTorrents = item ? [item objectForKey: @"Torrents"] : fDisplayedTorrents;
|
||||
Torrent * topTorrent = nil;
|
||||
for (i = newRow-1; i >= 0; i--)
|
||||
{
|
||||
Torrent * tempTorrent = [groupTorrents objectAtIndex: i];
|
||||
if (![movingTorrents containsObject: tempTorrent])
|
||||
{
|
||||
topTorrent = tempTorrent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//remove objects to reinsert
|
||||
[fTorrents removeObjectsInArray: movingTorrents];
|
||||
|
||||
|
@ -2696,6 +2707,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
//redo order values
|
||||
for (i = 0; i < [fTorrents count]; i++)
|
||||
[[fTorrents objectAtIndex: i] setOrderValue: i];
|
||||
}
|
||||
|
||||
[self applyFilter: nil];
|
||||
|
||||
|
|
Loading…
Reference in New Issue