diff options
| author | Manolo Gouy <Manolo> | 2014-09-16 17:34:29 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2014-09-16 17:34:29 +0000 |
| commit | 9dae6e96b2db941ef4d617d71173e72124fd3aa5 (patch) | |
| tree | 3e012b7331d287c2baec3ee974abff565562404d /src | |
| parent | 5ceae63ed2cb1ecc7e15a414beb3555b898f7c24 (diff) | |
Implemented panel:shouldEnableURL: for the open dialog delegate.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10317 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Native_File_Chooser_MAC.mm | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Fl_Native_File_Chooser_MAC.mm b/src/Fl_Native_File_Chooser_MAC.mm index 1c2a874b4..52cf98a25 100644 --- a/src/Fl_Native_File_Chooser_MAC.mm +++ b/src/Fl_Native_File_Chooser_MAC.mm @@ -411,6 +411,7 @@ static char *prepareMacFilter(int count, const char *filter, char **patterns) { } - (FLopenDelegate*)setPopup:(NSPopUpButton*)popup filter_pattern:(char**)pattern; - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename; +- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url; @end @implementation FLopenDelegate - (FLopenDelegate*)setPopup:(NSPopUpButton*)popup filter_pattern:(char**)pattern @@ -422,11 +423,16 @@ static char *prepareMacFilter(int count, const char *filter, char **patterns) { - (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename { if ( [nspopup indexOfSelectedItem] == [nspopup numberOfItems] - 1) return YES; - const char *pathname = [filename fileSystemRepresentation]; - if ( fl_filename_isdir(pathname) ) return YES; - if ( fl_filename_match(pathname, filter_pattern[ [nspopup indexOfSelectedItem] ]) ) return YES; + BOOL isdir = NO; + [[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isdir]; + if (isdir) return YES; + if ( fl_filename_match([filename fileSystemRepresentation], filter_pattern[ [nspopup indexOfSelectedItem] ]) ) return YES; return NO; } +- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url +{ + return [self panel:sender shouldShowFilename:[url path]]; +} @end @interface FLsaveDelegate : NSObject |
