mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Create archives using plug-ins with hidden flag
UPD: Use poOwnerFormCenter for pack/extract dialogs
This commit is contained in:
parent
1ee544169f
commit
401416afba
10 changed files with 46 additions and 38 deletions
|
|
@ -884,7 +884,7 @@ begin
|
|||
TargetFile:= PathDelim + ExtractWord(2, TargetFile, [ReversePathDelim]);
|
||||
AFile:= TFileSystemFileSource.CreateFileFromFile(ArchiveFile);
|
||||
try
|
||||
FileSource:= GetArchiveFileSource(TFileSystemFileSource.GetFileSource, AFile);
|
||||
FileSource:= GetArchiveFileSource(TFileSystemFileSource.GetFileSource, AFile, EmptyStr, False, False);
|
||||
finally
|
||||
AFile.Free;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ inherited frmExtractDlg: TfrmExtractDlg
|
|||
ClientWidth = 516
|
||||
Constraints.MinWidth = 500
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
Position = poOwnerFormCenter
|
||||
SessionProperties = 'cbOverwrite.Checked'
|
||||
inherited pnlContent: TPanel
|
||||
Left = 6
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ type
|
|||
end;
|
||||
|
||||
// Frees 'SourceFiles'.
|
||||
procedure ShowExtractDlg(SourceFileSource: IFileSource; var SourceFiles: TFiles;
|
||||
procedure ShowExtractDlg(TheOwner: TComponent; SourceFileSource: IFileSource; var SourceFiles: TFiles;
|
||||
TargetFileSource: IFileSource; sDestPath: String);
|
||||
|
||||
implementation
|
||||
|
|
@ -92,7 +92,7 @@ begin
|
|||
Result := IncludeTrailingPathDelimiter(TargetPath);
|
||||
end;
|
||||
|
||||
procedure ShowExtractDlg(SourceFileSource: IFileSource; var SourceFiles: TFiles;
|
||||
procedure ShowExtractDlg(TheOwner: TComponent; SourceFileSource: IFileSource; var SourceFiles: TFiles;
|
||||
TargetFileSource: IFileSource; sDestPath: String);
|
||||
var
|
||||
Result: Boolean;
|
||||
|
|
@ -108,7 +108,7 @@ begin
|
|||
Exit;
|
||||
end;
|
||||
|
||||
extractDialog := TfrmExtractDlg.Create(nil);
|
||||
extractDialog := TfrmExtractDlg.Create(TheOwner);
|
||||
if Assigned(extractDialog) then
|
||||
try
|
||||
with extractDialog do
|
||||
|
|
@ -173,7 +173,7 @@ begin
|
|||
begin
|
||||
try
|
||||
// Check if there is a ArchiveFileSource for possible archive.
|
||||
ArchiveFileSource := GetArchiveFileSource(SourceFileSource, SourceFiles[i]);
|
||||
ArchiveFileSource := GetArchiveFileSource(SourceFileSource, SourceFiles[i], EmptyStr, False, True);
|
||||
|
||||
// Extract current item
|
||||
ExtractArchive(ArchiveFileSource, TargetFileSource, sDestPath, QueueId);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,9 @@ uses
|
|||
|
||||
function GetArchiveFileSource(SourceFileSource: IFileSource;
|
||||
ArchiveFile: TFile;
|
||||
ArchiveType: String = '';
|
||||
ArchiveSign: Boolean = False): IArchiveFileSource;
|
||||
ArchiveType: String;
|
||||
ArchiveSign: Boolean;
|
||||
IncludeHidden: Boolean): IArchiveFileSource;
|
||||
|
||||
procedure TestArchive(aFileView: TFileView; aFiles: TFiles);
|
||||
|
||||
|
|
@ -43,7 +44,8 @@ uses
|
|||
function GetArchiveFileSourceDirect(SourceFileSource: IFileSource;
|
||||
ArchiveFileName: String;
|
||||
ArchiveType: String;
|
||||
ArchiveSign: Boolean = False): IArchiveFileSource;
|
||||
ArchiveSign: Boolean;
|
||||
IncludeHidden: Boolean): IArchiveFileSource;
|
||||
begin
|
||||
if not (fspDirectAccess in SourceFileSource.Properties) then
|
||||
Exit(nil);
|
||||
|
|
@ -61,7 +63,7 @@ begin
|
|||
if ArchiveSign then
|
||||
Result := TWcxArchiveFileSource.CreateByArchiveSign(SourceFileSource, ArchiveFileName)
|
||||
else
|
||||
Result := TWcxArchiveFileSource.CreateByArchiveType(SourceFileSource, ArchiveFileName, ArchiveType);
|
||||
Result := TWcxArchiveFileSource.CreateByArchiveType(SourceFileSource, ArchiveFileName, ArchiveType, IncludeHidden);
|
||||
end;
|
||||
// Check if there is a registered MultiArc addon for possible archive.
|
||||
if not Assigned(Result) then
|
||||
|
|
@ -86,8 +88,9 @@ end;
|
|||
|
||||
function GetArchiveFileSource(SourceFileSource: IFileSource;
|
||||
ArchiveFile: TFile;
|
||||
ArchiveType: String = '';
|
||||
ArchiveSign: Boolean = False): IArchiveFileSource;
|
||||
ArchiveType: String;
|
||||
ArchiveSign: Boolean;
|
||||
IncludeHidden: Boolean): IArchiveFileSource;
|
||||
var
|
||||
TempFS: ITempFileSystemFileSource = nil;
|
||||
Operation: TFileSourceOperation = nil;
|
||||
|
|
@ -96,7 +99,7 @@ var
|
|||
begin
|
||||
if fspDirectAccess in SourceFileSource.Properties then
|
||||
begin
|
||||
Result := GetArchiveFileSourceDirect(SourceFileSource, ArchiveFile.FullPath, ArchiveType, ArchiveSign);
|
||||
Result := GetArchiveFileSourceDirect(SourceFileSource, ArchiveFile.FullPath, ArchiveType, ArchiveSign, IncludeHidden);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
|
|
@ -113,7 +116,7 @@ begin
|
|||
TempFS.DeleteOnDestroy := False;
|
||||
// The files on temp file source are valid as long as source FileSource is valid.
|
||||
TempFS.ParentFileSource := SourceFileSource;
|
||||
Result := GetArchiveFileSourceDirect(TempFS, LocalArchiveFile.FullPath, ArchiveType, ArchiveSign);
|
||||
Result := GetArchiveFileSourceDirect(TempFS, LocalArchiveFile.FullPath, ArchiveType, ArchiveSign, IncludeHidden);
|
||||
// If not successful will try to get files through CopyOut below.
|
||||
end;
|
||||
finally
|
||||
|
|
@ -159,7 +162,8 @@ begin
|
|||
TempFS,
|
||||
IncludeTrailingPathDelimiter(TempFS.FilesystemRoot) + ArchiveFile.Name,
|
||||
ArchiveType,
|
||||
ArchiveSign);
|
||||
ArchiveSign,
|
||||
IncludeHidden);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
@ -207,7 +211,7 @@ begin
|
|||
for I := 0 to aFiles.Count - 1 do // test all selected archives
|
||||
try
|
||||
// Check if there is a ArchiveFileSource for possible archive.
|
||||
ArchiveFileSource := GetArchiveFileSource(aFileView.FileSource, aFiles[i]);
|
||||
ArchiveFileSource := GetArchiveFileSource(aFileView.FileSource, aFiles[i], EmptyStr, False, True);
|
||||
|
||||
if Assigned(ArchiveFileSource) then
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ var
|
|||
begin
|
||||
try
|
||||
// Check if there is a ArchiveFileSource for possible archive.
|
||||
FileSource := GetArchiveFileSource(aFileSource, aFile, EmptyStr, bForce);
|
||||
FileSource := GetArchiveFileSource(aFileSource, aFile, EmptyStr, bForce, False);
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -110,9 +110,11 @@ type
|
|||
anArchiveFileName: String): IWcxArchiveFileSource;
|
||||
class function CreateByArchiveType(anArchiveFileSource: IFileSource;
|
||||
anArchiveFileName: String;
|
||||
anArchiveType: String): IWcxArchiveFileSource;
|
||||
anArchiveType: String;
|
||||
bIncludeHidden: Boolean = False): IWcxArchiveFileSource;
|
||||
class function CreateByArchiveName(anArchiveFileSource: IFileSource;
|
||||
anArchiveFileName: String): IWcxArchiveFileSource;
|
||||
anArchiveFileName: String;
|
||||
bIncludeHidden: Boolean = False): IWcxArchiveFileSource;
|
||||
{en
|
||||
Returns @true if there is a plugin registered for the archive type
|
||||
(only extension is checked).
|
||||
|
|
@ -343,9 +345,8 @@ begin
|
|||
end;
|
||||
|
||||
class function TWcxArchiveFileSource.CreateByArchiveType(
|
||||
anArchiveFileSource: IFileSource;
|
||||
anArchiveFileName: String;
|
||||
anArchiveType: String): IWcxArchiveFileSource;
|
||||
anArchiveFileSource: IFileSource; anArchiveFileName: String;
|
||||
anArchiveType: String; bIncludeHidden: Boolean): IWcxArchiveFileSource;
|
||||
var
|
||||
i: Integer;
|
||||
ModuleFileName: String;
|
||||
|
|
@ -356,7 +357,7 @@ begin
|
|||
for i := 0 to gWCXPlugins.Count - 1 do
|
||||
begin
|
||||
if SameText(anArchiveType, gWCXPlugins.Ext[i]) and (gWCXPlugins.Enabled[i]) and
|
||||
((gWCXPlugins.Flags[I] and PK_CAPS_HIDE) <> PK_CAPS_HIDE) then
|
||||
((bIncludeHidden) or ((gWCXPlugins.Flags[I] and PK_CAPS_HIDE) <> PK_CAPS_HIDE)) then
|
||||
begin
|
||||
ModuleFileName := GetCmdDirFromEnvVar(gWCXPlugins.FileName[I]);
|
||||
|
||||
|
|
@ -372,11 +373,12 @@ begin
|
|||
end;
|
||||
|
||||
class function TWcxArchiveFileSource.CreateByArchiveName(
|
||||
anArchiveFileSource: IFileSource;
|
||||
anArchiveFileName: String): IWcxArchiveFileSource;
|
||||
anArchiveFileSource: IFileSource; anArchiveFileName: String;
|
||||
bIncludeHidden: Boolean): IWcxArchiveFileSource;
|
||||
begin
|
||||
Result:= CreateByArchiveType(anArchiveFileSource, anArchiveFileName,
|
||||
ExtractOnlyFileExt(anArchiveFileName));
|
||||
ExtractOnlyFileExt(anArchiveFileName),
|
||||
bIncludeHidden);
|
||||
end;
|
||||
|
||||
class function TWcxArchiveFileSource.CheckPluginByExt(anArchiveType: String): Boolean;
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ begin
|
|||
end
|
||||
else if FileIsArchive(AFile.FSFile.FullPath) then
|
||||
begin
|
||||
TargetFileSource:= GetArchiveFileSource(FileSource, AFile.FSFile);
|
||||
TargetFileSource:= GetArchiveFileSource(FileSource, AFile.FSFile, EmptyStr, False, False);
|
||||
if Assigned(TargetFileSource) then TargetPath:= TargetFileSource.GetRootDir;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ inherited frmPackDlg: TfrmPackDlg
|
|||
Height = 272
|
||||
Width = 540
|
||||
HelpContext = 150
|
||||
ActiveControl = edtPackCmd
|
||||
AutoSize = True
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsDialog
|
||||
|
|
@ -15,7 +14,7 @@ inherited frmPackDlg: TfrmPackDlg
|
|||
Constraints.MinHeight = 236
|
||||
Constraints.MinWidth = 482
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
Position = poOwnerFormCenter
|
||||
inherited pnlContent: TPanel
|
||||
Height = 179
|
||||
Width = 532
|
||||
|
|
@ -221,7 +220,7 @@ inherited frmPackDlg: TfrmPackDlg
|
|||
AnchorSideTop.Control = DividerBevel
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Top = 214
|
||||
Top = 212
|
||||
Width = 524
|
||||
Align = alNone
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ type
|
|||
end;
|
||||
|
||||
// Frees 'Files'.
|
||||
function ShowPackDlg(const SourceFileSource: IFileSource;
|
||||
function ShowPackDlg(TheOwner: TComponent;
|
||||
const SourceFileSource: IFileSource;
|
||||
const TargetFileSource: IArchiveFileSource;
|
||||
var Files: TFiles;
|
||||
TargetArchivePath: String;
|
||||
|
|
@ -96,7 +97,8 @@ uses
|
|||
uWcxArchiveCopyInOperation, uMultiArchiveCopyInOperation, uMasks,
|
||||
DCStrUtils;
|
||||
|
||||
function ShowPackDlg(const SourceFileSource: IFileSource;
|
||||
function ShowPackDlg(TheOwner: TComponent;
|
||||
const SourceFileSource: IFileSource;
|
||||
const TargetFileSource: IArchiveFileSource;
|
||||
var Files: TFiles;
|
||||
TargetArchivePath: String;
|
||||
|
|
@ -181,7 +183,7 @@ var
|
|||
var
|
||||
QueueId: TOperationsManagerQueueIdentifier;
|
||||
begin
|
||||
PackDialog := TfrmPackDlg.Create(nil);
|
||||
PackDialog := TfrmPackDlg.Create(TheOwner);
|
||||
{$IF DEFINED(LCLGTK2)}
|
||||
// TRadioGroup.ItemIndex:= -1 will not work under Gtk2
|
||||
// if items have been added dynamically, this workaround fixes it
|
||||
|
|
@ -258,7 +260,7 @@ begin
|
|||
// Check if there is an ArchiveFileSource for possible archive.
|
||||
aFile := SourceFileSource.CreateFileObject(ExtractFilePath(edtPackCmd.Text));
|
||||
aFile.Name := Files[I].Name + FTarExt + FArchiveExt;
|
||||
NewTargetFileSource := GetArchiveFileSource(SourceFileSource, aFile, FArchiveType);
|
||||
NewTargetFileSource := GetArchiveFileSource(SourceFileSource, aFile, FArchiveType, False, True);
|
||||
except
|
||||
on e: EFileSourceException do
|
||||
begin
|
||||
|
|
@ -283,7 +285,7 @@ begin
|
|||
// Check if there is an ArchiveFileSource for possible archive.
|
||||
aFile := SourceFileSource.CreateFileObject(ExtractFilePath(edtPackCmd.Text));
|
||||
aFile.Name := ExtractFileName(edtPackCmd.Text);
|
||||
NewTargetFileSource := GetArchiveFileSource(SourceFileSource, aFile, FArchiveType);
|
||||
NewTargetFileSource := GetArchiveFileSource(SourceFileSource, aFile, FArchiveType, False, True);
|
||||
except
|
||||
on e: EFileSourceException do
|
||||
begin
|
||||
|
|
@ -368,7 +370,7 @@ var
|
|||
WcxFileSource: IWcxArchiveFileSource;
|
||||
begin
|
||||
try
|
||||
WcxFileSource := TWcxArchiveFileSource.CreateByArchiveName(FSourceFileSource, edtPackCmd.Text);
|
||||
WcxFileSource := TWcxArchiveFileSource.CreateByArchiveName(FSourceFileSource, edtPackCmd.Text, True);
|
||||
if Assigned(WcxFileSource) then // WCX plugin
|
||||
try
|
||||
WcxFileSource.WcxModule.VFSConfigure(Handle);
|
||||
|
|
|
|||
|
|
@ -1236,7 +1236,8 @@ begin
|
|||
else begin
|
||||
TargetPath:= NotActiveFrame.CurrentPath;
|
||||
end;
|
||||
ShowPackDlg(ActiveFrame.FileSource,
|
||||
ShowPackDlg(frmMain,
|
||||
ActiveFrame.FileSource,
|
||||
nil, // No specific target (create new)
|
||||
SelectedFiles,
|
||||
TargetPath,
|
||||
|
|
@ -1275,7 +1276,7 @@ begin
|
|||
TargetPath:= NotActiveFrame.CurrentPath;
|
||||
TargetFileSource:= NotActiveFrame.FileSource;
|
||||
end;
|
||||
ShowExtractDlg(ActiveFrame.FileSource, SelectedFiles,
|
||||
ShowExtractDlg(frmMain, ActiveFrame.FileSource, SelectedFiles,
|
||||
TargetFileSource, TargetPath);
|
||||
end;
|
||||
finally
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue