Revision: 28447
http://sourceforge.net/p/bibdesk/svn/28447
Author: hofman
Date: 2023-11-18 22:53:41 +0000 (Sat, 18 Nov 2023)
Log Message:
-----------
Don't pass downloader in download delegate methods. Implement method calling
delegate in BDSKDownload class.
Modified Paths:
--------------
trunk/bibdesk/BDSKAsynchronousWebParser.m
trunk/bibdesk/BDSKDBLPGroupServer.h
trunk/bibdesk/BDSKDBLPGroupServer.m
trunk/bibdesk/BDSKDownloader.h
trunk/bibdesk/BDSKDownloader.m
trunk/bibdesk/BDSKEntrezGroupServer.h
trunk/bibdesk/BDSKEntrezGroupServer.m
trunk/bibdesk/BDSKItemDownload.h
trunk/bibdesk/BDSKItemDownload.m
trunk/bibdesk/BDSKSoapBinding.m
trunk/bibdesk/BDSKTextImportController.h
trunk/bibdesk/BDSKTextImportController.m
trunk/bibdesk/BDSKURLGroup.h
trunk/bibdesk/BDSKURLGroup.m
Modified: trunk/bibdesk/BDSKAsynchronousWebParser.m
===================================================================
--- trunk/bibdesk/BDSKAsynchronousWebParser.m 2023-11-18 15:11:30 UTC (rev
28446)
+++ trunk/bibdesk/BDSKAsynchronousWebParser.m 2023-11-18 22:53:41 UTC (rev
28447)
@@ -173,7 +173,7 @@
#pragma mark -
-@interface BDSKCitationDownload () <BDSKDownloaderDelegate>
+@interface BDSKCitationDownload () <BDSKDownloadDelegate>
@end
@implementation BDSKCitationDownload
@@ -234,12 +234,12 @@
download = [[[BDSKDownloader sharedDownloader]
startDataDownloadWithRequest:request delegate:self] retain];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCompleteWithError:(NSError *)downloadError {
+- (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError
*)downloadError {
error = [downloadError retain];
[delegate downloadDidFinish:self];
}
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
return [delegate citationDownloadWindowForAuthenticationSheet:self];
}
Modified: trunk/bibdesk/BDSKDBLPGroupServer.h
===================================================================
--- trunk/bibdesk/BDSKDBLPGroupServer.h 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKDBLPGroupServer.h 2023-11-18 22:53:41 UTC (rev 28447)
@@ -42,7 +42,7 @@
@class BDSKDownload;
-@interface BDSKDBLPGroupServer : NSObject <BDSKSearchGroupServer,
BDSKDownloaderDelegate>
+@interface BDSKDBLPGroupServer : NSObject <BDSKSearchGroupServer,
BDSKDownloadDelegate>
{
id<BDSKSearchGroup> group;
BDSKServerInfo *serverInfo;
Modified: trunk/bibdesk/BDSKDBLPGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKDBLPGroupServer.m 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKDBLPGroupServer.m 2023-11-18 22:53:41 UTC (rev 28447)
@@ -296,9 +296,9 @@
}
}
-#pragma mark BDSKDownloaderDelegate
+#pragma mark BDSKDownloadDelegate
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download didCompleteWithError:(NSError *)error {
+- (void)download:(BDSKDownload *)download didCompleteWithError:(NSError
*)error {
if (error) {
if ([[error domain] isEqualToString:NSURLErrorDomain] && [error code]
== NSURLErrorCancelled)
return;
@@ -399,7 +399,7 @@
}
}
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
return [group windowForSheetForObject:self];
}
Modified: trunk/bibdesk/BDSKDownloader.h
===================================================================
--- trunk/bibdesk/BDSKDownloader.h 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKDownloader.h 2023-11-18 22:53:41 UTC (rev 28447)
@@ -39,7 +39,7 @@
#import <Cocoa/Cocoa.h>
@class BDSKDownload;
-@protocol BDSKDownloaderDelegate;
+@protocol BDSKDownloadDelegate;
@interface BDSKDownloader : NSObject <NSURLSessionDelegate> {
NSMapTable *downloads;
@@ -48,8 +48,8 @@
+ (BDSKDownloader *)sharedDownloader;
-- (BDSKDownload *)startFileDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloaderDelegate>)aDelegate;
-- (BDSKDownload *)startDataDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloaderDelegate>)aDelegate;
+- (BDSKDownload *)startFileDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloadDelegate>)aDelegate;
+- (BDSKDownload *)startDataDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloadDelegate>)aDelegate;
- (NSData *)downloadDataWithRequest:(NSURLRequest *)request
returningResponse:(NSURLResponse **)response error:(NSError **)error;
- (NSURLSessionTask *)downloadDataWithRequest:(NSURLRequest *)request
completionHandler:(void (^)(NSData *data, NSURLResponse *response, NSError
*error))completionHandler;
@@ -61,11 +61,11 @@
@interface BDSKDownload : NSObject {
NSURLSessionTask *task;
NSMutableData *data;
- id <BDSKDownloaderDelegate> delegate;
+ id <BDSKDownloadDelegate> delegate;
BOOL receivedExpectedBytes;
}
-@property (nonatomic, retain) id <BDSKDownloaderDelegate> delegate;
+@property (nonatomic, retain) id <BDSKDownloadDelegate> delegate;
@property (nonatomic, retain) NSURLSessionTask *task;
@property (nonatomic, readonly) NSURLResponse *response;
@property (nonatomic, retain) NSMutableData *data;
@@ -77,23 +77,23 @@
#pragma mark -
-@protocol BDSKDownloaderDelegate <NSObject>
+@protocol BDSKDownloadDelegate <NSObject>
@required
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download didCompleteWithError:(NSError *)error;
+- (void)download:(BDSKDownload *)download didCompleteWithError:(NSError
*)error;
@optional
// for file and data downloads
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download didReceiveExpectedContentLength:(int64_t)expectedContentLength;
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download didReceiveDataOfLength:(uint64_t)length;
+- (void)download:(BDSKDownload *)download
didReceiveExpectedContentLength:(int64_t)expectedContentLength;
+- (void)download:(BDSKDownload *)download
didReceiveDataOfLength:(uint64_t)length;
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,
NSURLCredential *credential))completionHandler;
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download;
+- (void)download:(BDSKDownload *)download
didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,
NSURLCredential *credential))completionHandler;
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download;
// only for file downloads
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler;
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)download didCreateDestination:(NSURL *)destinationURL;
+- (void)download:(BDSKDownload *)download
decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler;
+- (void)download:(BDSKDownload *)download didCreateDestination:(NSURL
*)destinationURL;
@end
Modified: trunk/bibdesk/BDSKDownloader.m
===================================================================
--- trunk/bibdesk/BDSKDownloader.m 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKDownloader.m 2023-11-18 22:53:41 UTC (rev 28447)
@@ -42,6 +42,17 @@
#import "BDSKBibDeskProtocol.h"
+@interface BDSKDownload ()
+
+- (void)_didCompleteWithError:(NSError *)error;
+- (void)_didReceiveExpectedContentLength:(int64_t)expectedContentLength;
+- (void)_didReceiveDataOfLength:(uint64_t)length;
+- (void)_didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,
NSURLCredential *credential))completionHandler;
+- (void)_decideDestinationWithSuggestedFilename:(NSString *)suggestedFileName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler;
+- (void)_didCreateDestination:(NSURL *)destinationURL;
+
+@end
+
@implementation BDSKDownloader
+ (BDSKDownloader *)sharedDownloader{
@@ -72,7 +83,7 @@
return session;
}
-- (BDSKDownload *)addDownloadWithTask:(NSURLSessionTask *)task delegate:(id
<BDSKDownloaderDelegate>)delegate {
+- (BDSKDownload *)addDownloadWithTask:(NSURLSessionTask *)task delegate:(id
<BDSKDownloadDelegate>)delegate {
BDSKDownload *download = [[[BDSKDownload alloc] init] autorelease];
[download setTask:task];
[download setDelegate:delegate];
@@ -94,7 +105,7 @@
#pragma mark API
-- (BDSKDownload *)startFileDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloaderDelegate>)delegate {
+- (BDSKDownload *)startFileDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloadDelegate>)delegate {
NSURLSessionTask *task = [[self session] downloadTaskWithRequest:request];
BDSKDownload *download = [self addDownloadWithTask:task delegate:delegate];
[task resume];
@@ -101,7 +112,7 @@
return download;
}
-- (BDSKDownload *)startDataDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloaderDelegate>)delegate {
+- (BDSKDownload *)startDataDownloadWithRequest:(NSURLRequest *)request
delegate:(id <BDSKDownloadDelegate>)delegate {
NSURLSessionTask *task = [[self session] dataTaskWithRequest:request];
BDSKDownload *download = [self addDownloadWithTask:task delegate:delegate];
[task resume];
@@ -142,57 +153,6 @@
return task;
}
-#pragma mark Delegate interaction
-
-- (void)_download:(BDSKDownload *)download didCompleteWithError:(NSError
*)error {
- id<BDSKDownloaderDelegate> delegate = [download delegate];
- [delegate downloader:self download:download didCompleteWithError:error];
-}
-
-- (void)_download:(BDSKDownload *)download
didReceiveExpectedContentLength:(int64_t)expectedContentLength {
- id<BDSKDownloaderDelegate> delegate = [download delegate];
- if ([delegate
respondsToSelector:@selector(downloader:download:didReceiveExpectedContentLength:)])
{
- [delegate downloader:self download:download
didReceiveExpectedContentLength:expectedContentLength];
- }
-}
-
-- (void)_download:(BDSKDownload *)download
didReceiveDataOfLength:(uint64_t)length {
- id<BDSKDownloaderDelegate> delegate = [download delegate];
- if ([delegate
respondsToSelector:@selector(downloader:download:didReceiveDataOfLength:)]) {
- [delegate downloader:self download:download
didReceiveDataOfLength:length];
- }
-}
-
-- (void)_download:(BDSKDownload *)download
didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,
NSURLCredential *credential))completionHandler {
- id<BDSKDownloaderDelegate> delegate = [download delegate];
- if ([delegate
respondsToSelector:@selector(downloader:download:didReceiveChallenge:completionHandler:)])
{
- [delegate downloader:self download:download
didReceiveChallenge:challenge completionHandler:completionHandler];
- } else {
- NSWindow *window = nil;
- if ([delegate
respondsToSelector:@selector(downloader:downloadWindowForAuthenticationSheet:)])
{
- window = [delegate downloader:self
downloadWindowForAuthenticationSheet:download];
- }
- [[BDSKAuthenticationHandler sharedHandler]
startAuthentication:challenge window:window
completionHandler:completionHandler];
- }
-}
-
-- (void)_download:(BDSKDownload *)download
decideDestinationWithSuggestedFilename:(NSString *)suggestedFileName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler {
- id<BDSKDownloaderDelegate> delegate = [download delegate];
- if ([delegate
respondsToSelector:@selector(downloader:download:decideDestinationWithSuggestedFilename:completionHandler:)])
{
- [delegate downloader:self download:download
decideDestinationWithSuggestedFilename:suggestedFileName
completionHandler:completionHandler];
- } else {
- NSURL *destinationURL = [[NSFileManager defaultManager]
temporaryFileURLWithBasename:suggestedFileName];
- completionHandler(destinationURL, YES);
- }
-}
-
-- (void)_download:(BDSKDownload *)download didCreateDestination:(NSURL
*)destinationURL {
- id<BDSKDownloaderDelegate> delegate = [download delegate];
- if ([delegate
respondsToSelector:@selector(downloader:download:didCreateDestination:)]) {
- [delegate downloader:self download:download
didCreateDestination:destinationURL];
- }
-}
-
#pragma mark NSURLSessionDownloadTaskDelegate
- (void)URLSession:(NSURLSession *)aSession
downloadTask:(NSURLSessionDownloadTask *)task didFinishDownloadingToURL:(NSURL
*)location {
@@ -199,7 +159,7 @@
BDSKDownload *download = [[[self downloadForTask:task] retain]
autorelease];
NSString *suggestedFileName = [[task response] suggestedFilename] ?:
[location lastPathComponent];
- [self _download:download
decideDestinationWithSuggestedFilename:suggestedFileName
completionHandler:^(NSURL *destinationURL, BOOL allowOverwrite){
+ [download _decideDestinationWithSuggestedFilename:suggestedFileName
completionHandler:^(NSURL *destinationURL, BOOL allowOverwrite){
NSError *error = nil;
NSFileManager *fm = [NSFileManager defaultManager];
if ([destinationURL checkResourceIsReachableAndReturnError:NULL]) {
@@ -212,10 +172,10 @@
[fm createDirectoryAtPath:[[destinationURL
URLByDeletingLastPathComponent] path] withIntermediateDirectories:YES
attributes:nil error:NULL];
}
if ([fm moveItemAtURL:location toURL:destinationURL error:&error]) {
- [self _download:download didCreateDestination:destinationURL];
- [self _download:download didCompleteWithError:nil];
+ [download _didCreateDestination:destinationURL];
+ [download _didCompleteWithError:nil];
} else {
- [self _download:download didCompleteWithError:error];
+ [download _didCompleteWithError:error];
[self cleanupDownload:download];
}
}];
@@ -225,11 +185,11 @@
BDSKDownload *download = [[[self downloadForTask:task] retain]
autorelease];
if ([download receivedExpectedBytes] == NO) {
[download setReceivedExpectedBytes:YES];
- [self _download:download
didReceiveExpectedContentLength:totalBytesExpectedToWrite];
+ [download _didReceiveExpectedContentLength:totalBytesExpectedToWrite];
}
if (bytesWritten >= 0) {
- [self _download:download
didReceiveDataOfLength:(uint64_t)bytesWritten];
+ [download _didReceiveDataOfLength:(uint64_t)bytesWritten];
}
}
@@ -237,7 +197,7 @@
- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask
*)task didReceiveResponse:(NSURLResponse *)response completionHandler:(void
(^)(NSURLSessionResponseDisposition disposition))completionHandler {
BDSKDownload *download = [[[self downloadForTask:task] retain]
autorelease];
- [self _download:download didReceiveExpectedContentLength:[response
expectedContentLength]];
+ [download _didReceiveExpectedContentLength:[response
expectedContentLength]];
// the delegeate may have cancelled the task, in that case don't call the
callback
if ([self downloadForTask:task])
completionHandler(NSURLSessionResponseAllow);
@@ -249,7 +209,7 @@
[download setData:[NSMutableData dataWithData:data]];
else
[[download data] appendData:data];
- [self _download:download didReceiveDataOfLength:[data length]];
+ [download _didReceiveDataOfLength:[data length]];
}
#pragma mark NSURLSessionTaskDelegate
@@ -256,13 +216,13 @@
- (void)URLSession:(NSURLSession *)aSession task:(NSURLSessionTask *)task
didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,
NSURLCredential *credential))completionHandler {
BDSKDownload *download = [[[self downloadForTask:task] retain]
autorelease];
- [self _download:download didReceiveChallenge:challenge
completionHandler:completionHandler];
+ [download _didReceiveChallenge:challenge
completionHandler:completionHandler];
}
- (void)URLSession:(NSURLSession *)aSession task:(NSURLSessionTask *)task
didCompleteWithError:(NSError *)error {
BDSKDownload *download = [[[self downloadForTask:task] retain]
autorelease];
if (error || [task isKindOfClass:[NSURLSessionDataTask class]]) {
- [self _download:download didCompleteWithError:error];
+ [download _didCompleteWithError:error];
}
[self cleanupDownload:download];
}
@@ -299,5 +259,50 @@
[[BDSKDownloader sharedDownloader] cleanupDownload:self];
}
+#pragma mark Delegate interaction
+
+- (void)_didCompleteWithError:(NSError *)error {
+ [delegate download:self didCompleteWithError:error];
+}
+
+- (void)_didReceiveExpectedContentLength:(int64_t)expectedContentLength {
+ if ([delegate
respondsToSelector:@selector(download:didReceiveExpectedContentLength:)]) {
+ [delegate download:self
didReceiveExpectedContentLength:expectedContentLength];
+ }
+}
+
+- (void)_didReceiveDataOfLength:(uint64_t)length {
+ if ([delegate
respondsToSelector:@selector(download:didReceiveDataOfLength:)]) {
+ [delegate download:self didReceiveDataOfLength:length];
+ }
+}
+
+- (void)_didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition,
NSURLCredential *credential))completionHandler {
+ if ([delegate
respondsToSelector:@selector(download:didReceiveChallenge:completionHandler:)])
{
+ [delegate download:self didReceiveChallenge:challenge
completionHandler:completionHandler];
+ } else {
+ NSWindow *window = nil;
+ if ([delegate
respondsToSelector:@selector(downloadWindowForAuthenticationSheet:)]) {
+ window = [delegate downloadWindowForAuthenticationSheet:self];
+ }
+ [[BDSKAuthenticationHandler sharedHandler]
startAuthentication:challenge window:window
completionHandler:completionHandler];
+ }
+}
+
+- (void)_decideDestinationWithSuggestedFilename:(NSString *)suggestedFileName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler {
+ if ([delegate
respondsToSelector:@selector(download:decideDestinationWithSuggestedFilename:completionHandler:)])
{
+ [delegate download:self
decideDestinationWithSuggestedFilename:suggestedFileName
completionHandler:completionHandler];
+ } else {
+ NSURL *destinationURL = [[NSFileManager defaultManager]
temporaryFileURLWithBasename:suggestedFileName];
+ completionHandler(destinationURL, YES);
+ }
+}
+
+- (void)_didCreateDestination:(NSURL *)destinationURL {
+ if ([delegate
respondsToSelector:@selector(download:didCreateDestination:)]) {
+ [delegate download:self didCreateDestination:destinationURL];
+ }
+}
+
@end
Modified: trunk/bibdesk/BDSKEntrezGroupServer.h
===================================================================
--- trunk/bibdesk/BDSKEntrezGroupServer.h 2023-11-18 15:11:30 UTC (rev
28446)
+++ trunk/bibdesk/BDSKEntrezGroupServer.h 2023-11-18 22:53:41 UTC (rev
28447)
@@ -42,7 +42,7 @@
@class BDSKServerInfo;
-@interface BDSKEntrezGroupServer : NSObject <BDSKSearchGroupServer,
BDSKDownloaderDelegate>
+@interface BDSKEntrezGroupServer : NSObject <BDSKSearchGroupServer,
BDSKDownloadDelegate>
{
id<BDSKSearchGroup> group;
BDSKServerInfo *serverInfo;
Modified: trunk/bibdesk/BDSKEntrezGroupServer.m
===================================================================
--- trunk/bibdesk/BDSKEntrezGroupServer.m 2023-11-18 15:11:30 UTC (rev
28446)
+++ trunk/bibdesk/BDSKEntrezGroupServer.m 2023-11-18 22:53:41 UTC (rev
28447)
@@ -219,7 +219,7 @@
#pragma mark Downloading
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCompleteWithError:(NSError *)error
+- (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError
*)error
{
if (error) {
// calling -cancel may call this delegate method
@@ -313,7 +313,7 @@
// don't reset downloadState here, or we clobber the value that -fetch sets
}
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
return [group windowForSheetForObject:self];
}
Modified: trunk/bibdesk/BDSKItemDownload.h
===================================================================
--- trunk/bibdesk/BDSKItemDownload.h 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKItemDownload.h 2023-11-18 22:53:41 UTC (rev 28447)
@@ -43,7 +43,7 @@
@class BDSKLinkedFile;
-@interface BDSKItemDownload : NSObject <BDSKDownloaderDelegate> {
+@interface BDSKItemDownload : NSObject <BDSKDownloadDelegate> {
id <BDSKItemDownloadDelegate> delegate;
BDSKDownload *download;
BDSKLinkedFile *linkedFile;
Modified: trunk/bibdesk/BDSKItemDownload.m
===================================================================
--- trunk/bibdesk/BDSKItemDownload.m 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKItemDownload.m 2023-11-18 22:53:41 UTC (rev 28447)
@@ -102,9 +102,9 @@
return [download response];
}
-#pragma mark BDSKDownloaderDelegate
+#pragma mark BDSKDownloadDelegate
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler {
+- (void)download:(BDSKDownload *)aDownload
decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *destinationURL, BOOL
allowOverwrite))completionHandler {
NSURL *destURL = nil;
NSString *extension = [destinationName pathExtension];
NSString *downloadsDirectory = [[[NSUserDefaults standardUserDefaults]
stringForKey:BDSKDownloadsDirectoryKey] stringByExpandingTildeInPath];
@@ -130,22 +130,22 @@
completionHandler(destURL, NO);
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCreateDestination:(NSURL *)destinationURL {
+- (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL
*)destinationURL {
fileURL = [destinationURL retain];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveExpectedContentLength:(int64_t)expectedContentLength {
+- (void)download:(BDSKDownload *)aDownload
didReceiveExpectedContentLength:(int64_t)expectedContentLength {
expectedLength = expectedContentLength;
[[self delegate] itemDownloadDidStart:self];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveDataOfLength:(uint64_t)length {
+- (void)download:(BDSKDownload *)aDownload
didReceiveDataOfLength:(uint64_t)length {
receivedLength += length;
if (expectedLength > 0)
[[self delegate] itemDownloadDidUpdate:self];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCompleteWithError:(NSError *)error {
+- (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError
*)error {
if (error)
NSLog(@"Linked file download failed: %@", error);
BDSKDESTROY(download);
@@ -152,7 +152,7 @@
[[self delegate] itemDownloadDidFinish:self];
}
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
return [[self delegate] itemDownloadWindowForAuthenticationSheet:self];
}
Modified: trunk/bibdesk/BDSKSoapBinding.m
===================================================================
--- trunk/bibdesk/BDSKSoapBinding.m 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKSoapBinding.m 2023-11-18 22:53:41 UTC (rev 28447)
@@ -136,7 +136,7 @@
}
@end
-@interface BDSKSoapBindingOperation () <BDSKDownloaderDelegate>
+@interface BDSKSoapBindingOperation () <BDSKDownloadDelegate>
@end
@implementation BDSKSoapBindingOperation
@@ -192,7 +192,7 @@
{
[self.download cancel];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition,
NSURLCredential *))completionHandler
+- (void)download:(BDSKDownload *)aDownload
didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge
completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition,
NSURLCredential *))completionHandler
{
if ([challenge previousFailureCount] == 0 && self.binding.authUsername
&& self.binding.authPassword) {
NSURLCredential *newCredential;
@@ -208,7 +208,7 @@
[[BDSKAuthenticationHandler sharedHandler]
startAuthentication:challenge window:window
completionHandler:completionHandler];
}
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveExpectedContentLength:(int64_t)expectedContentLength {
+- (void)download:(BDSKDownload *)aDownload
didReceiveExpectedContentLength:(int64_t)expectedContentLength {
NSURLResponse *urlResponse = [download response];
NSHTTPURLResponse *httpResponse;
if ([urlResponse isKindOfClass:[NSHTTPURLResponse class]]) {
@@ -238,10 +238,10 @@
error = [NSError
errorWithDomain:@"BDSKSoapBindingResponseHTTP" code:1 userInfo:userInfo];
}
- [self downloader:downloader download:download
didCompleteWithError:error];
+ [self download:download didCompleteWithError:error];
}
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCompleteWithError:(NSError *)error
+- (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError
*)error
{
if (error) {
if (binding.logXMLInOut) {
Modified: trunk/bibdesk/BDSKTextImportController.h
===================================================================
--- trunk/bibdesk/BDSKTextImportController.h 2023-11-18 15:11:30 UTC (rev
28446)
+++ trunk/bibdesk/BDSKTextImportController.h 2023-11-18 22:53:41 UTC (rev
28447)
@@ -46,7 +46,7 @@
@class BibDocument, BibItem, BDSKEdgeView, WebDownload;
@class BDSKCiteKeyFormatter, BDSKTextImportItemTableView,
BDSKComplexStringFormatter;
-@interface BDSKTextImportController : NSWindowController <BDSKOwner,
BDSKTextImportItemTableViewDelegate, NSTableViewDataSource, NSTextViewDelegate,
NSSplitViewDelegate, BDSKCitationFormatterDelegate, BDSKWebViewDelegate,
BDSKDownloaderDelegate, NSTouchBarDelegate> {
+@interface BDSKTextImportController : NSWindowController <BDSKOwner,
BDSKTextImportItemTableViewDelegate, NSTableViewDataSource, NSTextViewDelegate,
NSSplitViewDelegate, BDSKCitationFormatterDelegate, BDSKWebViewDelegate,
BDSKDownloadDelegate, NSTouchBarDelegate> {
NSTextView *sourceTextView;
BDSKTextImportItemTableView *itemTableView;
NSTextField *citeKeyField;
Modified: trunk/bibdesk/BDSKTextImportController.m
===================================================================
--- trunk/bibdesk/BDSKTextImportController.m 2023-11-18 15:11:30 UTC (rev
28446)
+++ trunk/bibdesk/BDSKTextImportController.m 2023-11-18 22:53:41 UTC (rev
28447)
@@ -911,13 +911,13 @@
[forwardButton setEnabled:[webView canGoForward]];
}
-#pragma mark BDSKDownloaderDelegate methods
+#pragma mark BDSKDownloadDelegate methods
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveExpectedContentLength:(int64_t)length {
+- (void)download:(BDSKDownload *)aDownload
didReceiveExpectedContentLength:(int64_t)length {
expectedContentLength = length;
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveDataOfLength:(uint64_t)length {
+- (void)download:(BDSKDownload *)aDownload
didReceiveDataOfLength:(uint64_t)length {
if (expectedContentLength > 0) {
receivedContentLength += length;
NSInteger percent = round(100.0 * (double)receivedContentLength /
(double)expectedContentLength);
@@ -927,7 +927,7 @@
}
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *, BOOL))completionHandler {
+- (void)download:(BDSKDownload *)aDownload
decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *, BOOL))completionHandler {
NSString *extension = [destinationName pathExtension];
NSSavePanel *sPanel = [NSSavePanel savePanel];
@@ -946,12 +946,12 @@
}
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCreateDestination:(NSURL *)destinationURL {
+- (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL
*)destinationURL {
[downloadFileName release];
downloadFileName = [[destinationURL path] copy];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCompleteWithError:(NSError *)error {
+- (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError
*)error {
[self setDownloading:NO];
if (error == nil) {
[self setLocalUrlFromDownload];
@@ -970,7 +970,7 @@
}
}
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
return [self window];
}
Modified: trunk/bibdesk/BDSKURLGroup.h
===================================================================
--- trunk/bibdesk/BDSKURLGroup.h 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKURLGroup.h 2023-11-18 22:53:41 UTC (rev 28447)
@@ -41,7 +41,7 @@
#import "BDSKDownloader.h"
-@interface BDSKURLGroup : BDSKMutableExternalGroup <BDSKDownloaderDelegate>
+@interface BDSKURLGroup : BDSKMutableExternalGroup <BDSKDownloadDelegate>
{
NSURL *URL;
NSURL *fileURL;
Modified: trunk/bibdesk/BDSKURLGroup.m
===================================================================
--- trunk/bibdesk/BDSKURLGroup.m 2023-11-18 15:11:30 UTC (rev 28446)
+++ trunk/bibdesk/BDSKURLGroup.m 2023-11-18 22:53:41 UTC (rev 28447)
@@ -205,7 +205,7 @@
[error setValue:NSLocalizedString(@"The URL points to a file
that does not exist", @"Error description") forKey:NSLocalizedDescriptionKey];
[error setValue:[theURL path] forKey:NSFilePathErrorKey];
[download cancel];
- [self downloader:nil download:nil didCompleteWithError:error];
+ [self download:nil didCompleteWithError:error];
}
} else {
NSURLRequest *request = [NSURLRequest requestWithURL:theURL];
@@ -232,16 +232,16 @@
}
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *, BOOL))completionHandler {
+- (void)download:(BDSKDownload *)aDownload
decideDestinationWithSuggestedFilename:(NSString *)destinationName
completionHandler:(void (^)(NSURL *, BOOL))completionHandler {
completionHandler([[NSFileManager defaultManager]
temporaryFileURLWithBasename:destinationName], YES);
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCreateDestination:(NSURL *)destinationURL {
+- (void)download:(BDSKDownload *)aDownload didCreateDestination:(NSURL
*)destinationURL {
[fileURL autorelease];
fileURL = [destinationURL copy];
}
-- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didCompleteWithError:(NSError *)error
+- (void)download:(BDSKDownload *)aDownload didCompleteWithError:(NSError
*)error
{
if (error == nil) {
@@ -266,7 +266,7 @@
}
}
-- (NSWindow *)downloader:(BDSKDownloader *)downloader
downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
+- (NSWindow *)downloadWindowForAuthenticationSheet:(BDSKDownload *)download {
return [[self document] windowForSheet];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit