From 10f1e2470e2d84bdd3477e45761e4d66c49f3899 Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Tue, 6 Jan 2026 10:39:54 +1000 Subject: [PATCH] fix(windows): config frm result used to close splash The Configuration window will return a mrAbort result when we want the Splash screen to close. This is in the case the Installation now has been selected. --- .../main/Keyman.System.DownloadUpdate.pas | 4 ++-- windows/src/desktop/kmshell/main/UfrmMain.pas | 4 +++- windows/src/desktop/kmshell/main/initprog.pas | 4 ++-- .../desktop/kmshell/startup/UfrmSplash.pas | 20 ++++++++++++++++--- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas b/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas index 10a6f726bc..a90d6a217e 100644 --- a/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas +++ b/windows/src/desktop/kmshell/main/Keyman.System.DownloadUpdate.pas @@ -30,7 +30,7 @@ type *) function DoDownloadUpdates(SavePath: string; Params: TUpdateCheckResponse): Boolean; // pseduo code name this something more appropriate - procedure MyEventHandler(const Message: string; Position: Int64; Total: Int64); + //procedure MyEventHandler(const Message: string; Position: Int64; Total: Int64); public @@ -102,7 +102,7 @@ var http.Request.Agent := API_UserAgent; http.Request.SetURL(url); - http.OnStatus := myeventhandler; + //http.OnStatus := myeventhandler; http.Upload; if http.Response.StatusCode = 200 then begin diff --git a/windows/src/desktop/kmshell/main/UfrmMain.pas b/windows/src/desktop/kmshell/main/UfrmMain.pas index f4f47d24f0..528a5d154e 100644 --- a/windows/src/desktop/kmshell/main/UfrmMain.pas +++ b/windows/src/desktop/kmshell/main/UfrmMain.pas @@ -842,7 +842,9 @@ begin 'TrmfMain: Shell Execute Update_ApplyNow Failed') else ModalResult := mrAbort; // look into the most appropiate - // Application.Terminate; + // Maybe mrYes and mrNo. What we are after is that if we have a splash screen + // open when Install Now has run we want the result be value that the splash + // screen will be closed. end; end; diff --git a/windows/src/desktop/kmshell/main/initprog.pas b/windows/src/desktop/kmshell/main/initprog.pas index 1f02c696e3..787cafddac 100644 --- a/windows/src/desktop/kmshell/main/initprog.pas +++ b/windows/src/desktop/kmshell/main/initprog.pas @@ -70,7 +70,7 @@ uses Windows, Controls, SysUtils, Classes, ErrorControlledRegistry, Forms, MessageIdentifiers, MessageIdentifierConsts, keymanapi_TLB; procedure Run; -procedure Main(Owner: TComponent = nil); +function Main(Owner: TComponent = nil): Integer; type @@ -164,7 +164,7 @@ procedure ShowKeyboardWelcome(PackageName: WideString); forward; // I2569 procedure PrintKeyboard(KeyboardName: WideString); forward; // I2329 function ProcessBackgroundUpdate(FMode: TKMShellMode; FSilent: Boolean): Boolean; forward; -procedure Main(Owner: TComponent = nil); +function Main(Owner: TComponent = nil): Integer; var frmMain: TfrmMain; begin diff --git a/windows/src/desktop/kmshell/startup/UfrmSplash.pas b/windows/src/desktop/kmshell/startup/UfrmSplash.pas index 8d8e8f54e3..9c7ac10a64 100644 --- a/windows/src/desktop/kmshell/startup/UfrmSplash.pas +++ b/windows/src/desktop/kmshell/startup/UfrmSplash.pas @@ -139,6 +139,8 @@ begin end; procedure TfrmSplash.WMUser_FormShown(var Message: TMessage); +var + configFrmResult: Integer; begin if (GetForegroundWindow <> Handle) and (GetWindowThreadProcessId(GetForegroundWindow) <> GetCurrentThreadId) then // I3730 @@ -152,15 +154,27 @@ begin if FShowConfigurationOnLoad then begin - Main(Self); - Do_Content_Render; + configFrmResult := Main(Self); + if configFrmResult = mrAbort then + Command_Exit + else + Do_Content_Render; end; end; procedure TfrmSplash.FireCommand(const command: WideString; params: TStringList); +var + configFrmResult: Integer; begin if command = 'start' then Command_Start - else if command = 'config' then begin Main(Self); Do_Content_Render; end // I4393 // I4396 + else if command = 'config' then + begin + configFrmResult := Main(Self); + if configFrmResult = mrAbort then + Command_Exit + else + Do_Content_Render; + end // I4393 // I4396 else if command = 'hidesplash' then FShouldDisplay := False else if command = 'showsplash' then FShouldDisplay := True else if command = 'exit' then Command_Exit