mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-16 11:42:12 +08:00
Auto expand active database on startup. See http://www.heidisql.com/forum.php?t=7471
This commit is contained in:
@ -2769,7 +2769,7 @@ var
|
|||||||
SessionExists, RestoreLastActiveDatabase: Boolean;
|
SessionExists, RestoreLastActiveDatabase: Boolean;
|
||||||
StartupScript, StartupSQL, LastActiveDatabase: String;
|
StartupScript, StartupSQL, LastActiveDatabase: String;
|
||||||
StartupBatch: TSQLBatch;
|
StartupBatch: TSQLBatch;
|
||||||
SessionNode: PVirtualNode;
|
SessionNode, DBNode: PVirtualNode;
|
||||||
begin
|
begin
|
||||||
Connection := TMySQLConnection.Create(Self);
|
Connection := TMySQLConnection.Create(Self);
|
||||||
Connection.OnLog := LogSQL;
|
Connection.OnLog := LogSQL;
|
||||||
@ -2814,9 +2814,12 @@ begin
|
|||||||
// Set focus on last uses db. If not wanted or db is gone, go to root node at least
|
// Set focus on last uses db. If not wanted or db is gone, go to root node at least
|
||||||
RestoreLastActiveDatabase := GetRegValue(REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB);
|
RestoreLastActiveDatabase := GetRegValue(REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB);
|
||||||
LastActiveDatabase := GetRegValue(REGNAME_LASTUSEDDB, '', Session);
|
LastActiveDatabase := GetRegValue(REGNAME_LASTUSEDDB, '', Session);
|
||||||
if RestoreLastActiveDatabase and (Connection.AllDatabases.IndexOf(LastActiveDatabase) >- 1) then
|
if RestoreLastActiveDatabase and (Connection.AllDatabases.IndexOf(LastActiveDatabase) >- 1) then begin
|
||||||
SetActiveDatabase(LastActiveDatabase, Connection)
|
SetActiveDatabase(LastActiveDatabase, Connection);
|
||||||
else begin
|
DBNode := FindDBNode(DBtree, LastActiveDatabase);
|
||||||
|
if Assigned(DBNode) then
|
||||||
|
DBtree.Expanded[DBNode] := True;
|
||||||
|
end else begin
|
||||||
SessionNode := GetRootNode(DBtree, Connection);
|
SessionNode := GetRootNode(DBtree, Connection);
|
||||||
SelectNode(DBtree, SessionNode);
|
SelectNode(DBtree, SessionNode);
|
||||||
DBtree.Expanded[SessionNode] := True;
|
DBtree.Expanded[SessionNode] := True;
|
||||||
|
Reference in New Issue
Block a user