mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Mainform.SessionName is used for write operations to registry. If you
a) connect a session b) open the session manager c) rename the current session ... your registry has a nearly empty session folder, after DoDisconnect() stores the last active database with the old session name. This change fixes the SessionName variable and window caption immediately after a session was renamed.
This commit is contained in:
@ -473,6 +473,11 @@ begin
|
|||||||
SessionKey := REGPATH + REGKEY_SESSIONS + SelectedSession;
|
SessionKey := REGPATH + REGKEY_SESSIONS + SelectedSession;
|
||||||
if MainReg.KeyExists(SessionKey) then
|
if MainReg.KeyExists(SessionKey) then
|
||||||
MainReg.MoveKey(SessionKey, REGPATH + REGKEY_SESSIONS + NewText, true);
|
MainReg.MoveKey(SessionKey, REGPATH + REGKEY_SESSIONS + NewText, true);
|
||||||
|
// Also fix internal session name in main form, which gets used to store e.g. "lastuseddb" later
|
||||||
|
if Mainform.SessionName = SelectedSession then begin
|
||||||
|
Mainform.SessionName := NewText;
|
||||||
|
Mainform.SetWindowCaption;
|
||||||
|
end;
|
||||||
FSessionNames[FSessionNames.IndexOf(SelectedSession)] := NewText;
|
FSessionNames[FSessionNames.IndexOf(SelectedSession)] := NewText;
|
||||||
RefreshSessionList(False);
|
RefreshSessionList(False);
|
||||||
end;
|
end;
|
||||||
|
@ -722,7 +722,6 @@ type
|
|||||||
dsHaveEngines,
|
dsHaveEngines,
|
||||||
dsCollations : TDataset;
|
dsCollations : TDataset;
|
||||||
FilterPanelManuallyOpened : Boolean;
|
FilterPanelManuallyOpened : Boolean;
|
||||||
winName : String;
|
|
||||||
FSelectedTableColumns,
|
FSelectedTableColumns,
|
||||||
FSelectedTableKeys : TDataset;
|
FSelectedTableKeys : TDataset;
|
||||||
DataGridDB, DataGridTable : WideString;
|
DataGridDB, DataGridTable : WideString;
|
||||||
@ -770,6 +769,7 @@ type
|
|||||||
dataselected : Boolean;
|
dataselected : Boolean;
|
||||||
editing : Boolean;
|
editing : Boolean;
|
||||||
mysql_version : Integer;
|
mysql_version : Integer;
|
||||||
|
WindowNumber : Integer;
|
||||||
SessionName : String;
|
SessionName : String;
|
||||||
VTRowDataListVariables,
|
VTRowDataListVariables,
|
||||||
VTRowDataListStatus,
|
VTRowDataListStatus,
|
||||||
@ -875,6 +875,7 @@ type
|
|||||||
function GetCollations(Items: TWideStrings = nil): TDataset;
|
function GetCollations(Items: TWideStrings = nil): TDataset;
|
||||||
procedure SetEditorTabCaption(Editor: TFrame; ObjName: WideString);
|
procedure SetEditorTabCaption(Editor: TFrame; ObjName: WideString);
|
||||||
procedure ResetSelectedTableStuff;
|
procedure ResetSelectedTableStuff;
|
||||||
|
procedure SetWindowCaption;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -1660,12 +1661,7 @@ begin
|
|||||||
|
|
||||||
// Define window properties
|
// Define window properties
|
||||||
SetWindowConnected( true );
|
SetWindowConnected( true );
|
||||||
i := SetWindowName( SessionName );
|
WindowNumber := SetWindowName(SessionName);
|
||||||
winName := SessionName;
|
|
||||||
if ( i <> 0 ) then
|
|
||||||
begin
|
|
||||||
winName := winName + Format( ' (%d)', [i] );
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Reselect last used database
|
// Reselect last used database
|
||||||
if GetRegValue( REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB ) then begin
|
if GetRegValue( REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB ) then begin
|
||||||
@ -6867,7 +6863,7 @@ end;
|
|||||||
procedure TMainForm.DBtreeFocusChanged(Sender: TBaseVirtualTree;
|
procedure TMainForm.DBtreeFocusChanged(Sender: TBaseVirtualTree;
|
||||||
Node: PVirtualNode; Column: TColumnIndex);
|
Node: PVirtualNode; Column: TColumnIndex);
|
||||||
var
|
var
|
||||||
newDb, newDbObject, Cap: WideString;
|
newDb, newDbObject: WideString;
|
||||||
begin
|
begin
|
||||||
debug('DBtreeFocusChanged()');
|
debug('DBtreeFocusChanged()');
|
||||||
if not Assigned(Node) then
|
if not Assigned(Node) then
|
||||||
@ -6911,15 +6907,7 @@ begin
|
|||||||
if newDb <> '' then
|
if newDb <> '' then
|
||||||
LoadDatabaseProperties(newDb);
|
LoadDatabaseProperties(newDb);
|
||||||
FixQueryTabCloseButtons;
|
FixQueryTabCloseButtons;
|
||||||
// Set window caption and taskbar text
|
SetWindowCaption;
|
||||||
Cap := winName;
|
|
||||||
if newDb <> '' then
|
|
||||||
Cap := Cap + ' /' + newDb;
|
|
||||||
if newDbObject <> '' then
|
|
||||||
Cap := Cap + '/' + newDbObject;
|
|
||||||
Cap := Cap + ' - ' + APPNAME + ' ' + FullAppVersion;
|
|
||||||
Caption := Cap;
|
|
||||||
Application.Title := Cap;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -9433,5 +9421,23 @@ begin
|
|||||||
Result := PageIndex >= Min;
|
Result := PageIndex >= Min;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SetWindowCaption;
|
||||||
|
var
|
||||||
|
Cap: String;
|
||||||
|
begin
|
||||||
|
// Set window caption and taskbar text
|
||||||
|
Cap := SessionName;
|
||||||
|
if WindowNumber <> 0 then
|
||||||
|
Cap := Cap + Format( ' (%d)', [WindowNumber] );
|
||||||
|
if ActiveDatabase <> '' then
|
||||||
|
Cap := Cap + ' /' + ActiveDatabase;
|
||||||
|
if SelectedTable.Text <> '' then
|
||||||
|
Cap := Cap + '/' + SelectedTable.Text;
|
||||||
|
Cap := Cap + ' - ' + APPNAME + ' ' + FullAppVersion;
|
||||||
|
Caption := Cap;
|
||||||
|
Application.Title := Cap;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user