mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-18 18:46:04 +02:00
fixed ofFileMustExist fro SelectDirectoryDialog
git-svn-id: trunk@8285 -
This commit is contained in:
parent
6a279a35e4
commit
c6be2bbf11
@ -177,6 +177,7 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure DereferenceLinks; virtual;
|
procedure DereferenceLinks; virtual;
|
||||||
function CheckFile(var AFilename: string): boolean; virtual;
|
function CheckFile(var AFilename: string): boolean; virtual;
|
||||||
|
function CheckFileMustExist(const AFileName: string): boolean; virtual;
|
||||||
function CheckAllFiles: boolean; virtual;
|
function CheckAllFiles: boolean; virtual;
|
||||||
function DoExecute: boolean; override;
|
function DoExecute: boolean; override;
|
||||||
public
|
public
|
||||||
@ -203,7 +204,7 @@ type
|
|||||||
|
|
||||||
TSelectDirectoryDialog = class(TOpenDialog)
|
TSelectDirectoryDialog = class(TOpenDialog)
|
||||||
protected
|
protected
|
||||||
function CheckFile(var AFilename: string): boolean; override;
|
function CheckFileMustExist(const AFilename: string): boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
end;
|
end;
|
||||||
|
@ -132,11 +132,9 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if (ofFileMustExist in Options)
|
if (ofFileMustExist in Options)
|
||||||
and (not FileExists(AFilename)) then begin
|
and (not CheckFileMustExist(AFileName)) then begin
|
||||||
|
// CheckFileMustExists shows message dialog
|
||||||
Result:=false;
|
Result:=false;
|
||||||
MessageDlg(rsfdFileMustExist,
|
|
||||||
Format(rsfdFileNotExist,[AFileName]),mtError,
|
|
||||||
[mbCancel],0);
|
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if ofNoReadOnlyReturn in Options then begin
|
if ofNoReadOnlyReturn in Options then begin
|
||||||
@ -157,6 +155,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TOpenDialog.CheckFileMustExist(const AFileName: string): boolean;
|
||||||
|
begin
|
||||||
|
if not FileExists(AFilename) then begin
|
||||||
|
Result:=false;
|
||||||
|
MessageDlg(rsfdFileMustExist,
|
||||||
|
Format(rsfdFileNotExist,[AFileName]),mtError,
|
||||||
|
[mbCancel],0);
|
||||||
|
end else
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
function TOpenDialog.CheckAllFiles: boolean;
|
function TOpenDialog.CheckAllFiles: boolean;
|
||||||
var
|
var
|
||||||
AFilename: String;
|
AFilename: String;
|
||||||
@ -265,17 +274,15 @@ begin
|
|||||||
FTitle:=rsfdSelectDirectory;
|
FTitle:=rsfdSelectDirectory;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSelectDirectoryDialog.CheckFile(var AFilename: string): boolean;
|
function TSelectDirectoryDialog.CheckFileMustExist(const AFilename: string): boolean;
|
||||||
begin
|
begin
|
||||||
if (ofFileMustExist in Options)
|
if not DirPathExists(AFilename) then begin
|
||||||
and (not DirPathExists(AFilename)) then begin
|
|
||||||
Result:=false;
|
Result:=false;
|
||||||
MessageDlg(rsfdDirectoryMustExist,
|
MessageDlg(rsfdDirectoryMustExist,
|
||||||
Format(rsfdDirectoryNotExist,[AFileName]),mtError,
|
Format(rsfdDirectoryNotExist,[AFileName]),mtError,
|
||||||
[mbCancel],0);
|
[mbCancel],0);
|
||||||
exit;
|
end else
|
||||||
end;
|
Result:=true;
|
||||||
Result:=inherited CheckFile(AFilename);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user