Fix bug 290375: if option key is down when a download completes, and you have the dl manager set to auto-hide, then all windows get closed. Fixed by using -close rather than -performClose: (and moving the code where it belongs).

This commit is contained in:
smfr%smfr.org 2005-06-17 00:26:21 +00:00
Родитель 687eab8c8c
Коммит bbbc853e99
3 изменённых файлов: 17 добавлений и 14 удалений

Просмотреть файл

@ -100,7 +100,7 @@
-(int)numDownloadsInProgress;
-(void)clearAllDownloads;
-(void)didStartDownload:(id <CHDownloadProgressDisplay>)progressDisplay;
-(void)didEndDownload:(id <CHDownloadProgressDisplay>)progressDisplay;
-(void)didEndDownload:(id <CHDownloadProgressDisplay>)progressDisplay withSuccess:(BOOL)completedOK;
-(void)removeDownload:(id <CHDownloadProgressDisplay>)progressDisplay;
-(NSApplicationTerminateReply)allowTerminate;

Просмотреть файл

@ -434,10 +434,22 @@ static id gSharedProgressController = nil;
[self makeDLInstanceVisibleIfItsNotAlready:progressDisplay];
}
-(void)didEndDownload:(id <CHDownloadProgressDisplay>)progressDisplay
-(void)didEndDownload:(id <CHDownloadProgressDisplay>)progressDisplay withSuccess:(BOOL)completedOK
{
[self rebuildViews]; // to swap in the completed view
[[[self window] toolbar] validateVisibleItems]; // force update which doesn't always happen
// close the window if user has set pref to close when all downloads complete
if (completedOK)
{
BOOL gotPref;
BOOL keepDownloadsOpen = [[PreferenceManager sharedInstance] getBooleanPref:"browser.download.progressDnldDialog.keepAlive" withSuccess:&gotPref];
if (!keepDownloadsOpen && ([self numDownloadsInProgress] == 0))
{
[self close]; // don't call -performClose: on the window, because we don't want Cocoa to look
// for the option key and try to close all windows
}
}
}
-(void)removeDownload:(id <CHDownloadProgressDisplay>)progressDisplay
@ -579,7 +591,8 @@ static id gSharedProgressController = nil;
return TRUE;
}
-(BOOL)validateMenuItem:(id <NSMenuItem>)menuItem {
-(BOOL)validateMenuItem:(id <NSMenuItem>)menuItem
{
SEL action = [menuItem action];
if (action == @selector(cancel:)) {
return [self shouldAllowCancelAction];

Просмотреть файл

@ -444,18 +444,8 @@ enum {
{
mDownloadingError = !completedOK;
// close the window if user has set pref to close when all downloads complete
if (completedOK) {
BOOL gotPref;
// from the UI, this download is still going so close if we're the only one left
if (![[PreferenceManager sharedInstance] getBooleanPref:"browser.download.progressDnldDialog.keepAlive" withSuccess:&gotPref] &&
([mProgressWindowController numDownloadsInProgress] == 1)) {
[[mProgressWindowController window] performClose:self];
}
}
[self downloadDidEnd];
[mProgressWindowController didEndDownload:self];
[mProgressWindowController didEndDownload:self withSuccess:completedOK];
}
-(void)setProgressTo:(long long)aCurProgress ofMax:(long long)aMaxProgress