ADD: Put all selected files to command line on drag&drop files on toolbar button

This commit is contained in:
Alexander Koblov 2012-01-14 10:23:05 +00:00
commit c09eee753b

View file

@ -662,7 +662,7 @@ implementation
uses
LCLIntf, LCLVersion, Dialogs, uGlobs, uLng, fConfigToolBar, uMasks, fCopyMoveDlg, uQuickViewPanel,
uShowMsg, fHotDir, uDCUtils, uLog, uGlobsPaths, LCLProc, uOSUtils, uOSForms, uPixMapManager,
uDragDropEx, uKeyboard, uFileSystemFileSource, fViewOperations,
uDragDropEx, uKeyboard, uFileSystemFileSource, fViewOperations, uMultiListFileSource,
uFileSourceOperationTypes, uFileSourceCopyOperation, uFileSourceMoveOperation,
fFileOpDlg, uFileSourceProperty, uFileSourceExecuteOperation, uArchiveFileSource,
uShellExecute, fSymLink, fHardLink, uExceptions, uUniqueInstance, Clipbrd,
@ -946,7 +946,8 @@ end;
procedure TfrmMain.MainToolBarToolButtonDragDrop(Sender, Source: TObject; X,
Y: Integer; NumberOfButton: Integer);
var
aFile: TFile;
I: LongWord;
SelectedFiles: TFiles = nil;
Cmd, Param, Path: string;
begin
if (ssShift in GetKeyShiftState) then
@ -954,17 +955,25 @@ begin
else
if Sender is TSpeedButton and not Draging then
begin
aFile := ActiveFrame.CloneActiveFile;
SelectedFiles := ActiveFrame.CloneSelectedFiles;
try
if Assigned(aFile) and aFile.IsNameValid then
if SelectedFiles.Count > 0 then
begin
Param:= EmptyStr;
for I := 0 to SelectedFiles.Count - 1 do
begin
// Workaround for not fully implemented TMultiListFileSource.
if ActiveFrame.FileSource.IsClass(TMultiListFileSource) then
Param := Param + QuoteStr(SelectedFiles[I].FullPath) + ' '
else
Param := Param + QuoteStr(ActiveFrame.CurrentAddress + SelectedFiles[I].FullPath) + ' ';
end;
Cmd:= MainToolBar.GetButtonX(NumberOfButton, CmdX);
Path:= MainToolBar.GetButtonX(NumberOfButton, PathX);
Param:= QuoteStr(aFile.FullPath);
ExecCmd(Cmd, Param, Path);
end;
finally
FreeAndNil(aFile);
FreeAndNil(SelectedFiles);
end;
end;
end;
@ -4896,4 +4905,4 @@ initialization
TFormCommands.RegisterCommandsForm(TfrmMain, HotkeysCategory, @rsHotkeyCategoryMain);
end.