mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
Change the extension of the file name entered into a NSSavePanel's
text form when the set of allowed file types is changed and the current extension is no longer allowed. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27266 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
481d7e44a0
commit
8d8cd72f1c
2 changed files with 24 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-12-09 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||||
|
|
||||||
|
* Source/NSSavePanel.m (-setAllowedFileTypes:): Change extension
|
||||||
|
of the file name if the current extension is no longer allowed.
|
||||||
|
|
||||||
2008-12-08 Fred Kiefer <FredKiefer@gmx.de>
|
2008-12-08 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Headers/AppKit/NSTextFieldCell.h: Declare new private method
|
* Headers/AppKit/NSTextFieldCell.h: Declare new private method
|
||||||
|
|
|
@ -965,11 +965,30 @@ selectCellWithString: (NSString*)title
|
||||||
{
|
{
|
||||||
if (types != _allowedFileTypes)
|
if (types != _allowedFileTypes)
|
||||||
{
|
{
|
||||||
|
BOOL hasAllowedExtension = NO;
|
||||||
|
NSString *filename, *extension;
|
||||||
|
|
||||||
|
filename = [[_form cellAtIndex: 0] stringValue];
|
||||||
|
extension = [filename pathExtension];
|
||||||
|
if ([extension length] && [_allowedFileTypes count] &&
|
||||||
|
[_allowedFileTypes indexOfObject: extension] != NSNotFound)
|
||||||
|
hasAllowedExtension = YES;
|
||||||
|
|
||||||
if ([types count] == 0)
|
if ([types count] == 0)
|
||||||
DESTROY(_allowedFileTypes);
|
DESTROY(_allowedFileTypes);
|
||||||
else
|
else
|
||||||
ASSIGN(_allowedFileTypes, types);
|
ASSIGN(_allowedFileTypes, types);
|
||||||
[self _reloadBrowser];
|
[self _reloadBrowser];
|
||||||
|
|
||||||
|
if (hasAllowedExtension && [types count] &&
|
||||||
|
[types indexOfObject: extension] == NSNotFound &&
|
||||||
|
[types indexOfObject: @""] == NSNotFound)
|
||||||
|
{
|
||||||
|
extension = [types objectAtIndex: 0];
|
||||||
|
filename = [filename stringByDeletingPathExtension];
|
||||||
|
filename = [filename stringByAppendingPathExtension: extension];
|
||||||
|
[[_form cellAtIndex: 0] setStringValue: filename];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue