Commit 29eb0311 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: add multi-selection support to the playlist's revealItemInFinder (refs #6892)

(cherry picked from commit 3dd486c8)
parent 2dfe7c35
...@@ -820,23 +820,34 @@ ...@@ -820,23 +820,34 @@
- (IBAction)revealItemInFinder:(id)sender - (IBAction)revealItemInFinder:(id)sender
{ {
playlist_item_t * p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue]; NSIndexSet * selectedRows = [o_outline_view selectedRowIndexes];
NSMutableString * o_mrl = nil; NSUInteger count = [selectedRows count];
NSUInteger indexes[count];
[selectedRows getIndexes:indexes maxCount:count inIndexRange:nil];
NSMutableString * o_mrl;
playlist_item_t *p_item;
for (NSUInteger i = 0; i < count; i++) {
p_item = [[o_outline_view itemAtRow:indexes[i]] pointerValue];
if(! p_item || !p_item->p_input ) if(! p_item || !p_item->p_input )
return; continue;
char *psz_uri = decode_URI( input_item_GetURI( p_item->p_input ) ); o_mrl = [[NSMutableString alloc] initWithFormat: @"%s", decode_URI( input_item_GetURI( p_item->p_input ))];
if( psz_uri )
o_mrl = [NSMutableString stringWithUTF8String: psz_uri];
/* perform some checks whether it is a file and if it is local at all... */ /* perform some checks whether it is a file and if it is local at all... */
if ([o_mrl length] > 0)
{
NSRange prefix_range = [o_mrl rangeOfString: @"file:"]; NSRange prefix_range = [o_mrl rangeOfString: @"file:"];
if( prefix_range.location != NSNotFound ) if( prefix_range.location != NSNotFound )
[o_mrl deleteCharactersInRange: prefix_range]; [o_mrl deleteCharactersInRange: prefix_range];
if( [o_mrl characterAtIndex:0] == '/' ) if( [o_mrl characterAtIndex:0] == '/' )
[[NSWorkspace sharedWorkspace] selectFile: o_mrl inFileViewerRootedAtPath: o_mrl]; [[NSWorkspace sharedWorkspace] selectFile: o_mrl inFileViewerRootedAtPath: o_mrl];
}
[o_mrl release];
}
} }
/* When called retrieves the selected outlineview row and plays that node or item */ /* When called retrieves the selected outlineview row and plays that node or item */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment