mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #362: turn edit box for SSH executable into a drop-down, providing plink files in application directory, plus newly supported ssh.exe
This commit is contained in:
@ -444,23 +444,6 @@ object connform: Tconnform
|
|||||||
TextHint = 'Your secure shell password'
|
TextHint = 'Your secure shell password'
|
||||||
OnChange = Modification
|
OnChange = Modification
|
||||||
end
|
end
|
||||||
object editSSHExe: TButtonedEdit
|
|
||||||
Left = 190
|
|
||||||
Top = 9
|
|
||||||
Width = 320
|
|
||||||
Height = 21
|
|
||||||
Anchors = [akLeft, akTop, akRight]
|
|
||||||
Images = MainForm.VirtualImageListMain
|
|
||||||
RightButton.ImageIndex = 51
|
|
||||||
RightButton.Visible = True
|
|
||||||
TabOrder = 0
|
|
||||||
Text = 'editSSHExe'
|
|
||||||
TextHint = 'Doubleclick to select file'
|
|
||||||
OnChange = editSSHExeChange
|
|
||||||
OnDblClick = PickFile
|
|
||||||
OnExit = editTrim
|
|
||||||
OnRightButtonClick = PickFile
|
|
||||||
end
|
|
||||||
object editSSHhost: TEdit
|
object editSSHhost: TEdit
|
||||||
Left = 190
|
Left = 190
|
||||||
Top = 36
|
Top = 36
|
||||||
@ -520,6 +503,16 @@ object connform: Tconnform
|
|||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
Wrap = True
|
Wrap = True
|
||||||
end
|
end
|
||||||
|
object comboSSHExe: TComboBox
|
||||||
|
Left = 190
|
||||||
|
Top = 8
|
||||||
|
Width = 320
|
||||||
|
Height = 22
|
||||||
|
Anchors = [akLeft, akTop, akRight]
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'comboSSHExe'
|
||||||
|
OnChange = Modification
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object tabAdvanced: TTabSheet
|
object tabAdvanced: TTabSheet
|
||||||
Caption = 'Advanced'
|
Caption = 'Advanced'
|
||||||
|
@ -12,7 +12,7 @@ uses
|
|||||||
Windows, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
Windows, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||||
VirtualTrees, Menus, Graphics, Generics.Collections, ActiveX, extra_controls, Messages,
|
VirtualTrees, Menus, Graphics, Generics.Collections, ActiveX, extra_controls, Messages,
|
||||||
dbconnection, gnugettext, SynRegExpr, System.Types, Vcl.GraphUtil, ADODB, StrUtils,
|
dbconnection, gnugettext, SynRegExpr, System.Types, Vcl.GraphUtil, ADODB, StrUtils,
|
||||||
System.Math, System.Actions, Vcl.ActnList, Vcl.StdActns;
|
System.Math, System.Actions, System.IOUtils, Vcl.ActnList, Vcl.StdActns;
|
||||||
|
|
||||||
type
|
type
|
||||||
Tconnform = class(TExtForm)
|
Tconnform = class(TExtForm)
|
||||||
@ -54,7 +54,6 @@ type
|
|||||||
lblSSHLocalPort: TLabel;
|
lblSSHLocalPort: TLabel;
|
||||||
lblSSHUser: TLabel;
|
lblSSHUser: TLabel;
|
||||||
lblSSHPassword: TLabel;
|
lblSSHPassword: TLabel;
|
||||||
editSSHExe: TButtonedEdit;
|
|
||||||
lblSSHExe: TLabel;
|
lblSSHExe: TLabel;
|
||||||
comboNetType: TComboBoxEx;
|
comboNetType: TComboBoxEx;
|
||||||
lblSSHhost: TLabel;
|
lblSSHhost: TLabel;
|
||||||
@ -136,6 +135,7 @@ type
|
|||||||
lblLogFile: TLabel;
|
lblLogFile: TLabel;
|
||||||
chkLogFileDml: TCheckBox;
|
chkLogFileDml: TCheckBox;
|
||||||
timerEditFilterDelay: TTimer;
|
timerEditFilterDelay: TTimer;
|
||||||
|
comboSSHExe: TComboBox;
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure btnOpenClick(Sender: TObject);
|
procedure btnOpenClick(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@ -162,7 +162,6 @@ type
|
|||||||
procedure ListSessionsCreateEditor(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
|
procedure ListSessionsCreateEditor(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
|
||||||
out EditLink: IVTEditLink);
|
out EditLink: IVTEditLink);
|
||||||
procedure PickFile(Sender: TObject);
|
procedure PickFile(Sender: TObject);
|
||||||
procedure editSSHExeChange(Sender: TObject);
|
|
||||||
procedure editHostChange(Sender: TObject);
|
procedure editHostChange(Sender: TObject);
|
||||||
procedure editDatabasesRightButtonClick(Sender: TObject);
|
procedure editDatabasesRightButtonClick(Sender: TObject);
|
||||||
procedure chkLoginPromptClick(Sender: TObject);
|
procedure chkLoginPromptClick(Sender: TObject);
|
||||||
@ -255,13 +254,14 @@ end;
|
|||||||
|
|
||||||
procedure Tconnform.FormCreate(Sender: TObject);
|
procedure Tconnform.FormCreate(Sender: TObject);
|
||||||
var
|
var
|
||||||
NetTypeStr, FilenameHint: String;
|
NetTypeStr, FilenameHint, ExePath, ExeFile: String;
|
||||||
nt: TNetType;
|
nt: TNetType;
|
||||||
ntg: TNetTypeGroup;
|
ntg: TNetTypeGroup;
|
||||||
Params: TConnectionParameters;
|
Params: TConnectionParameters;
|
||||||
ComboItem: TComboExItem;
|
ComboItem: TComboExItem;
|
||||||
Placeholders: TStringList;
|
Placeholders: TStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
ExeFiles: TStringDynArray;
|
||||||
begin
|
begin
|
||||||
// Fix GUI stuff
|
// Fix GUI stuff
|
||||||
HasSizeGrip := True;
|
HasSizeGrip := True;
|
||||||
@ -296,6 +296,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
Placeholders.Free;
|
Placeholders.Free;
|
||||||
editLogFilePath.Hint := FilenameHint;
|
editLogFilePath.Hint := FilenameHint;
|
||||||
|
|
||||||
|
// Populate dropdown with supported SSH executables
|
||||||
|
ExeFiles := TDirectory.GetFiles(ExtractFilePath(ParamStr(0)), '*.exe');
|
||||||
|
for ExePath in ExeFiles do begin
|
||||||
|
ExeFile := ExtractFileName(ExePath);
|
||||||
|
if ExecRegExprI('([pk]link|putty)', ExeFile) then begin
|
||||||
|
comboSSHExe.Items.Add(ExeFile);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
SetLength(ExeFiles, 0);
|
||||||
|
comboSSHExe.Items.Add('ssh.exe');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -467,7 +478,7 @@ begin
|
|||||||
Sess.AllDatabasesStr := editDatabases.Text;
|
Sess.AllDatabasesStr := editDatabases.Text;
|
||||||
Sess.Comment := memoComment.Text;
|
Sess.Comment := memoComment.Text;
|
||||||
Sess.StartupScriptFilename := editStartupScript.Text;
|
Sess.StartupScriptFilename := editStartupScript.Text;
|
||||||
Sess.SSHExe := editSSHExe.Text;
|
Sess.SSHExe := comboSSHExe.Text;
|
||||||
Sess.SSHHost := editSSHhost.Text;
|
Sess.SSHHost := editSSHhost.Text;
|
||||||
Sess.SSHPort := MakeInt(editSSHport.Text);
|
Sess.SSHPort := MakeInt(editSSHport.Text);
|
||||||
Sess.SSHUser := editSSHUser.Text;
|
Sess.SSHUser := editSSHUser.Text;
|
||||||
@ -690,7 +701,7 @@ begin
|
|||||||
Result.SSHTimeout := updownSSHTimeout.Position;
|
Result.SSHTimeout := updownSSHTimeout.Position;
|
||||||
Result.SSHPrivateKey := editSSHPrivateKey.Text;
|
Result.SSHPrivateKey := editSSHPrivateKey.Text;
|
||||||
Result.SSHLocalPort := MakeInt(editSSHlocalport.Text);
|
Result.SSHLocalPort := MakeInt(editSSHlocalport.Text);
|
||||||
Result.SSHExe := editSSHexe.Text;
|
Result.SSHExe := comboSSHExe.Text;
|
||||||
Result.WantSSL := chkWantSSL.Checked;
|
Result.WantSSL := chkWantSSL.Checked;
|
||||||
Result.SSLPrivateKey := editSSLPrivateKey.Text;
|
Result.SSLPrivateKey := editSSLPrivateKey.Text;
|
||||||
Result.SSLCertificate := editSSLCertificate.Text;
|
Result.SSLCertificate := editSSLCertificate.Text;
|
||||||
@ -976,7 +987,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
memoComment.Text := Sess.Comment;
|
memoComment.Text := Sess.Comment;
|
||||||
editStartupScript.Text := Sess.StartupScriptFilename;
|
editStartupScript.Text := Sess.StartupScriptFilename;
|
||||||
editSSHExe.Text := Sess.SSHExe;
|
comboSSHExe.Text := Sess.SSHExe;
|
||||||
editSSHHost.Text := Sess.SSHHost;
|
editSSHHost.Text := Sess.SSHHost;
|
||||||
editSSHport.Text := IntToStr(Sess.SSHPort);
|
editSSHport.Text := IntToStr(Sess.SSHPort);
|
||||||
editSSHUser.Text := Sess.SSHUser;
|
editSSHUser.Text := Sess.SSHUser;
|
||||||
@ -1325,7 +1336,7 @@ begin
|
|||||||
or (Sess.Comment <> memoComment.Text)
|
or (Sess.Comment <> memoComment.Text)
|
||||||
or (Sess.SSHHost <> editSSHHost.Text)
|
or (Sess.SSHHost <> editSSHHost.Text)
|
||||||
or (IntToStr(Sess.SSHPort) <> editSSHPort.Text)
|
or (IntToStr(Sess.SSHPort) <> editSSHPort.Text)
|
||||||
or (Sess.SSHExe <> editSSHExe.Text)
|
or (Sess.SSHExe <> comboSSHExe.Text)
|
||||||
or (IntToStr(Sess.SSHLocalPort) <> editSSHlocalport.Text)
|
or (IntToStr(Sess.SSHLocalPort) <> editSSHlocalport.Text)
|
||||||
or (Sess.SSHUser <> editSSHUser.Text)
|
or (Sess.SSHUser <> editSSHUser.Text)
|
||||||
or (Sess.SSHPassword <> editSSHPassword.Text)
|
or (Sess.SSHPassword <> editSSHPassword.Text)
|
||||||
@ -1525,8 +1536,6 @@ begin
|
|||||||
Selector.DefaultExt := FILEEXT_SQLITEDB;
|
Selector.DefaultExt := FILEEXT_SQLITEDB;
|
||||||
end else if (Edit = editStartupScript) or (Edit = editLogFilePath) then
|
end else if (Edit = editStartupScript) or (Edit = editLogFilePath) then
|
||||||
Selector.Filter := _('SQL files')+' (*.sql)|*.sql|'+_('All files')+' (*.*)|*.*'
|
Selector.Filter := _('SQL files')+' (*.sql)|*.sql|'+_('All files')+' (*.*)|*.*'
|
||||||
else if Edit = editSSHExe then
|
|
||||||
Selector.Filter := _('Executables')+' (*.exe)|*.exe|'+_('All files')+' (*.*)|*.*'
|
|
||||||
else if Edit = editSSHPrivateKey then
|
else if Edit = editSSHPrivateKey then
|
||||||
Selector.Filter := _('All files')+' (*.*)|*.*'
|
Selector.Filter := _('All files')+' (*.*)|*.*'
|
||||||
else
|
else
|
||||||
@ -1577,17 +1586,4 @@ begin
|
|||||||
editSearch.Clear;
|
editSearch.Clear;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Tconnform.editSSHExeChange(Sender: TObject);
|
|
||||||
var
|
|
||||||
Path: String;
|
|
||||||
begin
|
|
||||||
Path := editSSHExe.Text;
|
|
||||||
if (not FileExists(Path)) and Path.ToLowerInvariant.Contains('plink') then
|
|
||||||
editSSHExe.Font.Color := clRed
|
|
||||||
else
|
|
||||||
editSSHExe.Font.Color := GetThemeColor(clWindowText);
|
|
||||||
Modification(Sender);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user