mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: refactor FileSource - step 4: apply FileSourceManager in fMain, support fsoMove for TMountedFileSource
This commit is contained in:
parent
0c10a9c033
commit
3df9f5260c
1 changed files with 25 additions and 26 deletions
|
|
@ -43,7 +43,7 @@ uses
|
|||
ufavoritetabs, Graphics, Forms, Menus, Controls, StdCtrls, ExtCtrls, ActnList,
|
||||
Buttons, SysUtils, Classes, SynEdit, LCLType, ComCtrls, LResources,
|
||||
KASToolBar, KASComboBox, uFilePanelSelect, uBriefFileView, VTEmuCtl, VTEmuPty,
|
||||
uFileView, uFileSource, uFileViewNotebook, uFile, LCLVersion, KASToolPanel,
|
||||
uFileView, uFileSource, uFileSourceManager, uFileViewNotebook, uFile, LCLVersion, KASToolPanel,
|
||||
uOperationsManager, uFileSourceOperation, uDrivesList, DCClassesUtf8,
|
||||
DCXmlConfig, uDrive, uDriveWatcher, uDCVersion, uMainCommands, uFormCommands,
|
||||
uOperationsPanel, KASToolItems, uKASToolItemsExtended, uCmdLineParams, uOSForms
|
||||
|
|
@ -3855,33 +3855,32 @@ var
|
|||
Operation: TFileSourceMoveOperation;
|
||||
bMove: Boolean;
|
||||
MoveDialog: TfrmCopyDlg = nil;
|
||||
|
||||
params: TFileSourceConsultParams;
|
||||
begin
|
||||
Result := False;
|
||||
try
|
||||
// Special case for Search Result File Source
|
||||
if SourceFileSource.IsClass(TSearchResultFileSource) then begin
|
||||
SourceFileSource:= ISearchResultFileSource(SourceFileSource).FileSource;
|
||||
end;
|
||||
// Only allow moving within the same file source.
|
||||
if (SourceFileSource.IsInterface(TargetFileSource) or
|
||||
TargetFileSource.IsInterface(SourceFileSource)) and
|
||||
(SourceFileSource.CurrentAddress = TargetFileSource.CurrentAddress) and
|
||||
(fsoMove in SourceFileSource.GetOperationsTypes) and
|
||||
(fsoMove in TargetFileSource.GetOperationsTypes) then
|
||||
begin
|
||||
bMove := True;
|
||||
end
|
||||
else if ((fsoCopyOut in SourceFileSource.GetOperationsTypes) and
|
||||
(fsoCopyIn in TargetFileSource.GetOperationsTypes)) then
|
||||
begin
|
||||
bMove := False; // copy + delete through temporary file system
|
||||
msgWarning(rsMsgNotImplemented);
|
||||
Exit;
|
||||
end
|
||||
else
|
||||
begin
|
||||
msgWarning(rsMsgErrNotSupported);
|
||||
Exit;
|
||||
params.operationType:= fsoMove;
|
||||
params.sourceFS:= SourceFileSource;
|
||||
params.targetFS:= TargetFileSource;
|
||||
params.files:= SourceFiles;
|
||||
params.targetPath:= TargetPath;
|
||||
FileSourceManager.consultBeforeOperate( params );
|
||||
|
||||
SourceFileSource:= params.sourceFS;
|
||||
bMove:= (params.consultResult = fscrSuccess);
|
||||
|
||||
if NOT bMove then begin
|
||||
if params.consultResult = fscrNotImplemented then
|
||||
begin
|
||||
msgWarning(rsMsgNotImplemented);
|
||||
Exit;
|
||||
end
|
||||
else
|
||||
begin
|
||||
msgWarning(rsMsgErrNotSupported);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
if SourceFiles.Count = 0 then
|
||||
|
|
@ -3934,7 +3933,7 @@ begin
|
|||
if bMove then
|
||||
begin
|
||||
Operation := SourceFileSource.CreateMoveOperation(
|
||||
SourceFiles, TargetPath) as TFileSourceMoveOperation;
|
||||
SourceFiles, params.TargetPath) as TFileSourceMoveOperation;
|
||||
|
||||
if Assigned(Operation) then
|
||||
begin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue