ADD: fspSearchable to TFileSourceProperties, and appy in TMainCommands.cm_Search()

This commit is contained in:
rich2014 2026-06-01 23:10:44 +08:00
commit 98533a9d15
5 changed files with 12 additions and 9 deletions

View file

@ -823,7 +823,7 @@ end;
function TFileSystemFileSource.GetProperties: TFileSourceProperties;
begin
Result := [
fspDirectAccess, fspListFlatView, fspNoneParent
fspDirectAccess, fspListFlatView, fspNoneParent, fspSearchable
{$IFDEF UNIX}
, fspCaseSensitive
{$ENDIF}

View file

@ -112,6 +112,7 @@ function TSearchResultFileSource.GetProperties: TFileSourceProperties;
begin
Result := inherited GetProperties - [fspNoneParent, fspListFlatView];
if (fspDirectAccess in Result) then Result+= [fspLinksToLocalFiles];
Include(Result, fspSearchable);
end;
function TSearchResultFileSource.SetCurrentWorkingDirectory(NewDir: String): Boolean;

View file

@ -77,7 +77,11 @@ type
{en
Set, if the file source supports custom file icons.
}
fspCustomIcon
fspCustomIcon,
{en
Set, if the file source supports searching in FindDlg.
}
fspSearchable
);
TFileSourceProperties = set of TFileSourceProperty;

View file

@ -511,7 +511,7 @@ end;
function TWcxArchiveFileSource.GetProperties: TFileSourceProperties;
begin
Result := [fspUsesConnections, fspListFlatView];
Result := [fspUsesConnections, fspListFlatView, fspSearchable];
end;
function TWcxArchiveFileSource.GetSupportedFileProperties: TFilePropertiesTypes;

View file

@ -3545,19 +3545,17 @@ procedure TMainCommands.cm_Search(const Params: array of string);
var
TemplateName: String;
begin
if not (frmMain.ActiveFrame.FileSource.IsClass(TFileSystemFileSource) or
frmMain.ActiveFrame.FileSource.IsClass(TWcxArchiveFileSource) or
frmMain.ActiveFrame.FileSource.IsClass(TSearchResultFileSource) ) then
if fspSearchable in frmMain.ActiveFrame.FileSource.GetProperties then
begin
msgError(rsMsgErrNotSupported)
end
else begin
if Length(Params) > 0 then
TemplateName:= Params[0]
else begin
TemplateName:= gSearchDefaultTemplate;
end;
ShowFindDlg(frmMain.ActiveFrame, TemplateName);
end
else begin
msgError(rsMsgErrNotSupported)
end;
end;