Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
7 changes: 6 additions & 1 deletion windows/src/desktop/kmshell/main/UfrmMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions windows/src/desktop/kmshell/main/initprog.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -180,7 +180,7 @@ procedure Main(Owner: TComponent = nil);
begin
with TfrmMain.Create(Owner) do
try
ShowModal;
Result := ShowModal;
finally
Free;
end;
Expand Down
20 changes: 17 additions & 3 deletions windows/src/desktop/kmshell/startup/UfrmSplash.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down