Revision: 4560
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4560&view=rev
Author:   hofman
Date:     2008-09-05 13:45:57 +0000 (Fri, 05 Sep 2008)

Log Message:
-----------
Add a download delegate method. Ignore downloadDidUpdate, as this is updated 
through binding. Other changes only update the button cells.

Modified Paths:
--------------
    trunk/SKDownload.h
    trunk/SKDownload.m
    trunk/SKDownloadController.m

Modified: trunk/SKDownload.h
===================================================================
--- trunk/SKDownload.h  2008-09-05 13:37:32 UTC (rev 4559)
+++ trunk/SKDownload.h  2008-09-05 13:45:57 UTC (rev 4560)
@@ -100,6 +100,7 @@
 
 @interface NSObject (SKDownloadDelegate)
 - (void)downloadDidStart:(SKDownload *)download;
+- (void)downloadDidBeginDownloading:(SKDownload *)download;
 - (void)downloadDidUpdate:(SKDownload *)download;
 - (void)downloadDidEnd:(SKDownload *)download;
 @end

Modified: trunk/SKDownload.m
===================================================================
--- trunk/SKDownload.m  2008-09-05 13:37:32 UTC (rev 4559)
+++ trunk/SKDownload.m  2008-09-05 13:45:57 UTC (rev 4560)
@@ -249,8 +249,8 @@
     URLDownload = [[NSURLDownload alloc] initWithRequest:[NSURLRequest 
requestWithURL:URL] delegate:self];
     [URLDownload setDeletesFileUponFailure:NO];
     [self setStatus:SKDownloadStatusStarting];
-    if ([delegate respondsToSelector:@selector(downloadDidUpdate:)])
-        [delegate downloadDidUpdate:self];
+    if ([delegate respondsToSelector:@selector(downloadDidStart:)])
+        [delegate downloadDidStart:self];
 }
 
 - (void)cancel {
@@ -276,8 +276,8 @@
             URLDownload = [[NSURLDownload alloc] initWithResumeData:resumeData 
delegate:self path:[self filePath]];
             [URLDownload setDeletesFileUponFailure:NO];
             [self setStatus:SKDownloadStatusDownloading];
-            if ([delegate respondsToSelector:@selector(downloadDidUpdate:)])
-                [delegate downloadDidUpdate:self];
+            if ([delegate 
respondsToSelector:@selector(downloadDidBeginDownloading:)])
+                [delegate downloadDidBeginDownloading:self];
             
         } else {
             
@@ -313,8 +313,8 @@
 
 - (void)downloadDidBegin:(NSURLDownload *)download{
     [self setStatus:SKDownloadStatusDownloading];
-    if ([delegate respondsToSelector:@selector(downloadDidStart:)])
-        [delegate downloadDidStart:self];
+    if ([delegate respondsToSelector:@selector(downloadDidBeginDownloading:)])
+        [delegate downloadDidBeginDownloading:self];
 }
 
 - (void)download:(NSURLDownload *)download didReceiveResponse:(NSURLResponse 
*)response {

Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m        2008-09-05 13:37:32 UTC (rev 4559)
+++ trunk/SKDownloadController.m        2008-09-05 13:45:57 UTC (rev 4560)
@@ -46,6 +46,9 @@
 #import "NSString_SKExtensions.h"
 #import "NSMenu_SKExtensions.h"
 
+#define RESUME_COLUMN 2
+#define CANCEL_COLUMN 3
+
 static NSString *SKDownloadsWindowFrameAutosaveName = @"SKDownloadsWindow";
 
 static NSString *SKDownloadControllerDownloadsKey = @"downloads";
@@ -244,13 +247,16 @@
 #pragma mark SKDownloadDelegate
 
 - (void)downloadDidUpdate:(SKDownload *)download {
+}
+
+- (void)downloadDidStart:(SKDownload *)download {
     unsigned int row = [downloads indexOfObject:download];
     if (row != NSNotFound)
-        [tableView setNeedsDisplayInRect:[tableView rectOfRow:row]];
+        [tableView setNeedsDisplayInRect:NSUnionRect([tableView 
frameOfCellAtColumn:RESUME_COLUMN row:row], [tableView 
frameOfCellAtColumn:CANCEL_COLUMN row:row])];
 }
 
-- (void)downloadDidStart:(SKDownload *)download {
-    [self downloadDidUpdate:download];
+- (void)downloadDidBeginDownloading:(SKDownload *)download {
+    [self downloadDidStart:download];
 }
 
 - (void)downloadDidEnd:(SKDownload *)download {
@@ -269,10 +275,10 @@
             if ([self countOfDownloads] == 0 && [[NSUserDefaults 
standardUserDefaults] boolForKey:SKAutoCloseDownloadsWindowKey])
                 [[self window] close];
         } else {
-            [self downloadDidUpdate:download];
+            [self downloadDidStart:download];
         }
     } else {
-        [self downloadDidUpdate:download];
+        [self downloadDidStart:download];
     }
 }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to