Revision: 7129
          http://skim-app.svn.sourceforge.net/skim-app/?rev=7129&view=rev
Author:   hofman
Date:     2011-02-25 12:41:53 +0000 (Fri, 25 Feb 2011)

Log Message:
-----------
delete trashed download in moveToTrash

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

Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m        2011-02-25 12:24:30 UTC (rev 7128)
+++ trunk/SKDownloadController.m        2011-02-25 12:41:53 UTC (rev 7129)
@@ -232,13 +232,16 @@
     NSInteger row = [tableView selectedRow];
     if (row != -1)
         download = [self objectInDownloadsAtIndex:row];
-    if (download && [download status] == SKDownloadStatusFinished) {
-        NSString *filePath = [download filePath];
-        NSString *folderPath = [filePath stringByDeletingLastPathComponent];
-        NSString *fileName = [filePath lastPathComponent];
-        NSInteger tag = 0;
-        
-        [[NSWorkspace sharedWorkspace] 
performFileOperation:NSWorkspaceRecycleOperation source:folderPath 
destination:nil files:[NSArray arrayWithObjects:fileName, nil] tag:&tag];
+    if ([download canRemove]) {
+        if ([download status] == SKDownloadStatusFinished) {
+            NSString *filePath = [download filePath];
+            NSString *folderPath = [filePath 
stringByDeletingLastPathComponent];
+            NSString *fileName = [filePath lastPathComponent];
+            NSInteger tag = 0;
+            
+            [[NSWorkspace sharedWorkspace] 
performFileOperation:NSWorkspaceRecycleOperation source:folderPath 
destination:nil files:[NSArray arrayWithObjects:fileName, nil] tag:&tag];
+        }
+        [[self mutableArrayValueForKey:DOWNLOADS_KEY] removeObject:download];
     } else {
         NSBeep();
     }
@@ -324,7 +327,7 @@
 - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
     if ([menuItem action] == @selector(moveToTrash:)) {
         NSInteger row = [tableView selectedRow];
-        return (row != -1 && [[self objectInDownloadsAtIndex:row] status] == 
SKDownloadStatusFinished);
+        return (row != -1 && [[self objectInDownloadsAtIndex:row] canRemove]);
     }
     return YES;
 }


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

------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Skim-app-commit mailing list
Skim-app-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to