Reset the current selection of an NSOpenPanel when directory selection

is disabled. This prevents bogus directories being returned from the
next modal session of the panel.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29155 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2009-12-21 22:55:01 +00:00
parent ddb6ca07c4
commit dd971a7f9b
2 changed files with 19 additions and 2 deletions

View file

@ -1,5 +1,10 @@
2009-12-21 Wolfgang Lux <wolfgang.lux@gmail.com>
* Source/NSOpenPanel.m (-setCanChooseDirectories): Reset the
current selection of an open panel when directory selection is
disabled. This prevents bogus directories being returned from the
next modal session of the panel.
* Source/NSSavePanel.m (-resetDefaults): Also reset the
allowsOtherFileTypes attribute to its default when a fresh save
panel is requested.

View file

@ -312,8 +312,20 @@ static NSOpenPanel *_gs_gui_open_panel = nil;
*/
- (void) setCanChooseDirectories: (BOOL)flag
{
_canChooseDirectories = flag;
[_browser setAllowsBranchSelection: flag];
if (flag != _canChooseDirectories)
{
_canChooseDirectories = flag;
[_browser setAllowsBranchSelection: flag];
if (!flag)
{
/* FIXME If the user disables directory selection we should deselect
any directories that are currently selected. This is achieved by
calling _reloadBrowser, but this may be considered overkill, since
the displayed files are the same whether canChooseDirectories is
enabled or not. */
[self _reloadBrowser];
}
}
}
/** <p>Returns YES if the user is allowed to choose directories The