mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Save file details to file action
This commit is contained in:
parent
48865cfec4
commit
6033aa7b57
5 changed files with 78 additions and 19 deletions
|
|
@ -151,6 +151,7 @@ type
|
|||
procedure dgPanelResize(Sender: TObject);
|
||||
procedure dgPanelHeaderSized(Sender: TObject; IsColumn: Boolean; index: Integer);
|
||||
procedure ColumnsMenuClick(Sender: TObject);
|
||||
procedure CopyFileDetails(AList: TStringList);
|
||||
|
||||
protected
|
||||
procedure CreateDefault(AOwner: TWinControl); override;
|
||||
|
|
@ -210,6 +211,7 @@ type
|
|||
|
||||
property OnColumnResized: TColumnResized read FOnColumnResized write FOnColumnResized;
|
||||
published
|
||||
procedure cm_SaveFileDetailsToFile(const Params: array of string);
|
||||
procedure cm_CopyFileDetailsToClip(const Params: array of string);
|
||||
|
||||
end;
|
||||
|
|
@ -218,8 +220,8 @@ implementation
|
|||
|
||||
uses
|
||||
LCLProc, Buttons, Clipbrd, DCStrUtils, uLng, uGlobs, uPixmapManager, uDebug,
|
||||
uDCUtils, math, fMain, fOptions, uClipboard,
|
||||
uOrderedFileView,
|
||||
DCClassesUtf8, dmCommonData, uDCUtils, math, fMain, fOptions, uClipboard,
|
||||
uOrderedFileView, uShowMsg,
|
||||
uFileSourceProperty,
|
||||
uKeyboard,
|
||||
uFileFunctions,
|
||||
|
|
@ -1211,10 +1213,9 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.cm_CopyFileDetailsToClip(const Params: array of string);
|
||||
procedure TColumnsFileView.CopyFileDetails(AList: TStringList);
|
||||
var
|
||||
I: Integer;
|
||||
sl: TStringList;
|
||||
AFile: TDisplayFile;
|
||||
ColumnsClass: TPanelColumnsClass;
|
||||
|
||||
|
|
@ -1235,28 +1236,35 @@ var
|
|||
S:= S + AFile.DisplayStrings[J] + #09;
|
||||
end;
|
||||
J:= Length(S);
|
||||
if J > 0 then sl.Add(Copy(S, 1, J - 1));
|
||||
if J > 0 then AList.Add(Copy(S, 1, J - 1));
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
ColumnsClass:= GetColumnsClass;
|
||||
|
||||
for I:= 0 to FFiles.Count - 1 do
|
||||
begin
|
||||
AFile:= FFiles[I];
|
||||
if AFile.Selected then AddFile;
|
||||
end;
|
||||
|
||||
if AList.Count = 0 then
|
||||
begin
|
||||
AFile:= GetActiveDisplayFile;
|
||||
AddFile;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.cm_CopyFileDetailsToClip(const Params: array of string);
|
||||
var
|
||||
sl: TStringList;
|
||||
begin
|
||||
if DisplayFiles.Count > 0 then
|
||||
begin
|
||||
sl:= TStringList.Create;
|
||||
try
|
||||
ColumnsClass:= GetColumnsClass;
|
||||
|
||||
for I:= 0 to FFiles.Count - 1 do
|
||||
begin
|
||||
AFile:= FFiles[I];
|
||||
if AFile.Selected then AddFile;
|
||||
end;
|
||||
|
||||
if sl.Count = 0 then
|
||||
begin
|
||||
AFile:= GetActiveDisplayFile;
|
||||
AddFile;
|
||||
end;
|
||||
CopyFileDetails(sl);
|
||||
|
||||
Clipboard.Clear; // prevent multiple formats in Clipboard
|
||||
ClipboardSetText(TrimRightLineEnding(sl.Text, sl.TextLineBreakStyle));
|
||||
|
|
@ -1266,6 +1274,43 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TColumnsFileView.cm_SaveFileDetailsToFile(const Params: array of string);
|
||||
var
|
||||
AFileName: String;
|
||||
sl: TStringListEx;
|
||||
begin
|
||||
if DisplayFiles.Count > 0 then
|
||||
begin
|
||||
if Length(Params) > 0 then
|
||||
AFileName:= Params[0]
|
||||
else begin
|
||||
with dmComData do
|
||||
begin
|
||||
SaveDialog.DefaultExt := '.txt';
|
||||
SaveDialog.Filter := '*.txt|*.txt';
|
||||
SaveDialog.FileName := EmptyStr;
|
||||
|
||||
if not SaveDialog.Execute then Exit;
|
||||
AFileName:= SaveDialog.FileName;
|
||||
end;
|
||||
end;
|
||||
|
||||
if (AFileName <> EmptyStr) then
|
||||
try
|
||||
sl:= TStringListEx.Create;
|
||||
try
|
||||
CopyFileDetails(sl);
|
||||
sl.SaveToFile(AFileName);
|
||||
finally
|
||||
FreeAndNil(sl);
|
||||
end;
|
||||
except
|
||||
on E: Exception do
|
||||
msgError(rsMsgErrSaveFile + '-' + E.Message);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TDrawGridEx }
|
||||
|
||||
constructor TDrawGridEx.Create(AOwner: TComponent; AParent: TWinControl);
|
||||
|
|
|
|||
|
|
@ -2834,6 +2834,12 @@ object frmMain: TfrmMain
|
|||
Hint = 'Load list of files/folders from the specified text file'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
object actSaveFileDetailsToFile: TAction
|
||||
Tag = 10
|
||||
Category = 'Mark'
|
||||
Caption = 'Save all shown columns to file'
|
||||
OnExecute = actExecute
|
||||
end
|
||||
end
|
||||
object pmHotList: TPopupMenu
|
||||
Images = imgLstDirectoryHotlist
|
||||
|
|
@ -4166,4 +4172,4 @@ object frmMain: TfrmMain
|
|||
left = 128
|
||||
top = 152
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -258,6 +258,7 @@
|
|||
{"hash":91735966,"name":"tfrmmain.actaddplugin.caption","sourcebytes":[65,100,100,32,80,108,117,103,105,110],"value":"Add Plugin"},
|
||||
{"hash":124093428,"name":"tfrmmain.actloadlist.caption","sourcebytes":[76,111,97,100,32,76,105,115,116],"value":"Load List"},
|
||||
{"hash":228327845,"name":"tfrmmain.actloadlist.hint","sourcebytes":[76,111,97,100,32,108,105,115,116,32,111,102,32,102,105,108,101,115,47,102,111,108,100,101,114,115,32,102,114,111,109,32,116,104,101,32,115,112,101,99,105,102,105,101,100,32,116,101,120,116,32,102,105,108,101],"value":"Load list of files/folders from the specified text file"},
|
||||
{"hash":230704005,"name":"tfrmmain.actsavefiledetailstofile.caption","sourcebytes":[83,97,118,101,32,97,108,108,32,115,104,111,119,110,32,99,111,108,117,109,110,115,32,116,111,32,102,105,108,101],"value":"Save all shown columns to file"},
|
||||
{"hash":310020,"name":"tfrmmain.tbedit.caption","sourcebytes":[69,100,105,116],"value":"Edit"},
|
||||
{"hash":78392485,"name":"tfrmmain.tbdelete.caption","sourcebytes":[68,101,108,101,116,101],"value":"Delete"},
|
||||
{"hash":1140,"name":"tfrmmain.tbchangedir.caption","sourcebytes":[67,68],"value":"CD"},
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ type
|
|||
|
||||
TfrmMain = class(TAloneForm, IFormCommands)
|
||||
actAddPlugin: TAction;
|
||||
actSaveFileDetailsToFile: TAction;
|
||||
actLoadList: TAction;
|
||||
actExtractFiles: TAction;
|
||||
actAddPathToCmdLine: TAction;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ type
|
|||
procedure cm_ContextMenu(const Params: array of string);
|
||||
procedure cm_CopyFullNamesToClip(const {%H-}Params: array of string);
|
||||
procedure cm_CopyFileDetailsToClip(const {%H-}Params: array of string);
|
||||
procedure cm_SaveFileDetailsToFile(const {%H-}Params: array of string);
|
||||
procedure cm_Exchange(const {%H-}Params: array of string);
|
||||
procedure cm_FlatView(const {%H-}Params: array of string);
|
||||
procedure cm_FlatViewSel(const {%H-}Params: array of string);
|
||||
|
|
@ -1048,6 +1049,11 @@ begin
|
|||
frmMain.ActiveFrame.ExecuteCommand('cm_ContextMenu', Params);
|
||||
end;
|
||||
|
||||
procedure TMainCommands.cm_SaveFileDetailsToFile(const Params: array of string);
|
||||
begin
|
||||
frmMain.ActiveFrame.ExecuteCommand('cm_SaveFileDetailsToFile', []);
|
||||
end;
|
||||
|
||||
procedure TMainCommands.cm_CopyFullNamesToClip(const Params: array of string);
|
||||
begin
|
||||
DoCopySelectedFileNamesToClipboard(frmMain.ActiveFrame, cfntcPathAndFileNames);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue