mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 01:56:36 +08:00
Add session menu items to main menu, submenu of "File" : "Connect to"
This commit is contained in:
@ -1547,6 +1547,7 @@ object MainForm: TMainForm
|
||||
end
|
||||
end
|
||||
object MainMenu1: TMainMenu
|
||||
AutoHotkeys = maManual
|
||||
Images = PngImageListMain
|
||||
Left = 40
|
||||
Top = 64
|
||||
@ -1554,10 +1555,15 @@ object MainForm: TMainForm
|
||||
Tag = 17
|
||||
Caption = '&File'
|
||||
Hint = 'File related commands'
|
||||
OnClick = File1Click
|
||||
object FileNewItem: TMenuItem
|
||||
Tag = 23
|
||||
Action = actOpenSession
|
||||
end
|
||||
object menuConnectTo: TMenuItem
|
||||
Caption = 'Connect to'
|
||||
Enabled = False
|
||||
end
|
||||
object N1: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
|
@ -458,6 +458,7 @@ type
|
||||
actNextTab: TNextTab;
|
||||
Nexttab1: TMenuItem;
|
||||
Previoustab1: TMenuItem;
|
||||
menuConnectTo: TMenuItem;
|
||||
procedure refreshMonitorConfig;
|
||||
procedure loadWindowConfig;
|
||||
procedure saveWindowConfig;
|
||||
@ -731,6 +732,7 @@ type
|
||||
NewHeight: Integer; var Resize: Boolean);
|
||||
procedure DataGridMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
Shift: TShiftState; X, Y: Integer);
|
||||
procedure File1Click(Sender: TObject);
|
||||
private
|
||||
FDelimiter: String;
|
||||
uptime : Integer;
|
||||
@ -1966,6 +1968,38 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.File1Click(Sender: TObject);
|
||||
var
|
||||
Item: TMenuItem;
|
||||
i: Integer;
|
||||
Connections: TStringList;
|
||||
begin
|
||||
// Decide if "Connect to" menu should be enabled
|
||||
menuConnectTo.Enabled := False;
|
||||
if MainReg.OpenKey(REGPATH + REGKEY_SESSIONS, False) then begin
|
||||
menuConnectTo.Enabled := MainReg.HasSubKeys;
|
||||
if menuConnectTo.Enabled then begin
|
||||
// Add all sessions to submenu
|
||||
for i := menuConnectTo.Count - 1 downto 0 do
|
||||
menuConnectTo.Delete(i);
|
||||
Connections := TStringList.Create;
|
||||
MainReg.GetKeyNames(Connections);
|
||||
for i := 0 to Connections.Count - 1 do begin
|
||||
Item := TMenuItem.Create(menuConnectTo);
|
||||
Item.Caption := Connections[i];
|
||||
Item.OnClick := SessionConnect;
|
||||
Item.ImageIndex := 37;
|
||||
if Connections[i] = SessionName then begin
|
||||
Item.Checked := True;
|
||||
Item.ImageIndex := -1;
|
||||
end;
|
||||
menuConnectTo.Add(Item);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.actWebbrowse(Sender: TObject);
|
||||
begin
|
||||
// Browse to URL (hint)
|
||||
|
Reference in New Issue
Block a user