mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-09 01:28:19 +02:00
LCL: TOpenDialog: set ofExtensionDifferent if (DefaultExt <> '') and (Extension <> DefExt) for all WS.
Our docs about ofExtensionDifferent wrongfully states: "Allows a file name with an extension which does not match the filters or default extension in a file dialog." This is not how Delphi defines it, and also not how it's implemented in pre-Vista dialogs (using OPENFILE structure, the OS sets the corresponding flag). (Since there have been no bugreports about this, it's doubtfull anybody cares, but nevertheless...)
This commit is contained in:
parent
33484eab0b
commit
7d4a36a290
@ -352,6 +352,9 @@ begin
|
|||||||
else
|
else
|
||||||
AFilename:=AFilename+DefaultExt;
|
AFilename:=AFilename+DefaultExt;
|
||||||
end;
|
end;
|
||||||
|
if (not {already} (ofExtensionDifferent in FOptions)) and (DefaultExt <> '')
|
||||||
|
and (CompareFileNames(DefaultExt,ExtractFileExt(AFilename)) <> 0) then
|
||||||
|
Include(FOptions, ofExtensionDifferent);
|
||||||
//ofOverwritePrompt -> is done in the interface
|
//ofOverwritePrompt -> is done in the interface
|
||||||
if (ofPathMustExist in Options)
|
if (ofPathMustExist in Options)
|
||||||
and (not DirPathExists(ExtractFileDir(AFilename))) then begin
|
and (not DirPathExists(ExtractFileDir(AFilename))) then begin
|
||||||
@ -430,6 +433,7 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TOpenDialog.DoExecute: boolean;
|
function TOpenDialog.DoExecute: boolean;
|
||||||
begin
|
begin
|
||||||
|
Options := Options - [ofExtensionDifferent]; //clear, it'll be set by WS or in CheckFile
|
||||||
Result:=inherited DoExecute;
|
Result:=inherited DoExecute;
|
||||||
if not (ofNoResolveLinks in Options) then
|
if not (ofNoResolveLinks in Options) then
|
||||||
ResolveLinks;
|
ResolveLinks;
|
||||||
|
Loading…
Reference in New Issue
Block a user