ADD: implement IKASPathEditMate in TfrmCopyDlg, autocomplete is supported on various file sources

This commit is contained in:
rich2014 2026-05-31 23:13:08 +08:00
commit ef724fa7d2

View file

@ -26,7 +26,7 @@ unit fCopyMoveDlg;
interface
uses
SysUtils, Classes, Controls, Forms, StdCtrls, Buttons, ExtCtrls, Menus,
SysUtils, Classes, Controls, Forms, StdCtrls, ShellCtrls, Buttons, ExtCtrls, Menus,
ActnList, KASPathEdit, uFileSource, uFileViewNotebook, uFileSourceOperation,
uFileSourceOperationOptionsUI, uOperationsManager, uFormCommands;
@ -38,7 +38,7 @@ type
{ TfrmCopyDlg }
TfrmCopyDlg = class(TForm, IFormCommands)
TfrmCopyDlg = class(TForm, IFormCommands, IKASPathEditMate)
btnCancel: TBitBtn;
btnOK: TBitBtn;
btnAddToQueue: TBitBtn;
@ -91,6 +91,11 @@ type
procedure ShowOptions(bShow: Boolean);
procedure UpdateSize;
function getFilesAtPath(
const path: String;
const types: TObjectTypes;
const sort: TFileSortType ): TStringList;
property {%H-}Commands: TFormCommands read FCommands implements IFormCommands;
public
@ -113,8 +118,7 @@ implementation
{$R *.lfm}
uses
LazUTF8, fMain, LCLType, LCLVersion, uGlobs, uLng, uHotkeyManager,
uOSUtils, DCStrUtils;
LazUTF8, fMain, LCLType, LCLVersion, uGlobs, uLng, uHotkeyManager, DCStrUtils;
const
HotkeysCategory = 'Copy/Move Dialog';
@ -462,10 +466,7 @@ begin
if Assigned(Hotkey) then
btnAddToQueue.Caption := btnAddToQueue.Caption + ' (' + ShortcutsToText(Hotkey.Shortcuts) + ')';
if FDestFileSource.ClassName = 'TFileSystemFileSource' then
edtDst.GetFilesFunc:= @GetFilesInDir
else
edtDst.GetFilesFunc:= nil;
edtDst.Mate:= self;
end;
procedure TfrmCopyDlg.FormDestroy(Sender: TObject);
@ -488,6 +489,14 @@ begin
Self.Height := pnlOptions.Top;
end;
function TfrmCopyDlg.getFilesAtPath(
const path: String;
const types: TObjectTypes;
const sort: TFileSortType ): TStringList;
begin
Result:= FDestFileSource.GetFilesForPathAndType( path, types, sort );
end;
initialization
TFormCommands.RegisterCommandsForm(TfrmCopyDlg, HotkeysCategory, @rsHotkeyCategoryCopyMoveDialog);