Changeset 537 for trunk/Cocoa/Pester


Ignore:
Timestamp:
06/08/09 05:26:54 (15 years ago)
Author:
Nicholas Riley
Message:

NJRQTMediaPopUpButton.m: Don't allow selection of files QTKit can't open.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source/NJRQTMediaPopUpButton.m

    r535 r537  
    454454    [openPanel setCanChooseDirectories: NO];
    455455    [openPanel setCanChooseFiles: YES];
     456    [openPanel setDelegate: self];
    456457    [openPanel beginSheetForDirectory: [path stringByDeletingLastPathComponent]
    457458                                 file: [path lastPathComponent]
    458                                 types: nil // XXX fix for QuickTime!
     459                                types: nil
    459460                       modalForWindow: [self window]
    460461                        modalDelegate: self
     
    506507        [super drawRect: rect];
    507508    }
     509}
     510
     511@end
     512
     513@implementation NJRQTMediaPopUpButton (NSSavePanelDelegate)
     514
     515- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
     516{
     517    BOOL isDir = NO;
     518    [[NSFileManager defaultManager] fileExistsAtPath: filename isDirectory: &isDir];
     519
     520    if (isDir)
     521        return YES;
     522
     523    return [QTMovie canInitWithFile: filename];
    508524}
    509525
Note: See TracChangeset for help on using the changeset viewer.