mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
ADD: Auto-rename source files FileExists option
This commit is contained in:
parent
a21a680695
commit
bee6b80aa8
6 changed files with 37 additions and 20 deletions
|
|
@ -153,14 +153,14 @@ type
|
|||
function ProcessLink(aNode: TFileTreeNode; AbsoluteTargetFileName: String): Boolean;
|
||||
function ProcessFile(aNode: TFileTreeNode; AbsoluteTargetFileName: String): Boolean;
|
||||
|
||||
function TargetExists(aNode: TFileTreeNode; AbsoluteTargetFileName: String)
|
||||
function TargetExists(aNode: TFileTreeNode; var AbsoluteTargetFileName: String)
|
||||
: TFileSystemOperationTargetExistsResult;
|
||||
function DirExists(aFile: TFile;
|
||||
AbsoluteTargetFileName: String;
|
||||
AllowCopyInto: Boolean;
|
||||
AllowDelete: Boolean): TFileSourceOperationOptionDirectoryExists;
|
||||
function FileExists(aFile: TFile;
|
||||
AbsoluteTargetFileName: String;
|
||||
var AbsoluteTargetFileName: String;
|
||||
AllowAppend: Boolean): TFileSourceOperationOptionFileExists;
|
||||
|
||||
procedure CountStatistics(aNode: TFileTreeNode);
|
||||
|
|
@ -1309,9 +1309,8 @@ end;
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
function TFileSystemOperationHelper.TargetExists(
|
||||
aNode: TFileTreeNode;
|
||||
AbsoluteTargetFileName: String): TFileSystemOperationTargetExistsResult;
|
||||
function TFileSystemOperationHelper.TargetExists(aNode: TFileTreeNode;
|
||||
var AbsoluteTargetFileName: String): TFileSystemOperationTargetExistsResult;
|
||||
var
|
||||
Attrs, LinkTargetAttrs: TFileAttrs;
|
||||
SourceFile: TFile;
|
||||
|
|
@ -1356,6 +1355,10 @@ var
|
|||
begin
|
||||
Exit(fsoterResume);
|
||||
end;
|
||||
fsoofeAutoRenameSource:
|
||||
begin
|
||||
Exit(fsoterNotExists);
|
||||
end
|
||||
else
|
||||
raise Exception.Create('Invalid file exists option');
|
||||
end;
|
||||
|
|
@ -1494,15 +1497,14 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TFileSystemOperationHelper.FileExists(
|
||||
aFile: TFile;
|
||||
AbsoluteTargetFileName: String;
|
||||
AllowAppend: Boolean): TFileSourceOperationOptionFileExists;
|
||||
function TFileSystemOperationHelper.FileExists(aFile: TFile;
|
||||
var AbsoluteTargetFileName: String; AllowAppend: Boolean
|
||||
): TFileSourceOperationOptionFileExists;
|
||||
const
|
||||
Responses: array[0..9] of TFileSourceOperationUIResponse
|
||||
Responses: array[0..10] of TFileSourceOperationUIResponse
|
||||
= (fsourOverwrite, fsourSkip, fsourAppend, fsourOverwriteAll,
|
||||
fsourSkipAll, fsourResume, fsourOverwriteOlder, fsourCancel,
|
||||
fsourOverwriteSmaller, fsourOverwriteLarger);
|
||||
fsourOverwriteSmaller, fsourOverwriteLarger, fsourAutoRenameSource);
|
||||
ResponsesNoAppend: array[0..5] of TFileSourceOperationUIResponse
|
||||
= (fsourOverwrite, fsourSkip, fsourOverwriteAll, fsourSkipAll,
|
||||
fsourOverwriteOlder, fsourCancel);
|
||||
|
|
@ -1584,6 +1586,12 @@ begin
|
|||
FFileExistsOption := fsoofeOverwriteLarger;
|
||||
Result:= OverwriteLarger;
|
||||
end;
|
||||
fsourAutoRenameSource:
|
||||
begin
|
||||
Result:= fsoofeAutoRenameSource;
|
||||
FFileExistsOption:= fsoofeAutoRenameSource;
|
||||
AbsoluteTargetFileName:= GetNextCopyName(AbsoluteTargetFileName);
|
||||
end;
|
||||
fsourNone,
|
||||
fsourCancel:
|
||||
AbortOperation;
|
||||
|
|
@ -1601,6 +1609,11 @@ begin
|
|||
begin
|
||||
Result:= OverwriteLarger;
|
||||
end;
|
||||
fsoofeAutoRenameSource:
|
||||
begin
|
||||
Result:= fsoofeAutoRenameSource;
|
||||
AbsoluteTargetFileName:= GetNextCopyName(AbsoluteTargetFileName);
|
||||
end;
|
||||
|
||||
else
|
||||
Result := FFileExistsOption;
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@ const
|
|||
ResponseToButton: array[TFileSourceOperationUIResponse] of TMyMsgButton =
|
||||
(msmbOK, msmbOK, msmbNo, msmbYes, msmbCancel, msmbNone, msmbAppend, msmbResume,
|
||||
msmbCopyInto, msmbCopyIntoAll, msmbOverwrite, msmbOverwriteAll, msmbOverwriteOlder,
|
||||
msmbOverwriteSmaller, msmbOverwriteLarger,msmbSkip, msmbSkipAll, msmbIgnoreAll,
|
||||
msmbAll, msmbRetry, msmbAbort);
|
||||
msmbOverwriteSmaller, msmbOverwriteLarger, msmbAutoRenameSource, msmbSkip, msmbSkipAll,
|
||||
msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
|
||||
|
||||
ResultToResponse: array[TMyMsgResult] of TFileSourceOperationUIResponse =
|
||||
(fsourOk, fsourNo, fsourYes, fsourCancel, fsourNone, fsourAppend, fsourResume,
|
||||
fsourCopyInto, fsourCopyIntoAll, fsourOverwrite, fsourOverwriteAll, fsourOverwriteOlder,
|
||||
fsourOverwriteSmaller, fsourOverwriteLarger, fsourSkip, fsourSkipAll, fsourIgnoreAll,
|
||||
fsourAll, fsourRetry, fsourAbort);
|
||||
fsourOverwriteSmaller, fsourOverwriteLarger, fsourAutoRenameSource, fsourSkip, fsourSkipAll,
|
||||
fsourIgnoreAll, fsourAll, fsourRetry, fsourAbort);
|
||||
|
||||
constructor TFileSourceOperationMessageBoxesUI.Create;
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ type
|
|||
|
||||
TFileSourceOperationOptionFileExists =
|
||||
(fsoofeNone, fsoofeSkip, fsoofeOverwrite, fsoofeOverwriteOlder,
|
||||
fsoofeOverwriteSmaller, fsoofeOverwriteLarger, fsoofeAppend, fsoofeResume);
|
||||
fsoofeOverwriteSmaller, fsoofeOverwriteLarger, fsoofeAutoRenameSource,
|
||||
fsoofeAppend, fsoofeResume);
|
||||
|
||||
TFileSourceOperationOptionDirectoryExists =
|
||||
(fsoodeNone, fsoodeSkip, fsoodeDelete, fsoodeCopyInto);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ type
|
|||
fsourOverwriteOlder,
|
||||
fsourOverwriteSmaller,
|
||||
fsourOverwriteLarger,
|
||||
fsourAutoRenameSource,
|
||||
fsourSkip,
|
||||
fsourSkipAll,
|
||||
fsourIgnoreAll,
|
||||
|
|
|
|||
|
|
@ -24,14 +24,14 @@ type
|
|||
TMyMsgResult=(mmrOK, mmrNo, mmrYes, mmrCancel, mmrNone,
|
||||
mmrAppend, mmrResume, mmrCopyInto, mmrCopyIntoAll,
|
||||
mmrOverwrite, mmrOverwriteAll, mmrOverwriteOlder,
|
||||
mmrOverwriteSmaller, mmrOverwriteLarger, mmrSkip,
|
||||
mmrSkipAll, mmrIgnoreAll, mmrAll, mmrRetry, mmrAbort);
|
||||
mmrOverwriteSmaller, mmrOverwriteLarger, mmrAutoRenameSource,
|
||||
mmrSkip, mmrSkipAll, mmrIgnoreAll, mmrAll, mmrRetry, mmrAbort);
|
||||
|
||||
TMyMsgButton=(msmbOK, msmbNo, msmbYes, msmbCancel, msmbNone,
|
||||
msmbAppend, msmbResume, msmbCopyInto, msmbCopyIntoAll,
|
||||
msmbOverwrite, msmbOverwriteAll, msmbOverwriteOlder,
|
||||
msmbOverwriteSmaller, msmbOverwriteLarger, msmbSkip,
|
||||
msmbSkipAll, msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
|
||||
msmbOverwriteSmaller, msmbOverwriteLarger, msmbAutoRenameSource,
|
||||
msmbSkip, msmbSkipAll, msmbIgnoreAll, msmbAll, msmbRetry, msmbAbort);
|
||||
|
||||
|
||||
{ TDialogMainThread }
|
||||
|
|
@ -523,6 +523,7 @@ begin
|
|||
cLngButton[msmbOverwriteOlder] := rsDlgButtonOverwriteOlder;
|
||||
cLngButton[msmbOverwriteSmaller] := rsDlgButtonOverwriteSmaller;
|
||||
cLngButton[msmbOverwriteLarger] := rsDlgButtonOverwriteLarger;
|
||||
cLngButton[msmbAutoRenameSource] := rsDlgButtonAutoRenameSource;
|
||||
cLngButton[msmbSkip] := rsDlgButtonSkip;
|
||||
cLngButton[msmbSkipAll] := rsDlgButtonSkipAll;
|
||||
cLngButton[msmbIgnoreAll] := rsDlgButtonIgnoreAll;
|
||||
|
|
|
|||
|
|
@ -185,6 +185,7 @@ resourcestring
|
|||
rsDlgButtonOverwriteOlder = 'Overwrite All Ol&der';
|
||||
rsDlgButtonOverwriteSmaller = 'Overwrite All S&maller';
|
||||
rsDlgButtonOverwriteLarger = 'Overwrite All &Larger';
|
||||
rsDlgButtonAutoRenameSource = 'A&uto-rename source files';
|
||||
rsDlgButtonSkip = '&Skip';
|
||||
rsDlgButtonSkipAll = 'S&kip All';
|
||||
rsDlgButtonIgnoreAll = 'I&gnore All';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue