ADD: MultiArc - AskHistory support (#1838)

This commit is contained in:
j2969719 2024-10-04 20:44:44 +03:00 committed by GitHub
commit 1271cd1a68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 3 deletions

View file

@ -104,7 +104,7 @@ uses
uOperationsManager, uArchiveFileSourceUtil, uMultiArchiveFileSource,
uWcxArchiveCopyInOperation, uMultiArchiveCopyInOperation, uMasks,
DCStrUtils, uMultiArc, uWcxModule, uTempFileSystemFileSource,
uFileSourceCopyOperation, uShowForm, uShowMsg;
uFileSourceCopyOperation, uShowForm, uShowMsg, uGlobsPaths;
procedure ShowPackDlg(TheOwner: TComponent;
const SourceFileSource: IFileSource;
@ -235,6 +235,7 @@ end;
procedure TfrmPackDlg.btnConfigClick(Sender: TObject);
var
I: LongInt;
WcxFileSource: IWcxArchiveFileSource;
begin
try
@ -247,7 +248,20 @@ begin
end
else // MultiArc addon
begin
FCustomParams:= InputBox(Caption, rsMsgArchiverCustomParams, FCustomParams);
for I := 0 to gMultiArcList.Count - 1 do
begin
with gMultiArcList.Items[I] do
begin
if FEnabled and MatchesMaskList(FArchiveType, FExtension, ',') then
begin
if ShowInputComboBox(Caption, rsMsgArchiverCustomParams, FAskHistory, FCustomParams) then
begin
gMultiArcList.SaveToFile(gpCfgDir + sMULTIARC_FILENAME);
end;
Break;
end;
end;
end;
end;
except
on e: Exception do
@ -349,6 +363,7 @@ begin
begin
if gWCXPlugins.Enabled[I] and (gWCXPlugins.Ext[I] = FArchiveType) then
begin
EnableControl(btnConfig, ((gWCXPlugins.Flags[I] and PK_CAPS_OPTIONS) <> 0));
// If plugin supports packing with password
EnableControl(cbEncrypt, ((gWCXPlugins.Flags[I] and PK_CAPS_ENCRYPT) <> 0));
// If archive can not contain multiple files
@ -398,6 +413,7 @@ begin
else
sCmd:= FAdd;
EnableControl(btnConfig, (Pos('%S', sCmd) <> 0));
// If addon supports create multi volume archive
EnableControl(cbMultivolume, (Pos('%V', sCmd) <> 0));
// If addon supports packing with password

View file

@ -592,6 +592,7 @@ begin
Caption := sPrompt;
Top := 6;
Left := 6;
WordWrap := True;
end;
cbValue := TComboBox.Create(frmDialog);
with cbValue do
@ -603,6 +604,9 @@ begin
AnchorToNeighbour(akTop, 6, lblPrompt);
Constraints.MinWidth := max(280, Screen.Width div 4);
end;
lblPrompt.AnchorSide[akRight].Side:= asrBottom;
lblPrompt.AnchorSide[akRight].Control:= cbValue;
lblPrompt.Anchors := lblPrompt.Anchors + [akRight];
bbtnCancel := TBitBtn.Create(frmDialog);
with bbtnCancel do
begin
@ -683,6 +687,7 @@ begin
Caption := sPrompt;
Top := 6;
Left := 6;
WordWrap := True;
end;
lbValue := TListBox.Create(frmDialog);
with lbValue do
@ -701,6 +706,9 @@ begin
Constraints.MinWidth := max(280, Screen.Width div 4);
OnDblClick:= ProcedureHolder.ListBoxDblClick;
end;
lblPrompt.AnchorSide[akRight].Side:= asrBottom;
lblPrompt.AnchorSide[akRight].Control:= lbValue;
lblPrompt.Anchors := lblPrompt.Anchors + [akRight];
if bMultiSelect then
begin
bbtnSelectAll := TBitBtn.Create(frmDialog);

View file

@ -132,6 +132,7 @@ type
FPasswordQuery: String;
FFormMode: Integer;
FFlags: TMultiArcFlags;
FAskHistory: TStringList;
public
FEnabled: Boolean;
FOutput: Boolean;
@ -285,7 +286,7 @@ var
IniFile: TIniFileEx = nil;
Sections: TStringList = nil;
Section,
Format: String;
Format, CustomParams: String;
FirstTime: Boolean = True;
MultiArcItem: TMultiArcItem;
begin
@ -332,6 +333,14 @@ begin
FAddSelfExtract:= TrimQuotes(IniFile.ReadString(Section, 'AddSelfExtract', EmptyStr));
FPasswordQuery:= IniFile.ReadString(Section, 'PasswordQuery', EmptyStr);
// optional
for J:= 0 to 50 do
begin
CustomParams:= IniFile.ReadString(Section, 'AskHistory' + IntToStr(J), EmptyStr);
if CustomParams <> EmptyStr then
FAskHistory.Add(CustomParams)
else
Break;
end;
FFlags:= TMultiArcFlags(IniFile.ReadInteger(Section, 'Flags', 0));
FFormMode:= IniFile.ReadInteger(Section, 'FormMode', 0);
FEnabled:= IniFile.ReadBool(Section, 'Enabled', True);
@ -390,6 +399,10 @@ begin
IniFile.WriteString(Section, 'AddSelfExtract', FAddSelfExtract);
IniFile.WriteString(Section, 'PasswordQuery', FPasswordQuery);
// optional
for J:= 0 to FAskHistory.Count - 1 do
begin
IniFile.WriteString(Section, 'AskHistory' + IntToStr(J), FAskHistory[J]);
end;
IniFile.WriteInteger(Section, 'Flags', Integer(FFlags));
IniFile.WriteInteger(Section, 'FormMode', FFormMode);
IniFile.WriteBool(Section, 'Enabled', FEnabled);
@ -571,6 +584,7 @@ begin
FSignatureList:= TSignatureList.Create;
FSignaturePositionList:= TSignaturePositionList.Create;
FFormat:= TStringList.Create;
FAskHistory:= TStringList.Create;
end;
destructor TMultiArcItem.Destroy;
@ -579,6 +593,7 @@ begin
FreeAndNil(FSignatureList);
FreeAndNil(FSignaturePositionList);
FreeAndNil(FFormat);
FreeAndNil(FAskHistory);
inherited Destroy;
end;
@ -690,6 +705,7 @@ begin
Result.FEnabled := Self.FEnabled;
Result.FOutput := Self.FOutput;
Result.FDebug := Self.FDebug;
Result.FAskHistory.Assign(Self.FAskHistory);
end;
{ TSignatureList }