mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 651477 - Update setTreatsFilePackagesAsDirectories when user change the filter list on MacOS X. r=joshmoz
This commit is contained in:
parent
af3178de85
commit
5b690cfbd4
@ -290,6 +290,16 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static
|
||||
void UpdatePanelFileTypes(NSOpenPanel* aPanel, NSArray* aFilters)
|
||||
{
|
||||
// If we show all file types, also "expose" bundles' contents.
|
||||
// FIXME: the code seems to do the exact opposite, this bug 656260.
|
||||
[aPanel setTreatsFilePackagesAsDirectories:!!aFilters];
|
||||
|
||||
[aPanel setAllowedFileTypes:aFilters];
|
||||
}
|
||||
|
||||
@implementation NSPopUpButtonObserver
|
||||
- (void) setPopUpButton:(NSPopUpButton*)aPopUpButton
|
||||
{
|
||||
@ -315,8 +325,7 @@ NS_IMETHODIMP nsFilePicker::Show(PRInt16 *retval)
|
||||
}
|
||||
|
||||
mFilePicker->SetFilterIndex(selectedItem);
|
||||
NSArray* filters = mFilePicker->GetFilterList();
|
||||
[mOpenPanel setAllowedFileTypes:filters];
|
||||
UpdatePanelFileTypes(mOpenPanel, mFilePicker->GetFilterList());
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN();
|
||||
}
|
||||
@ -333,10 +342,6 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, PRBool inAllowMultiple, nsC
|
||||
|
||||
SetShowHiddenFileState(thePanel);
|
||||
|
||||
// Get filters
|
||||
// filters may be null, if we should allow all file types.
|
||||
NSArray *filters = GetFilterList();
|
||||
|
||||
// Set the options for how the get file dialog will appear
|
||||
SetDialogTitle(inTitle, thePanel);
|
||||
[thePanel setAllowsMultipleSelection:inAllowMultiple];
|
||||
@ -345,9 +350,9 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, PRBool inAllowMultiple, nsC
|
||||
[thePanel setCanChooseFiles:YES];
|
||||
[thePanel setResolvesAliases:YES]; //this is default - probably doesn't need to be set
|
||||
|
||||
// if we show all file types, also "expose" bundles' contents.
|
||||
if (!filters)
|
||||
[thePanel setTreatsFilePackagesAsDirectories:NO];
|
||||
// Get filters
|
||||
// filters may be null, if we should allow all file types.
|
||||
NSArray *filters = GetFilterList();
|
||||
|
||||
// set up default directory
|
||||
NSString *theDir = PanelDefaultDirectory();
|
||||
@ -384,12 +389,17 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, PRBool inAllowMultiple, nsC
|
||||
name:NSMenuWillSendActionNotification object:nil];
|
||||
|
||||
[thePanel setDirectoryURL:[[NSURL alloc] initWithString:theDir]];
|
||||
[thePanel setAllowedFileTypes:filters];
|
||||
UpdatePanelFileTypes(thePanel, filters);
|
||||
result = [thePanel runModal];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:observer];
|
||||
[observer release];
|
||||
} else {
|
||||
// If we show all file types, also "expose" bundles' contents.
|
||||
// FIXME: the code seems to do the exact opposite, this bug 656260.
|
||||
if (!filters) {
|
||||
[thePanel setTreatsFilePackagesAsDirectories:NO];
|
||||
}
|
||||
result = [thePanel runModalForDirectory:theDir file:nil types:filters];
|
||||
}
|
||||
nsCocoaUtils::CleanUpAfterNativeAppModalDialog();
|
||||
|
Loading…
Reference in New Issue
Block a user