diff --git a/windows/src/desktop/kmshell/main/Keyman.System.UpdateStateMachine.pas b/windows/src/desktop/kmshell/main/Keyman.System.UpdateStateMachine.pas index e70a0c28672..c50ecf14db9 100644 --- a/windows/src/desktop/kmshell/main/Keyman.System.UpdateStateMachine.pas +++ b/windows/src/desktop/kmshell/main/Keyman.System.UpdateStateMachine.pas @@ -774,7 +774,8 @@ procedure UpdateAvailableState.HandleAbort; procedure UpdateAvailableState.HandleInstallNow; begin bucStateContext.SetApplyNow(True); - ChangeState(DownloadingState); + // A new kmshell process will be used to download + StartDownloadProcess; end; { DownloadingState } diff --git a/windows/src/desktop/kmshell/main/UfrmMain.pas b/windows/src/desktop/kmshell/main/UfrmMain.pas index fdc1420b6b1..6a631fb5461 100644 --- a/windows/src/desktop/kmshell/main/UfrmMain.pas +++ b/windows/src/desktop/kmshell/main/UfrmMain.pas @@ -839,7 +839,12 @@ procedure TfrmMain.Update_ApplyNow; FResult := TUtilExecute.Shell(0, ShellPath, '', '-an'); if not FResult then TKeymanSentryClient.Client.MessageEvent(Sentry.Client.SENTRY_LEVEL_ERROR, - 'TrmfMain: Shell Execute Update_ApplyNow Failed'); + 'TrmfMain: Shell Execute Update_ApplyNow Failed') + else + ModalResult := mrAbort; + // If a splash screen is currently open when "Install Now" is executed, + // setting mrAbort ensures the splash screen is closed on the + // return of "Keyman Configuration". end; end; diff --git a/windows/src/desktop/kmshell/main/initprog.pas b/windows/src/desktop/kmshell/main/initprog.pas index 1f02c696e3d..61b684a9ce4 100644 --- a/windows/src/desktop/kmshell/main/initprog.pas +++ b/windows/src/desktop/kmshell/main/initprog.pas @@ -70,7 +70,7 @@ interface Windows, Controls, SysUtils, Classes, ErrorControlledRegistry, Forms, MessageIdentifiers, MessageIdentifierConsts, keymanapi_TLB; procedure Run; -procedure Main(Owner: TComponent = nil); +function Main(Owner: TComponent = nil): TModalResult; 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): TModalResult; var frmMain: TfrmMain; begin @@ -180,7 +180,7 @@ procedure Main(Owner: TComponent = nil); begin with TfrmMain.Create(Owner) do try - ShowModal; + Result := ShowModal; finally Free; end; diff --git a/windows/src/desktop/kmshell/startup/UfrmSplash.pas b/windows/src/desktop/kmshell/startup/UfrmSplash.pas index 8d8e8f54e33..9c7ac10a645 100644 --- a/windows/src/desktop/kmshell/startup/UfrmSplash.pas +++ b/windows/src/desktop/kmshell/startup/UfrmSplash.pas @@ -139,6 +139,8 @@ procedure TfrmSplash.WMUser(var Message: TMessage); 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 @@ procedure TfrmSplash.WMUser_FormShown(var Message: TMessage); 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