230320 Add Move to Trash command and Delete button to Downloads window. Patch by Bruce Davidson <mozilla@transoceanic.org.uk>. Icon by Jasper Hauser <camino@jasperhauser.nl>. Thanks also to Nick Kreeger <nick.kreeger@park.edu> and Ludovic Hirlimann <qa-mozilla@hirlimann.net>. Project file kicked by the usual suspect. r=kreeger sr=pink
This commit is contained in:
Родитель
5037e0a35a
Коммит
d9cdfc8587
|
@ -3589,6 +3589,20 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
34D112DD08E9B17400989FD5 = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = image.tiff;
|
||||
name = dl_trash.tif;
|
||||
path = resources/images/toolbar/dl_trash.tif;
|
||||
refType = 2;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
34D112DE08E9B17400989FD5 = {
|
||||
fileRef = 34D112DD08E9B17400989FD5;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
//340
|
||||
//341
|
||||
//342
|
||||
|
@ -4689,6 +4703,7 @@
|
|||
0FBB8CC808D260D800D58D8D,
|
||||
0FBB8CC908D260D800D58D8D,
|
||||
0FBB8CCA08D260D800D58D8D,
|
||||
34D112DE08E9B17400989FD5,
|
||||
0F01117408F2FE7C00423C02,
|
||||
0FEA7E650926BFC600B06154,
|
||||
0F8FC52F092ED71C0042429E,
|
||||
|
@ -8623,6 +8638,7 @@
|
|||
0F01117508F2FE7C00423C02,
|
||||
0FEA7E660926BFC600B06154,
|
||||
0F8FC52E092ED71C0042429E,
|
||||
4DD988E708EB7D3700AD0788,
|
||||
);
|
||||
isa = PBXResourcesBuildPhase;
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -13083,6 +13099,12 @@
|
|||
settings = {
|
||||
};
|
||||
};
|
||||
4DD988E708EB7D3700AD0788 = {
|
||||
fileRef = 34D112DD08E9B17400989FD5;
|
||||
isa = PBXBuildFile;
|
||||
settings = {
|
||||
};
|
||||
};
|
||||
//790
|
||||
//791
|
||||
//792
|
||||
|
@ -15257,6 +15279,7 @@
|
|||
};
|
||||
F5264FCB020D4C25010001CA = {
|
||||
children = (
|
||||
34D112DD08E9B17400989FD5,
|
||||
3FC0FB8305A0D2F4002F47DE,
|
||||
3FC0FB8405A0D2F4002F47DE,
|
||||
3FC0FB8505A0D2F4002F47DE,
|
||||
|
|
Двоичные данные
camino/resources/localized/English.lproj/Localizable.strings
Двоичные данные
camino/resources/localized/English.lproj/Localizable.strings
Двоичный файл не отображается.
|
@ -23,6 +23,7 @@
|
|||
* Calum Robinson <calumr@mac.com>
|
||||
* Josh Aas <josha@mac.com>
|
||||
* Nick Kreeger <nick.kreeger@park.edu>
|
||||
* Bruce Davidson <mozilla@transoceanic.org.uk>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -55,6 +56,7 @@ static NSString* const kProgressWindowFrameSaveName = @"ProgressWindow";
|
|||
-(void)showErrorSheetForDownload:(id <CHDownloadProgressDisplay>)progressDisplay withStatus:(nsresult)inStatus;
|
||||
-(void)rebuildViews;
|
||||
-(NSArray*)selectedProgressViewControllers;
|
||||
-(ProgressViewController*)progressViewControllerAtIndex:(unsigned)inIndex;
|
||||
-(void)deselectDLInstancesInArray:(NSArray*)instances;
|
||||
-(void)scrollIntoView:(ProgressViewController*)controller;
|
||||
-(void)killDownloadTimer;
|
||||
|
@ -167,8 +169,10 @@ static id gSharedProgressController = nil;
|
|||
[[self selectedProgressViewControllers] makeObjectsPerformSelector:@selector(open:) withObject:sender];
|
||||
}
|
||||
|
||||
// remove all selected instances, don't remove anything that is active as a guard against bad things
|
||||
-(IBAction)remove:(id)sender
|
||||
//
|
||||
// Take care of selecting a download instance to replace the selection being removed
|
||||
//
|
||||
-(void)setSelectionForRemovalOfItems:(NSArray*) selectionToRemove
|
||||
{
|
||||
// take care of selecting a download instance to replace the selection being removed
|
||||
NSArray* selected = [self selectedProgressViewControllers];
|
||||
|
@ -192,7 +196,17 @@ static id gSharedProgressController = nil;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
mSelectionPivotIndex = -1; // nothing is selected any more so nothing to pivot on
|
||||
}
|
||||
|
||||
// remove all selected instances, don't remove anything that is active as a guard against bad things
|
||||
-(IBAction)remove:(id)sender
|
||||
{
|
||||
NSArray* selected = [self selectedProgressViewControllers];
|
||||
unsigned int selectedCount = [selected count];
|
||||
|
||||
[self setSelectionForRemovalOfItems:selected];
|
||||
|
||||
// now remove stuff
|
||||
for (unsigned int i = 0; i < selectedCount; i++)
|
||||
|
@ -206,6 +220,24 @@ static id gSharedProgressController = nil;
|
|||
[self saveProgressViewControllers];
|
||||
}
|
||||
|
||||
// delete the selected download(s), moving files to trash and clearing them from the list
|
||||
-(IBAction)deleteDownloads:(id)sender
|
||||
{
|
||||
NSArray* selected = [self selectedProgressViewControllers];
|
||||
unsigned int selectedCount = [selected count];
|
||||
|
||||
[self setSelectionForRemovalOfItems:selected];
|
||||
|
||||
// now remove stuff, don't need to check if active, the toolbar/menu validates
|
||||
for (unsigned int i = 0; i < selectedCount; i++) {
|
||||
[[selected objectAtIndex:i] deleteFile:sender];
|
||||
[self removeDownload:[selected objectAtIndex:i]];
|
||||
}
|
||||
|
||||
[self rebuildViews];
|
||||
[self saveProgressViewControllers];
|
||||
}
|
||||
|
||||
-(IBAction)pause:(id)sender
|
||||
{
|
||||
[[self selectedProgressViewControllers] makeObjectsPerformSelector:@selector(pause:) withObject:sender];
|
||||
|
@ -465,6 +497,11 @@ static id gSharedProgressController = nil;
|
|||
return selectedArray;
|
||||
}
|
||||
|
||||
-(ProgressViewController*)progressViewControllerAtIndex:(unsigned)inIndex
|
||||
{
|
||||
return (ProgressViewController*) [mProgressViewControllers objectAtIndex:inIndex];
|
||||
}
|
||||
|
||||
-(void)scrollIntoView:(ProgressViewController*)controller
|
||||
{
|
||||
NSView* dlView = [controller view];
|
||||
|
@ -784,6 +821,19 @@ static id gSharedProgressController = nil;
|
|||
return [[self window] isKeyWindow];
|
||||
}
|
||||
|
||||
-(BOOL)shouldAllowMoveToTrashAction
|
||||
{
|
||||
NSEnumerator* progViewEnum = [[self selectedProgressViewControllers] objectEnumerator];
|
||||
ProgressViewController* curController;
|
||||
while ((curController = [progViewEnum nextObject]))
|
||||
{
|
||||
if ([curController isActive] || ![curController fileExists]) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(BOOL)fileExistsForSelectedItems
|
||||
{
|
||||
NSEnumerator* progViewEnum = [[self selectedProgressViewControllers] objectEnumerator];
|
||||
|
@ -857,6 +907,9 @@ static id gSharedProgressController = nil;
|
|||
else if (action == @selector(resume:)) {
|
||||
return [self shouldAllowResumeAction];
|
||||
}
|
||||
else if (action == @selector(deleteDownloads:)) {
|
||||
return [self shouldAllowMoveToTrashAction];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
@ -974,6 +1027,13 @@ static id gSharedProgressController = nil;
|
|||
[theItem setAction:@selector(cleanUpDownloads:)];
|
||||
[theItem setImage:[NSImage imageNamed:@"dl_clearall.tif"]];
|
||||
}
|
||||
else if ([itemIdentifier isEqualToString:@"movetotrashbutton"]) {
|
||||
[theItem setToolTip:NSLocalizedString(@"dlTrashButtonTooltip", nil)];
|
||||
[theItem setLabel:NSLocalizedString(@"dlTrashButtonLabel", nil)];
|
||||
[theItem setPaletteLabel:NSLocalizedString(@"dlTrashButtonLabel", nil)];
|
||||
[theItem setAction:@selector(deleteDownloads:)];
|
||||
[theItem setImage:[NSImage imageNamed:@"dl_trash.tif"]];
|
||||
}
|
||||
else if ([itemIdentifier isEqualToString:@"pauseresumebutton"]) {
|
||||
[self setPauseResumeToolbarItem:theItem];
|
||||
}
|
||||
|
@ -985,7 +1045,7 @@ static id gSharedProgressController = nil;
|
|||
|
||||
-(NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
|
||||
{
|
||||
return [NSArray arrayWithObjects:@"cleanupbutton", @"removebutton", @"cancelbutton", @"pauseresumebutton", @"openbutton", @"revealbutton", NSToolbarFlexibleSpaceItemIdentifier, nil];
|
||||
return [NSArray arrayWithObjects:@"cleanupbutton", @"removebutton", @"cancelbutton", @"pauseresumebutton", @"openbutton", @"revealbutton", @"movetotrashbutton", NSToolbarFlexibleSpaceItemIdentifier, nil];
|
||||
}
|
||||
|
||||
-(NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Simon Fraser <sfraser@netscape.com>
|
||||
* Josh Aas <josha@mac.com>
|
||||
* Nick Kreeger <nick.kreeger@park.edu>
|
||||
* Bruce Davidson <mozilla@transoceanic.org.uk>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -106,18 +107,19 @@ enum {
|
|||
-(IBAction)remove:(id)sender;
|
||||
-(IBAction)reveal:(id)sender;
|
||||
-(IBAction)open:(id)sender;
|
||||
-(IBAction)deleteFile:(id)sender;
|
||||
-(IBAction)pause:(id)sender;
|
||||
-(IBAction)resume:(id)sender;
|
||||
|
||||
-(BOOL)isActive;
|
||||
-(BOOL)isCanceled;
|
||||
-(BOOL)isSelected;
|
||||
-(BOOL)isPaused;
|
||||
-(BOOL)fileExists;
|
||||
|
||||
-(BOOL)isSelected;
|
||||
-(void)setSelected:(BOOL)inSelected;
|
||||
|
||||
-(void)checkFileExists;
|
||||
-(void)setSelected:(BOOL)inSelected;
|
||||
|
||||
-(NSDictionary*)downloadInfoDictionary;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
* Simon Fraser <sfraser@netscape.com>
|
||||
* Josh Aas <josha@mac.com>
|
||||
* Nick Kreeger <nick.kreeger@park.edu>
|
||||
* Bruce Davidson <mozilla@transoceanic.org.uk>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -351,6 +352,19 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
[self refreshDownloadInfo];
|
||||
}
|
||||
|
||||
// Delete the file we downloaded and remove this item from the list
|
||||
-(IBAction)deleteFile:(id)sender
|
||||
{
|
||||
NSString* fileName = [mDestPath lastPathComponent];
|
||||
NSString* path = [mDestPath stringByDeletingLastPathComponent];
|
||||
|
||||
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation
|
||||
source:path
|
||||
destination:@""
|
||||
files:[NSArray arrayWithObject:fileName]
|
||||
tag:nil];
|
||||
}
|
||||
|
||||
-(void)downloadDidEnd
|
||||
{
|
||||
if (!mDownloadDone) { // some error conditions can cause this to get called twice
|
||||
|
@ -570,6 +584,7 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
NSMenuItem *removeItem;
|
||||
NSMenuItem *pauseResumeItem; // alternates pause and resume
|
||||
NSMenuItem *openItem;
|
||||
NSMenuItem *deleteItem;
|
||||
NSMenuItem *copySourceURLItem;
|
||||
|
||||
revealItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"dlRevealCMLabel", nil)
|
||||
|
@ -588,6 +603,8 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
action:@selector(remove:) keyEquivalent:@""];
|
||||
openItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"dlOpenCMLabel", nil)
|
||||
action:@selector(open:) keyEquivalent:@""];
|
||||
deleteItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"dlTrashCMLabel", nil)
|
||||
action:@selector(deleteDownloads:) keyEquivalent:@""];
|
||||
copySourceURLItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"dlCopySourceURLCMLabel", nil)
|
||||
action:@selector(copySourceURL:) keyEquivalent:@""];
|
||||
[revealItem setTarget:mProgressWindowController];
|
||||
|
@ -595,6 +612,7 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
[pauseResumeItem setTarget:mProgressWindowController];
|
||||
[removeItem setTarget:mProgressWindowController];
|
||||
[openItem setTarget:mProgressWindowController];
|
||||
[deleteItem setTarget:mProgressWindowController];
|
||||
[copySourceURLItem setTarget:self];
|
||||
|
||||
[menu addItem:revealItem];
|
||||
|
@ -602,6 +620,7 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
[menu addItem:pauseResumeItem];
|
||||
[menu addItem:removeItem];
|
||||
[menu addItem:openItem];
|
||||
[menu addItem:deleteItem];
|
||||
[menu addItem:[NSMenuItem separatorItem]];
|
||||
[menu addItem:copySourceURLItem];
|
||||
|
||||
|
@ -610,6 +629,7 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
[pauseResumeItem release];
|
||||
[removeItem release];
|
||||
[openItem release];
|
||||
[deleteItem release];
|
||||
[copySourceURLItem release];
|
||||
|
||||
return [menu autorelease];
|
||||
|
@ -621,7 +641,7 @@ static void FileSystemNotificationProc(FNMessage message, OptionBits flags, void
|
|||
if (action == @selector(cancel:)) {
|
||||
return ((!mUserCancelled) && (!mDownloadDone));
|
||||
}
|
||||
if (action == @selector(remove:)) {
|
||||
if (action == @selector(remove:) || action == @selector(deleteDownloads:)) {
|
||||
return (mUserCancelled || mDownloadDone);
|
||||
}
|
||||
return YES;
|
||||
|
|
Загрузка…
Ссылка в новой задаче