Skip to content

Commit be5322c

Browse files
committed
feat: new attempt to leave the main window invisible behind the session manager
Refs #2395
1 parent 0a87a73 commit be5322c

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

source/main.pas

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,6 @@ TMainForm = class(TExtForm)
14191419
SysLanguage: String;
14201420
MainFormCreated: Boolean = False;
14211421
MainFormAfterCreateDone: Boolean = False;
1422-
SessionManagerStartupDone: Boolean = False;
14231422
PostponedLogItems: TDBLogItems;
14241423

14251424
const
@@ -2723,12 +2722,22 @@ procedure TMainForm.FormResize(Sender: TObject);
27232722
end;
27242723

27252724
procedure TMainForm.FormShow(Sender: TObject);
2725+
var
2726+
DlgResult: TModalResult;
2727+
SessionManager: TConnForm;
27262728
begin
2727-
{LogSQL(f_('Scaling controls to screen DPI: %d%%', [Round(ScaleFactor*100)]));
2728-
if TStyleManager.IsCustomStyleActive and (ScaleFactor<>1) then begin
2729-
LogSQL(f_('Caution: Style "%s" selected and non-default DPI factor - be aware that some styles appear broken with high DPI settings!', [TStyleManager.ActiveStyle.Name]));
2730-
end;}
2731-
2729+
// Display session manager
2730+
if Connections.Count = 0 then begin
2731+
// Cannot be done in OnCreate because we need ready forms here:
2732+
SessionManager := TConnForm.Create(Self);
2733+
DlgResult := SessionManager.ShowModal;
2734+
SessionManager.Free;
2735+
if DlgResult = mrCancel then begin
2736+
actExitApplicationExecute(nil);
2737+
Visible := False;
2738+
Exit;
2739+
end;
2740+
end;
27322741

27332742
// Restore width of columns of all VirtualTrees
27342743
RestoreListSetup(ListDatabases);
@@ -14473,23 +14482,7 @@ procedure TMainForm.RefreshHelperNode(NodeIndex: Cardinal);
1447314482

1447414483

1447514484
procedure TMainForm.ApplicationIdle(Sender: TObject; var Done: Boolean);
14476-
var
14477-
DlgResult: TModalResult;
14478-
SessionManager: TConnForm;
1447914485
begin
14480-
// Display session manager
14481-
// Cannot be done in OnCreate because we need ready forms here
14482-
if (not SessionManagerStartupDone) and (Connections.Count = 0) then begin
14483-
SessionManagerStartupDone := True;
14484-
SessionManager := TConnForm.Create(Self);
14485-
DlgResult := SessionManager.ShowModal;
14486-
SessionManager.Free;
14487-
if DlgResult = mrCancel then begin
14488-
actExitApplicationExecute(nil);
14489-
end;
14490-
end;
14491-
SessionManagerStartupDone := True;
14492-
1449314486
// Sort list tables in idle time, so ListTables.TreeOptions.AutoSort does not crash the list
1449414487
// when dropping a right-clicked database
1449514488
if (PageControlMain.ActivePage = tabDatabase) and (not FListTablesSorted) then begin

0 commit comments

Comments
 (0)