Revision: 4555
http://skim-app.svn.sourceforge.net/skim-app/?rev=4555&view=rev
Author: hofman
Date: 2008-09-05 12:00:37 +0000 (Fri, 05 Sep 2008)
Log Message:
-----------
Redo binding of enabled of download Clear button, using a more convenient key.
Did not work before because I misspelled initialize.
Modified Paths:
--------------
trunk/Dutch.lproj/DownloadsWindow.nib/keyedobjects.nib
trunk/English.lproj/DownloadsWindow.nib/classes.nib
trunk/English.lproj/DownloadsWindow.nib/info.nib
trunk/English.lproj/DownloadsWindow.nib/keyedobjects.nib
trunk/German.lproj/DownloadsWindow.nib/keyedobjects.nib
trunk/Italian.lproj/DownloadsWindow.nib/keyedobjects.nib
trunk/SKDownload.h
trunk/SKDownload.m
trunk/SKDownloadController.m
Modified: trunk/English.lproj/DownloadsWindow.nib/classes.nib
===================================================================
--- trunk/English.lproj/DownloadsWindow.nib/classes.nib 2008-09-05 09:43:30 UTC
(rev 4554)
+++ trunk/English.lproj/DownloadsWindow.nib/classes.nib 2008-09-05 12:00:37 UTC
(rev 4555)
@@ -22,19 +22,19 @@
</dict>
<dict>
<key>CLASS</key>
- <string>NSMenu</string>
+ <string>NSWindowController</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSObject</string>
+ <string>NSResponder</string>
</dict>
<dict>
<key>CLASS</key>
- <string>NSWindowController</string>
+ <string>NSMenu</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
- <string>NSResponder</string>
+ <string>NSObject</string>
</dict>
<dict>
<key>ACTIONS</key>
Modified: trunk/English.lproj/DownloadsWindow.nib/info.nib
===================================================================
--- trunk/English.lproj/DownloadsWindow.nib/info.nib 2008-09-05 09:43:30 UTC
(rev 4554)
+++ trunk/English.lproj/DownloadsWindow.nib/info.nib 2008-09-05 12:00:37 UTC
(rev 4555)
@@ -10,8 +10,8 @@
<integer>5</integer>
<key>IBOpenObjects</key>
<array>
+ <integer>30</integer>
<integer>27</integer>
- <integer>30</integer>
</array>
<key>IBSystem Version</key>
<string>9E17</string>
Modified: trunk/SKDownload.h
===================================================================
--- trunk/SKDownload.h 2008-09-05 09:43:30 UTC (rev 4554)
+++ trunk/SKDownload.h 2008-09-05 12:00:37 UTC (rev 4555)
@@ -90,6 +90,7 @@
- (void)cleanup;
- (BOOL)canCancel;
+- (BOOL)canRemove;
- (BOOL)canResume;
- (void)removeProgressIndicatorFromSuperview;
Modified: trunk/SKDownload.m
===================================================================
--- trunk/SKDownload.m 2008-09-05 09:43:30 UTC (rev 4554)
+++ trunk/SKDownload.m 2008-09-05 12:00:37 UTC (rev 4555)
@@ -60,10 +60,11 @@
return [NSArray arrayWithObjects:SKDownloadFileNameKey,
SKDownloadStatusKey, SKDownloadProgressIndicatorKey, nil];
}
-+ (void)intialize {
++ (void)initialize {
[self setKeys:[NSArray arrayWithObjects:@"filePath", nil]
triggerChangeNotificationsForDependentKey:@"fileName"];
[self setKeys:[NSArray arrayWithObjects:@"filePath", nil]
triggerChangeNotificationsForDependentKey:@"fileIcon"];
[self setKeys:[NSArray arrayWithObjects:SKDownloadStatusKey, nil]
triggerChangeNotificationsForDependentKey:@"canCancel"];
+ [self setKeys:[NSArray arrayWithObjects:SKDownloadStatusKey, nil]
triggerChangeNotificationsForDependentKey:@"canRemove"];
[self setKeys:[NSArray arrayWithObjects:SKDownloadStatusKey, nil]
triggerChangeNotificationsForDependentKey:@"canResume"];
[self setKeys:[self infoKeys]
triggerChangeNotificationsForDependentKey:@"info"];
OBINITIALIZE;
@@ -293,6 +294,10 @@
return [self status] == SKDownloadStatusStarting || [self status] ==
SKDownloadStatusDownloading;
}
+- (BOOL)canRemove {
+ return [self status] == SKDownloadStatusFinished || [self status] ==
SKDownloadStatusFailed || [self status] == SKDownloadStatusCanceled;
+}
+
- (BOOL)canResume {
return ([self status] == SKDownloadStatusCanceled || [self status] ==
SKDownloadStatusFailed) && [self URL];
}
Modified: trunk/SKDownloadController.m
===================================================================
--- trunk/SKDownloadController.m 2008-09-05 09:43:30 UTC (rev 4554)
+++ trunk/SKDownloadController.m 2008-09-05 12:00:37 UTC (rev 4555)
@@ -85,15 +85,9 @@
- (unsigned)retainCount { return UINT_MAX; }
-- (void)updateClearButton {
- [clearButton setEnabled:[downloads count] > 0 && [[downloads
valueForKeyPath:@"@min.canCancel"] boolValue] == NO];
-}
-
- (void)windowDidLoad {
[self setWindowFrameAutosaveName:SKDownloadsWindowFrameAutosaveName];
- [self updateClearButton];
-
SKTypeSelectHelper *typeSelectHelper = [[[SKTypeSelectHelper alloc] init]
autorelease];
[typeSelectHelper setDataSource:self];
[tableView setTypeSelectHelper:typeSelectHelper];
@@ -253,7 +247,6 @@
unsigned int row = [downloads indexOfObject:download];
if (row != NSNotFound)
[tableView setNeedsDisplayInRect:[tableView rectOfRow:row]];
- [self updateClearButton];
}
- (void)downloadDidStart:(SKDownload *)download {
@@ -325,10 +318,14 @@
[cell setImage:[NSImage imageNamed:@"Cancel"]];
[cell setAction:@selector(cancelDownload:)];
[cell setTarget:self];
- } else {
+ } else if ([download canRemove]) {
[cell setImage:[NSImage imageNamed:@"Delete"]];
[cell setAction:@selector(removeDownload:)];
[cell setTarget:self];
+ } else {
+ [cell setImage:nil];
+ [cell setAction:NULL];
+ [cell setTarget:nil];
}
} else if ([identifier
isEqualToString:SKDownloadsWindowResumeColumnIdentifier]) {
if ([download canResume]) {
@@ -348,7 +345,7 @@
if ([[tableColumn identifier]
isEqualToString:SKDownloadsWindowCancelColumnIdentifier]) {
if ([[self objectInDownloadsAtIndex:row] canCancel])
toolTip = NSLocalizedString(@"Cancel download", @"Tool tip
message");
- else
+ else if ([[self objectInDownloadsAtIndex:row] canRemove])
toolTip = NSLocalizedString(@"Remove download", @"Tool tip
message");
} else if ([[tableColumn identifier]
isEqualToString:SKDownloadsWindowResumeColumnIdentifier]) {
if ([[self objectInDownloadsAtIndex:row] canResume])
@@ -363,7 +360,7 @@
if ([download canCancel])
[download cancel];
- else
+ else if ([download canRemove])
[self removeObjectFromDownloadsAtIndex:row];
}
@@ -381,7 +378,7 @@
if ([download canCancel]) {
menuItem = [menu addItemWithTitle:NSLocalizedString(@"Cancel", @"Menu
item title") action:@selector(cancelDownload:) target:self];
[menuItem setRepresentedObject:download];
- } else {
+ } else if ([download canRemove]) {
menuItem = [menu addItemWithTitle:NSLocalizedString(@"Remove", @"Menu
item title") action:@selector(removeDownload:) target:self];
[menuItem setRepresentedObject: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