Revision: 23913 http://sourceforge.net/p/bibdesk/svn/23913 Author: hofman Date: 2019-07-01 17:56:19 +0000 (Mon, 01 Jul 2019) Log Message: ----------- add a fileview delegate method to allow the delegate to perform a download
Modified Paths: -------------- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2019-07-01 17:48:45 UTC (rev 23912) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.h 2019-07-01 17:56:19 UTC (rev 23913) @@ -159,6 +159,17 @@ */ - (BOOL)fileView:(FVFileView *)aFileView shouldOpenURL:(NSURL *)aURL; +/** Allows ignoring the default download handler. + + If unimplemented or returns YES, fileview will download the URL internally. You can return NO to download the URL yourself. In that case, use the methods to update the progress indicators. + + @param aFileView The requesting view + @param aURL The URL to download + @param anIndex The index of the URL to download + @return YES to allow FileView to download the URL + */ +- (BOOL)fileView:(FVFileView *)aFileView shouldDownloadURL:(NSURL *)aURL atIndex:(NSUInteger)anIndex; + /** For download and replace of selection. If unimplemented or returns nil, FileView will use a system temporary directory. If a file currently exists at the returned URL, it may be overwritten. Used with FileView::FVDownloadMenuItemTag context menu item. Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m =================================================================== --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2019-07-01 17:48:45 UTC (rev 23912) +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m 2019-07-01 17:56:19 UTC (rev 23913) @@ -4128,14 +4128,17 @@ - (void)_downloadURLAtIndex:(NSUInteger)anIndex; { if ([self allowsDownloading]) { - Class downloadClass = NSClassFromString(@"NSURLSession") ? [FVDownloadSession class] : [FVDownloadDeprecated class]; NSURL *theURL = [self URLAtIndex:anIndex]; - FVDownload *download = [[downloadClass alloc] initWithDownloadURL:theURL indexInView:anIndex]; - [_downloads addObject:download]; - [self addProgressIndicatorForURL:theURL atIndex:anIndex]; - [download setDelegate:self]; - [download start]; - [download release]; + if ([[self delegate] respondsToSelector:@selector(fileView:shouldDownloadURL:atIndex:)] == NO || + [[self delegate] fileView:self shouldDownloadURL:theURL atIndex:anIndex] == YES) { + Class downloadClass = NSClassFromString(@"NSURLSession") ? [FVDownloadSession class] : [FVDownloadDeprecated class]; + FVDownload *download = [[downloadClass alloc] initWithDownloadURL:theURL indexInView:anIndex]; + [_downloads addObject:download]; + [download setDelegate:self]; + [download start]; + [download release]; + [self addProgressIndicatorForURL:theURL atIndex:anIndex]; + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit