Fixing bug 298446, cmd-period does not cancel downloads, camino only. r=mento, sr=pinkerton

This commit is contained in:
nick.kreeger%park.edu 2006-06-14 22:40:29 +00:00
Родитель c338703b3d
Коммит 6e10c7ba25
3 изменённых файлов: 19 добавлений и 1 удалений

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

@ -126,7 +126,9 @@ static id gSharedProgressController = nil;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(DLInstanceOpened:)
name:kDownloadInstanceOpenedNotificationName
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cancel:)
name:kDownloadInstanceCancelledNotificationName
object:nil];
}
return self;
}

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

@ -42,6 +42,7 @@
extern NSString* const kDownloadInstanceSelectedNotificationName;
extern NSString* const kDownloadInstanceOpenedNotificationName;
extern NSString* const kDownloadInstanceCancelledNotificationName;
//
// interface ProgressView

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

@ -42,6 +42,7 @@
NSString* const kDownloadInstanceSelectedNotificationName = @"DownloadInstanceSelected";
NSString* const kDownloadInstanceOpenedNotificationName = @"DownloadInstanceOpened";
NSString* const kDownloadInstanceCancelledNotificationName = @"DownloadInstanceCancelled";
@interface ProgressView(Private)
@ -147,6 +148,20 @@ NSString* const kDownloadInstanceOpenedNotificationName = @"DownloadInstanceOp
return [[self getController] contextualMenu];
}
-(BOOL)performKeyEquivalent:(NSEvent*)theEvent
{
// Catch a command-period key down event and send the cancel request
if (([theEvent type] == NSKeyDown &&
([theEvent modifierFlags] & NSCommandKeyMask) != 0) &&
[[theEvent characters] isEqualToString:@"."])
{
[[NSNotificationCenter defaultCenter] postNotificationName:kDownloadInstanceCancelledNotificationName object:self];
return YES;
}
return [super performKeyEquivalent:theEvent];
}
-(NSView*)hitTest:(NSPoint)aPoint
{
if (NSMouseInRect(aPoint, [self frame], YES)) {