mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Sftp - enable ssh2 from configuration dialog
This commit is contained in:
parent
28b52c8f19
commit
f37ec5dfca
2 changed files with 111 additions and 63 deletions
|
|
@ -13,15 +13,15 @@ object DialogBox: TDialogBox
|
|||
ClientWidth = 420
|
||||
OnShow = DialogBoxShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.6.0.3'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object lblName: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = edtName
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 98
|
||||
Height = 17
|
||||
Top = 15
|
||||
Width = 102
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Connection name:'
|
||||
ParentColor = False
|
||||
|
|
@ -31,7 +31,7 @@ object DialogBox: TDialogBox
|
|||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 12
|
||||
Width = 260
|
||||
|
|
@ -45,9 +45,9 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Control = edtHost
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 45
|
||||
Width = 61
|
||||
Height = 17
|
||||
Top = 44
|
||||
Width = 64
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Host[:Port]:'
|
||||
ParentColor = False
|
||||
|
|
@ -58,7 +58,7 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtName
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 41
|
||||
Width = 260
|
||||
|
|
@ -71,9 +71,9 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Control = edtUserName
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 105
|
||||
Width = 59
|
||||
Height = 17
|
||||
Top = 104
|
||||
Width = 66
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'User name:'
|
||||
ParentColor = False
|
||||
|
|
@ -84,13 +84,13 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = btnAnonymous
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 101
|
||||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 4
|
||||
TabOrder = 5
|
||||
end
|
||||
object btnAnonymous: TButton
|
||||
AnchorSideLeft.Control = edtHost
|
||||
|
|
@ -98,7 +98,7 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtHost
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 25
|
||||
Top = 70
|
||||
Width = 260
|
||||
|
|
@ -106,7 +106,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 6
|
||||
Caption = 'Anonymous'
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 3
|
||||
TabOrder = 4
|
||||
end
|
||||
object edtRemoteDir: TEdit
|
||||
AnchorSideLeft.Control = edtPassword
|
||||
|
|
@ -114,22 +114,22 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtPassword
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 215
|
||||
Top = 219
|
||||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 8
|
||||
TabOrder = 9
|
||||
end
|
||||
object lblRemoteDir: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = edtRemoteDir
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 219
|
||||
Width = 61
|
||||
Height = 17
|
||||
Top = 222
|
||||
Width = 65
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Remote dir:'
|
||||
ParentColor = False
|
||||
|
|
@ -139,15 +139,15 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Control = edtInitCommands
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 285
|
||||
Width = 294
|
||||
Height = 22
|
||||
Top = 289
|
||||
Width = 325
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 18
|
||||
Caption = 'Use passive mode for transfers (like a WWW browser)'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 10
|
||||
TabOrder = 11
|
||||
end
|
||||
object btnCancel: TButton
|
||||
AnchorSideTop.Control = chkPassiveMode
|
||||
|
|
@ -155,30 +155,30 @@ object DialogBox: TDialogBox
|
|||
AnchorSideRight.Control = edtRemoteDir
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 313
|
||||
Left = 317
|
||||
Height = 25
|
||||
Top = 316
|
||||
Top = 323
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 12
|
||||
TabOrder = 13
|
||||
end
|
||||
object btnOK: TButton
|
||||
AnchorSideTop.Control = btnCancel
|
||||
AnchorSideRight.Control = btnCancel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 226
|
||||
Left = 230
|
||||
Height = 25
|
||||
Top = 316
|
||||
Top = 323
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 12
|
||||
Caption = '&OK'
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 11
|
||||
TabOrder = 12
|
||||
end
|
||||
object edtPassword: TEdit
|
||||
AnchorSideLeft.Control = edtUserName
|
||||
|
|
@ -186,7 +186,7 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtUserName
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 130
|
||||
Width = 260
|
||||
|
|
@ -194,16 +194,16 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 6
|
||||
EchoMode = emPassword
|
||||
PasswordChar = '*'
|
||||
TabOrder = 5
|
||||
TabOrder = 6
|
||||
end
|
||||
object lblPassword: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = edtPassword
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 134
|
||||
Width = 53
|
||||
Height = 17
|
||||
Top = 133
|
||||
Width = 58
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Password:'
|
||||
ParentColor = False
|
||||
|
|
@ -213,14 +213,14 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Control = lblPassword
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 161
|
||||
Width = 259
|
||||
Height = 22
|
||||
Top = 162
|
||||
Width = 282
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 12
|
||||
Caption = 'Use master password to protect the password'
|
||||
OnChange = CheckBoxChange
|
||||
TabOrder = 7
|
||||
TabOrder = 8
|
||||
end
|
||||
object btnChangePassword: TButton
|
||||
AnchorSideLeft.Control = edtUserName
|
||||
|
|
@ -228,7 +228,7 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtUserName
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 25
|
||||
Top = 130
|
||||
Width = 260
|
||||
|
|
@ -236,7 +236,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 6
|
||||
Caption = 'Change password...'
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 6
|
||||
TabOrder = 7
|
||||
Visible = False
|
||||
end
|
||||
object edtInitCommands: TEdit
|
||||
|
|
@ -245,22 +245,22 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtRemoteDir
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 244
|
||||
Top = 248
|
||||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 9
|
||||
TabOrder = 10
|
||||
end
|
||||
object lblInitCommands: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = edtInitCommands
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 248
|
||||
Width = 83
|
||||
Height = 17
|
||||
Top = 251
|
||||
Width = 87
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Init commands:'
|
||||
ParentColor = False
|
||||
|
|
@ -270,27 +270,44 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Control = btnAnonymous
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 19
|
||||
Top = 73
|
||||
Width = 62
|
||||
Height = 22
|
||||
Top = 71
|
||||
Width = 45
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'SSL/TLS'
|
||||
Caption = 'TLS'
|
||||
OnChange = CheckBoxChange
|
||||
TabOrder = 2
|
||||
end
|
||||
object chkOpenSSH: TCheckBox
|
||||
AnchorSideLeft.Control = chkAutoTLS
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = chkAutoTLS
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = lblName
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 61
|
||||
Height = 22
|
||||
Top = 71
|
||||
Width = 53
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 4
|
||||
Caption = 'SSH'
|
||||
OnChange = CheckBoxChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object cmbEncoding: TComboBox
|
||||
AnchorSideLeft.Control = edtPassword
|
||||
AnchorSideTop.Control = chkMasterPassword
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edtPassword
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 132
|
||||
Height = 23
|
||||
Top = 186
|
||||
Top = 190
|
||||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
ItemHeight = 15
|
||||
ItemHeight = 17
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'Auto'
|
||||
|
|
@ -319,7 +336,7 @@ object DialogBox: TDialogBox
|
|||
'ISO-8859-15'
|
||||
)
|
||||
Style = csDropDownList
|
||||
TabOrder = 13
|
||||
TabOrder = 14
|
||||
Text = 'Auto'
|
||||
end
|
||||
object lblEncoding: TLabel
|
||||
|
|
@ -327,9 +344,9 @@ object DialogBox: TDialogBox
|
|||
AnchorSideTop.Control = cmbEncoding
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 190
|
||||
Width = 53
|
||||
Height = 17
|
||||
Top = 193
|
||||
Width = 55
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'Encoding:'
|
||||
ParentColor = False
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ function ShowFtpConfDlg: Boolean;
|
|||
implementation
|
||||
|
||||
uses
|
||||
LazUTF8, FtpFunc, FtpUtils, blcksock, ssl_openssl_lib;
|
||||
LazUTF8, DynLibs, FtpFunc, FtpUtils, blcksock, ssl_openssl_lib, libssh;
|
||||
|
||||
procedure ShowWarningSSL;
|
||||
begin
|
||||
|
|
@ -51,6 +51,18 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure ShowWarningSSH;
|
||||
begin
|
||||
with gStartupInfo do
|
||||
begin
|
||||
MessageBox(PAnsiChar('LibSSH2 library not found!' + LineEnding +
|
||||
'To use SSH2 connections, please install the LibSSH2 ' +
|
||||
'library (' + LibSSHName + ')!'),
|
||||
'LibSSH2', MB_OK or MB_ICONERROR
|
||||
);
|
||||
end;
|
||||
end;
|
||||
|
||||
function DlgProc (pDlg: PtrUInt; DlgItemName: PAnsiChar; Msg, wParam, lParam: PtrInt): PtrInt; dcpcall;
|
||||
var
|
||||
Data: PtrInt;
|
||||
|
|
@ -102,6 +114,8 @@ begin
|
|||
SendDlgMsg(pDlg, 'chkPassiveMode', DM_SETCHECK, Data, 0);
|
||||
Data:= PtrInt(gConnection.AutoTLS);
|
||||
SendDlgMsg(pDlg, 'chkAutoTLS', DM_SETCHECK, Data, 0);
|
||||
Data:= PtrInt(gConnection.OpenSSH);
|
||||
SendDlgMsg(pDlg, 'chkOpenSSH', DM_SETCHECK, Data, 0);
|
||||
end;
|
||||
DN_CHANGE:
|
||||
begin
|
||||
|
|
@ -111,8 +125,8 @@ begin
|
|||
gConnection.MasterPassword:= Boolean(Data);
|
||||
if not gConnection.MasterPassword then
|
||||
DeletePassword(gConnection.ConnectionName);
|
||||
end;
|
||||
if DlgItemName = 'chkAutoTLS' then
|
||||
end
|
||||
else if DlgItemName = 'chkAutoTLS' then
|
||||
begin
|
||||
Data:= SendDlgMsg(pDlg, 'chkAutoTLS', DM_GETCHECK, 0, 0);
|
||||
gConnection.AutoTLS:= Boolean(Data);
|
||||
|
|
@ -125,6 +139,23 @@ begin
|
|||
Data:= PtrInt(gConnection.AutoTLS);
|
||||
SendDlgMsg(pDlg, 'chkAutoTLS', DM_SETCHECK, Data, 0);
|
||||
end;
|
||||
SendDlgMsg(pDlg, 'chkOpenSSH', DM_SETCHECK, 0, 0);
|
||||
end;
|
||||
end
|
||||
else if DlgItemName = 'chkOpenSSH' then
|
||||
begin
|
||||
Data:= SendDlgMsg(pDlg, 'chkOpenSSH', DM_GETCHECK, 0, 0);
|
||||
gConnection.OpenSSH:= Boolean(Data);
|
||||
if gConnection.OpenSSH then
|
||||
begin
|
||||
if libssh2 = NilHandle then
|
||||
begin
|
||||
ShowWarningSSH;
|
||||
gConnection.OpenSSH:= False;
|
||||
Data:= PtrInt(gConnection.OpenSSH);
|
||||
SendDlgMsg(pDlg, 'chkOpenSSH', DM_SETCHECK, Data, 0);
|
||||
end;
|
||||
SendDlgMsg(pDlg, 'chkAutoTLS', DM_SETCHECK, 0, 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue