mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: FTP - Show file properties dialog
(cherry picked from commit f0320f65ce)
This commit is contained in:
parent
e2ccf2050a
commit
e56ad29b25
6 changed files with 187 additions and 2 deletions
|
|
@ -124,6 +124,7 @@ type
|
|||
function FileExists(const FileName: String): Boolean; virtual;
|
||||
function CreateDir(const Directory: string): Boolean; override;
|
||||
function ExecuteCommand(const Command: String): Boolean; virtual;
|
||||
function FileProperties(const FileName: String): Boolean; virtual;
|
||||
function CopyFile(const OldName, NewName: String): Boolean; virtual;
|
||||
function ChangeMode(const FileName, Mode: String): Boolean; virtual;
|
||||
function List(Directory: String; NameList: Boolean): Boolean; override;
|
||||
|
|
@ -790,6 +791,11 @@ begin
|
|||
Result:= (FTPCommand(Command) div 100) = 2;
|
||||
end;
|
||||
|
||||
function TFTPSendEx.FileProperties(const FileName: String): Boolean;
|
||||
begin
|
||||
Result:= (FTPCommand('STAT' + #32 + FileName) div 100) = 2;
|
||||
end;
|
||||
|
||||
function TFTPSendEx.CopyFile(const OldName, NewName: String): Boolean;
|
||||
begin
|
||||
Result:= False;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ implementation
|
|||
|
||||
uses
|
||||
IniFiles, StrUtils, FtpAdv, FtpUtils, FtpConfDlg, syncobjs, LazFileUtils,
|
||||
LazUTF8, DCClassesUtf8, DCConvertEncoding, SftpSend, ScpSend, FtpProxy;
|
||||
LazUTF8, DCClassesUtf8, DCConvertEncoding, SftpSend, ScpSend, FtpProxy,
|
||||
FtpPropDlg;
|
||||
|
||||
var
|
||||
DefaultIniName: String;
|
||||
|
|
@ -778,6 +779,17 @@ begin
|
|||
if (ExtractFileDir(RemoteName) = PathDelim) and not (RemoteName[1] in [#0, '<']) then // connection
|
||||
begin
|
||||
EditConnection(UTF16ToUTF8(RemoteName + 1));
|
||||
end
|
||||
else if (ExtractFileDir(RemoteName) <> PathDelim) then
|
||||
begin
|
||||
if GetConnectionByPath(RemoteName, FtpSend, asFileName) then
|
||||
begin
|
||||
if FtpSend.FileProperties(asFileName) then
|
||||
begin
|
||||
wsFileName:= FtpSend.ServerToClient(FtpSend.FullResult.Text);
|
||||
ShowPropertiesDlg(PAnsiChar(UTF8Encode(wsFileName)));
|
||||
end
|
||||
end;
|
||||
end;
|
||||
Result:= FS_EXEC_OK;
|
||||
end;
|
||||
|
|
|
|||
88
plugins/wfx/ftp/src/ftppropdlg.lfm
Normal file
88
plugins/wfx/ftp/src/ftppropdlg.lfm
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
object frmFileProperties: TfrmFileProperties
|
||||
Left = 290
|
||||
Height = 400
|
||||
Top = 175
|
||||
Width = 640
|
||||
Caption = 'Properties'
|
||||
ClientHeight = 400
|
||||
ClientWidth = 640
|
||||
Constraints.MinHeight = 223
|
||||
Constraints.MinWidth = 334
|
||||
DesignTimePPI = 107
|
||||
OnShow = DialogBoxShow
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '2.2.6.0'
|
||||
inline seProperties: TSynEdit
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = btnClose
|
||||
Left = 11
|
||||
Height = 334
|
||||
Top = 11
|
||||
Width = 618
|
||||
BorderSpacing.Left = 11
|
||||
BorderSpacing.Top = 11
|
||||
BorderSpacing.Right = 11
|
||||
BorderSpacing.Bottom = 11
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Color = clWindow
|
||||
Font.Color = clWindowText
|
||||
Font.Height = 14
|
||||
Font.Pitch = fpFixed
|
||||
Font.Quality = fqNonAntialiased
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
Gutter.Visible = False
|
||||
Gutter.Width = 0
|
||||
Gutter.MouseActions = <>
|
||||
RightGutter.Width = 0
|
||||
RightGutter.MouseActions = <>
|
||||
Keystrokes = <>
|
||||
MouseActions = <>
|
||||
MouseTextActions = <>
|
||||
MouseSelActions = <>
|
||||
Options = [eoAutoIndent, eoBracketHighlight, eoGroupUndo, eoNoCaret, eoScrollPastEol, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces]
|
||||
VisibleSpecialChars = [vscSpace, vscTabAtLast]
|
||||
ReadOnly = True
|
||||
ScrollBars = ssNone
|
||||
SelectedColor.BackPriority = 50
|
||||
SelectedColor.ForePriority = 50
|
||||
SelectedColor.FramePriority = 50
|
||||
SelectedColor.BoldPriority = 50
|
||||
SelectedColor.ItalicPriority = 50
|
||||
SelectedColor.UnderlinePriority = 50
|
||||
SelectedColor.StrikeOutPriority = 50
|
||||
BracketHighlightStyle = sbhsBoth
|
||||
BracketMatchColor.Background = clNone
|
||||
BracketMatchColor.Foreground = clNone
|
||||
BracketMatchColor.Style = [fsBold]
|
||||
FoldedCodeColor.Background = clNone
|
||||
FoldedCodeColor.Foreground = clGray
|
||||
FoldedCodeColor.FrameColor = clGray
|
||||
MouseLinkColor.Background = clNone
|
||||
MouseLinkColor.Foreground = clBlue
|
||||
LineHighlightColor.Background = clNone
|
||||
LineHighlightColor.Foreground = clNone
|
||||
inline SynLeftGutterPartList1: TSynGutterPartList
|
||||
end
|
||||
end
|
||||
object btnClose: TBitBtn
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 265
|
||||
Height = 33
|
||||
Top = 356
|
||||
Width = 111
|
||||
Anchors = [akLeft, akBottom]
|
||||
BorderSpacing.Bottom = 11
|
||||
Cancel = True
|
||||
Caption = '&Close'
|
||||
ModalResult = 2
|
||||
Kind = bkClose
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
71
plugins/wfx/ftp/src/ftppropdlg.pas
Normal file
71
plugins/wfx/ftp/src/ftppropdlg.pas
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
unit FtpPropDlg;
|
||||
|
||||
{$mode delphi}
|
||||
{$include calling.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Extension, FtpFunc;
|
||||
|
||||
function ShowPropertiesDlg(const AText: String): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
{$R ftppropdlg.lfm}
|
||||
|
||||
function DlgProc(pDlg: PtrUInt; DlgItemName: PAnsiChar; Msg, wParam, lParam: PtrInt): PtrInt; dcpcall;
|
||||
var
|
||||
Data: PtrInt;
|
||||
Text: PString absolute Data;
|
||||
begin
|
||||
Result:= 0;
|
||||
with gStartupInfo do
|
||||
begin
|
||||
case Msg of
|
||||
DN_INITDIALOG:
|
||||
begin
|
||||
Data:= SendDlgMsg(pDlg, 'btnClose', DM_GETDLGDATA, 0, 0);
|
||||
Data:= PtrInt(PAnsiChar(Text^));
|
||||
SendDlgMsg(pDlg, 'seProperties', DM_SETTEXT, Data, 0);
|
||||
end;
|
||||
end;
|
||||
end; // with
|
||||
end;
|
||||
|
||||
function ShowPropertiesDlg(const AText: String): Boolean;
|
||||
var
|
||||
ResHandle: TFPResourceHandle = 0;
|
||||
ResGlobal: TFPResourceHGLOBAL = 0;
|
||||
ResData: Pointer = nil;
|
||||
ResSize: LongWord;
|
||||
begin
|
||||
Result := False;
|
||||
try
|
||||
ResHandle := FindResource(HINSTANCE, PChar('TfrmFileProperties'), MAKEINTRESOURCE(10) {RT_RCDATA});
|
||||
if ResHandle <> 0 then
|
||||
begin
|
||||
ResGlobal := LoadResource(HINSTANCE, ResHandle);
|
||||
if ResGlobal <> 0 then
|
||||
begin
|
||||
ResData := LockResource(ResGlobal);
|
||||
ResSize := SizeofResource(HINSTANCE, ResHandle);
|
||||
|
||||
with gStartupInfo do
|
||||
begin
|
||||
Result := DialogBoxParam(ResData, ResSize, @DlgProc, DB_LRS, @AText, nil);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
finally
|
||||
if ResGlobal <> 0 then
|
||||
begin
|
||||
UnlockResource(ResGlobal);
|
||||
FreeResource(ResGlobal);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -76,6 +76,7 @@ type
|
|||
function DeleteDir(const Directory: string): Boolean; override;
|
||||
function DeleteFile(const FileName: string): Boolean; override;
|
||||
function ExecuteCommand(const Command: String): Boolean; override;
|
||||
function FileProperties(const FileName: String): Boolean; override;
|
||||
function CopyFile(const OldName, NewName: String): Boolean; override;
|
||||
function ChangeWorkingDir(const Directory: string): Boolean; override;
|
||||
function RenameFile(const OldName, NewName: string): Boolean; override;
|
||||
|
|
@ -672,6 +673,12 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function TScpSend.FileProperties(const FileName: String): Boolean;
|
||||
begin
|
||||
Result:= SendCommand('stat ' + EscapeNoQuotes(FileName), FAnswer);
|
||||
if Result then FFullResult.Text:= FAnswer;
|
||||
end;
|
||||
|
||||
function TScpSend.CopyFile(const OldName, NewName: String): Boolean;
|
||||
begin
|
||||
Result:= SendCommand('cp -p ' + EscapeNoQuotes(OldName) + ' ' + EscapeNoQuotes(NewName), FAnswer);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ interface
|
|||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||
Types, Buttons, ExtCtrls, EditBtn, Extension, ComCtrls, DividerBevel;
|
||||
Types, Buttons, ExtCtrls, EditBtn, Extension, ComCtrls, DividerBevel, SynEdit;
|
||||
|
||||
type
|
||||
|
||||
|
|
@ -49,6 +49,7 @@ type
|
|||
DialogEdit: TEdit;
|
||||
DialogMemo: TMemo;
|
||||
DialogImage: TImage;
|
||||
DialogSynEdit: TSynEdit;
|
||||
DialogTabSheet: TTabSheet;
|
||||
DialogScrollBox: TScrollBox;
|
||||
DialogRadioGroup: TRadioGroup;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue