UPD: add fspImmutable for immutable File Source (eg. search result)

This commit is contained in:
rich2014 2026-06-09 16:51:33 +08:00
commit 0439ed958b
5 changed files with 24 additions and 14 deletions

View file

@ -116,7 +116,7 @@ function TSearchResultFileSource.GetProperties: TFileSourceProperties;
begin
Result := inherited GetProperties;
Result -= [fspNoneParent, fspListFlatView, fspSaveableLoadable];
Result += [fspDontChangePath, fspDontCreateDirectory, fspSearchable];
Result += [fspDontChangePath, fspDontCreateDirectory, fspImmutable, fspSearchable];
if (fspDirectAccess in Result) then Result+= [fspLinksToLocalFiles];
end;

View file

@ -132,12 +132,6 @@ var
end;
begin
params.consultResult:= fscrNotSupported;
params.handled:= True;
if params.partnerFS.IsClass(TStashFileSource) then
Exit;
sourceFS:= params.sourceFS;
targetFS:= params.targetFS;
@ -150,12 +144,6 @@ end;
procedure TStashFileSourceProcessor.consultMoveOperation(
var params: TFileSourceConsultParams);
begin
params.consultResult:= fscrNotSupported;
params.handled:= True;
if params.partnerFS.IsClass(TStashFileSource) then
Exit;
if params.phase=TFileSourceConsultPhase.target then
Exit;
@ -166,6 +154,15 @@ end;
procedure TStashFileSourceProcessor.consultOperation(
var params: TFileSourceConsultParams);
begin
params.consultResult:= fscrNotSupported;
params.handled:= True;
if params.partnerFS.IsClass(TStashFileSource) then
Exit;
if fspImmutable in params.targetFS.Properties then
Exit;
case params.operationType of
fsoCopy:
self.consultCopyOperation( params );

View file

@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, syncobjs,
uFileSource, uFileSourceOperationTypes, uFileSourceUtil,
uFileSource, uFileSourceOperationTypes, uFileSourceProperty, uFileSourceUtil,
uDebug, DCStrUtils;
type
@ -272,6 +272,12 @@ end;
procedure TDefaultFileSourceProcessor.consultOperation( var params: TFileSourceConsultParams );
begin
if fspImmutable in params.targetFS.Properties then begin
params.consultResult:= fscrNotSupported;
params.handled:= True;
Exit;
end;
case params.operationType of
fsoCopy:
self.consultCopyOperation( params );

View file

@ -84,6 +84,12 @@ type
}
fspDontCreateDirectory,
{en
Set, if the files/paths of the file source cannnot be changed
(for example: results from searching, etc.).
}
fspImmutable,
{en
Set, if the file source supports searching in FindDlg.
}

View file

@ -2531,6 +2531,7 @@ begin
if not (fsoCreateDirectory in ActiveFrame.FileSource.GetOperationsTypes) then
begin
if (fspDontCreateDirectory in ActiveFrame.FileSource.Properties) or
(fspImmutable in ActiveFrame.FileSource.Properties) or
NOT (fsoCopyIn in ActiveFrame.FileSource.GetOperationsTypes) then
begin
msgWarning(rsMsgErrNotSupported);