mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Command cm_LoadList
This commit is contained in:
parent
ed797fe36d
commit
dd6aebb99f
3 changed files with 72 additions and 0 deletions
|
|
@ -2815,6 +2815,13 @@ object frmMain: TfrmMain
|
|||
Caption = 'Add Plugin'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actLoadList: TAction
|
||||
Tag = 7
|
||||
Category = 'Miscellaneous'
|
||||
Caption = 'Load List'
|
||||
Hint = 'Load list of files/folders from the specified text file'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
end
|
||||
object pmHotList: TPopupMenu
|
||||
Images = imgLstDirectoryHotlist
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ type
|
|||
|
||||
TfrmMain = class(TAloneForm, IFormCommands)
|
||||
actAddPlugin: TAction;
|
||||
actLoadList: TAction;
|
||||
actExtractFiles: TAction;
|
||||
actAddPathToCmdLine: TAction;
|
||||
actFileAssoc: TAction;
|
||||
|
|
|
|||
|
|
@ -369,6 +369,7 @@ type
|
|||
procedure cm_ConfigPlugins(const {%H-}Params: array of string);
|
||||
procedure cm_OpenDriveByIndex(const Params: array of string);
|
||||
procedure cm_AddPlugin(const Params: array of string);
|
||||
procedure cm_LoadList(const Params: array of string);
|
||||
|
||||
// Internal commands
|
||||
procedure cm_ExecuteToolbarItem(const Params: array of string);
|
||||
|
|
@ -5368,5 +5369,68 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TMainCommands.cm_LoadList(const Params: array of string);
|
||||
var
|
||||
aFile: TFile;
|
||||
sValue: String;
|
||||
AParam: String;
|
||||
Index: Integer;
|
||||
AFileName: String;
|
||||
FileList: TFileTree;
|
||||
NewPage: TFileViewPage;
|
||||
StringList: TStringListUAC;
|
||||
Notebook: TFileViewNotebook;
|
||||
SearchResultFS: ISearchResultFileSource;
|
||||
begin
|
||||
with frmMain do
|
||||
begin
|
||||
AFileName:= EmptyStr;
|
||||
Notebook := ActiveNotebook;
|
||||
for AParam in Params do
|
||||
begin
|
||||
if GetParamValue(AParam, 'filename', sValue) then
|
||||
AFileName := sValue
|
||||
else if GetParamValue(AParam, 'side', sValue) then
|
||||
begin
|
||||
if sValue = 'left' then Notebook := LeftTabs
|
||||
else if sValue = 'right' then Notebook := RightTabs
|
||||
else if sValue = 'active' then Notebook := ActiveNotebook
|
||||
else if sValue = 'inactive' then Notebook := NotActiveNotebook;
|
||||
end;
|
||||
end;
|
||||
if (Length(AFileName) = 0) then
|
||||
begin
|
||||
msgError(rsMsgInvalidFilename);
|
||||
Exit;
|
||||
end;
|
||||
StringList:= TStringListUAC.Create;
|
||||
try
|
||||
StringList.LoadFromFile(AFileName);
|
||||
|
||||
FileList := TFileTree.Create;
|
||||
|
||||
for Index := 0 to StringList.Count - 1 do
|
||||
begin
|
||||
try
|
||||
aFile := TFileSystemFileSource.CreateFileFromFile(StringList[Index]);
|
||||
FileList.AddSubNode(aFile);
|
||||
except
|
||||
on EFileNotFound do ;
|
||||
end;
|
||||
end;
|
||||
SearchResultFS := TSearchResultFileSource.Create;
|
||||
SearchResultFS.AddList(FileList, TFileSystemFileSource.GetFileSource);
|
||||
|
||||
NewPage := Notebook.ActivePage;
|
||||
NewPage.FileView.AddFileSource(SearchResultFS, SearchResultFS.GetRootDir);
|
||||
NewPage.FileView.FlatView := True;
|
||||
NewPage.MakeActive;
|
||||
except
|
||||
on E: Exception do msgError(E.Message);
|
||||
end;
|
||||
StringList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue