Revision: 23968
http://sourceforge.net/p/bibdesk/svn/23968
Author: hofman
Date: 2019-07-07 22:17:13 +0000 (Sun, 07 Jul 2019)
Log Message:
-----------
don't pass progress and fileURL in delegate method for download, get it from
properties
Modified Paths:
--------------
trunk/bibdesk/BDSKItemDownload.h
trunk/bibdesk/BDSKItemDownload.m
trunk/bibdesk/BibItem.m
Modified: trunk/bibdesk/BDSKItemDownload.h
===================================================================
--- trunk/bibdesk/BDSKItemDownload.h 2019-07-07 22:11:11 UTC (rev 23967)
+++ trunk/bibdesk/BDSKItemDownload.h 2019-07-07 22:17:13 UTC (rev 23968)
@@ -60,6 +60,7 @@
@property (nonatomic) NSUInteger index;
@property (nonatomic, readonly) BOOL replace;
@property (nonatomic, readonly) double progress;
+@property (nonatomic, readonly) NSURL *fileURL;
- (id)initWithLinkedFile:(BDSKLinkedFile *)aLinkedFile
atIndex:(NSUInteger)anIndex replace:(BOOL)aReplace;
- (id)initWithURL:(NSURL *)aURL;
@@ -71,8 +72,8 @@
@protocol BDSKItemDownloadDelegate <NSObject>
-- (void)itemDownload:(BDSKItemDownload *)download
updateWithProgress:(double)progress;
-- (void)itemDownload:(BDSKItemDownload *)download didFinishWithURL:(NSURL
*)fileURL;
+- (void)itemDownloadDidUpdate:(BDSKItemDownload *)download;
+- (void)itemDownloadDidFinish:(BDSKItemDownload *)download;
@end
Modified: trunk/bibdesk/BDSKItemDownload.m
===================================================================
--- trunk/bibdesk/BDSKItemDownload.m 2019-07-07 22:11:11 UTC (rev 23967)
+++ trunk/bibdesk/BDSKItemDownload.m 2019-07-07 22:17:13 UTC (rev 23968)
@@ -43,7 +43,7 @@
@implementation BDSKItemDownload
-@synthesize delegate, linkedFile, URL, index, replace;
+@synthesize delegate, linkedFile, URL, index, replace, fileURL;
@dynamic progress;
- (id)initWithURL:(NSURL *)aURL {
@@ -132,23 +132,23 @@
- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveExpectedContentLength:(int64_t)expectedContentLength {
expectedLength = expectedContentLength;
- [[self delegate] itemDownload:self updateWithProgress:[self progress]];
+ [[self delegate] itemDownloadDidUpdate:self];
}
- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didReceiveDataOfLength:(uint64_t)length {
receivedLength += length;
if (expectedLength > 0)
- [[self delegate] itemDownload:self updateWithProgress:[self progress]];
+ [[self delegate] itemDownloadDidUpdate:self];
}
- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didFinishWithData:(NSData *)data {
BDSKDESTROY(download);
- [[self delegate] itemDownload:self didFinishWithURL:fileURL];
+ [[self delegate] itemDownloadDidFinish:self];
}
- (void)downloader:(BDSKDownloader *)downloader download:(BDSKDownload
*)aDownload didFailWithError:(NSError *)error {
BDSKDESTROY(download);
- [[self delegate] itemDownload:self didFinishWithURL:nil];
+ [[self delegate] itemDownloadDidFinish:self];
}
@end
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2019-07-07 22:11:11 UTC (rev 23967)
+++ trunk/bibdesk/BibItem.m 2019-07-07 22:17:13 UTC (rev 23968)
@@ -3191,14 +3191,15 @@
- (NSArray *)downloads { return downloads; }
-- (void)itemDownload:(BDSKItemDownload *)download
updateWithProgress:(double)progress {
+- (void)itemDownloadDidUpdate:(BDSKItemDownload *)download {
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:download
forKey:BDSKItemDownloadKey];
[[NSNotificationCenter defaultCenter]
postNotificationName:BDSKItemDownloadUpdatedNotification object:self
userInfo:userInfo];
}
-- (void)itemDownload:(BDSKItemDownload *)download didFinishWithURL:(NSURL
*)fileURL {
+- (void)itemDownloadDidFinish:(BDSKItemDownload *)download {
NSUInteger idx = [download index];
BOOL replace = [download replace];
+ NSURL *fileURL = [download fileURL];
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:download
forKey:BDSKItemDownloadKey];
// download is retained by userInfo
[downloads removeObject:download];
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