From 49c077485ebfc41f259ab4d577985b9d45b6fbdf Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Mon, 24 Mar 2025 10:43:36 +1000 Subject: [PATCH] fix(windows): combine install and installnow frms --- windows/src/desktop/kmshell/kmshell.dpr | 1 - windows/src/desktop/kmshell/kmshell.dproj | 3 -- ...yman.Configuration.UI.UfrmStartInstall.dfm | 2 +- ...yman.Configuration.UI.UfrmStartInstall.pas | 16 ++++-- ...n.Configuration.UI.UfrmStartInstallNow.dfm | 52 ------------------- ...n.Configuration.UI.UfrmStartInstallNow.pas | 50 ------------------ windows/src/desktop/kmshell/main/UfrmMain.pas | 6 +-- windows/src/desktop/kmshell/main/initprog.pas | 2 +- 8 files changed, 18 insertions(+), 114 deletions(-) delete mode 100644 windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.dfm delete mode 100644 windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.pas diff --git a/windows/src/desktop/kmshell/kmshell.dpr b/windows/src/desktop/kmshell/kmshell.dpr index 19e22a946c..0f6bf22dd5 100644 --- a/windows/src/desktop/kmshell/kmshell.dpr +++ b/windows/src/desktop/kmshell/kmshell.dpr @@ -182,7 +182,6 @@ uses Keyman.System.UpdateStateMachine in 'main\Keyman.System.UpdateStateMachine.pas', Keyman.System.DownloadUpdate in 'main\Keyman.System.DownloadUpdate.pas', Keyman.System.ExecutionHistory in '..\..\..\..\common\windows\delphi\general\Keyman.System.ExecutionHistory.pas', - Keyman.Configuration.UI.UfrmStartInstallNow in 'main\Keyman.Configuration.UI.UfrmStartInstallNow.pas' {frmInstallNow}, Keyman.Configuration.UI.UfrmStartInstall in 'main\Keyman.Configuration.UI.UfrmStartInstall.pas' {frmStartInstall}; {$R VERSION.RES} diff --git a/windows/src/desktop/kmshell/kmshell.dproj b/windows/src/desktop/kmshell/kmshell.dproj index 81a1d09e73..ec44fc98ec 100644 --- a/windows/src/desktop/kmshell/kmshell.dproj +++ b/windows/src/desktop/kmshell/kmshell.dproj @@ -354,9 +354,6 @@ - -
frmInstallNow
-
frmStartInstall
diff --git a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.dfm b/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.dfm index 903632171c..c7109d748f 100644 --- a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.dfm +++ b/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.dfm @@ -16,7 +16,7 @@ object frmStartInstall: TfrmStartInstall Position = poScreenCenter PixelsPerInch = 96 TextHeight = 13 - object lblInstallUpdate: TLabel + object lblUpdateMessage: TLabel Left = 111 Top = 113 Width = 205 diff --git a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.pas b/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.pas index f4ca051c32..be1dbe31aa 100644 --- a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.pas +++ b/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstall.pas @@ -25,14 +25,15 @@ type TfrmStartInstall = class(TfrmKeymanBase) cmdInstall: TButton; cmdLater: TButton; - lblInstallUpdate: TLabel; + lblUpdateMessage: TLabel; imgKeymanLogo: TImage; procedure FormCreate(Sender: TObject); private + FRestartRequired: Boolean; public + constructor Create(AOwner: TComponent; const RestartRequired: Boolean); reintroduce; end; - implementation uses MessageIdentifiers, @@ -40,12 +41,21 @@ uses {$R *.dfm} +constructor TfrmStartInstall.Create(AOwner: TComponent; const RestartRequired: Boolean); +begin + inherited Create(AOwner); + FRestartRequired := RestartRequired; +end; + procedure TfrmStartInstall.FormCreate(Sender: TObject); begin inherited; cmdInstall.Caption := MsgFromId(S_Update_Now); cmdLater.Caption := MsgFromId(S_Later); - lblInstallUpdate.Caption := MsgFromId(S_Ready_To_Install); + if FRestartRequired then + lblUpdateMessage.Caption := MsgFromId(S_Update_Restart_Req) + else + lblUpdateMessage.Caption := MsgFromId(S_Ready_To_Install); end; end. diff --git a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.dfm b/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.dfm deleted file mode 100644 index 4bb30bbf56..0000000000 --- a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.dfm +++ /dev/null @@ -1,52 +0,0 @@ -object frmStartInstallNow: TfrmStartInstallNow - Left = 0 - Top = 0 - BorderIcons = [biSystemMenu] - BorderStyle = bsDialog - Caption = 'Keyman Update' - ClientHeight = 164 - ClientWidth = 354 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Tahoma' - Font.Style = [] - OldCreateOrder = False - Position = poScreenCenter - OnCreate = FormCreate - PixelsPerInch = 96 - TextHeight = 13 - object lblUpdateMessage: TLabel - Left = 16 - Top = 32 - Width = 323 - Height = 19 - Caption = 'Updating now will require a computer restart.' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -16 - Font.Name = 'Tahoma' - Font.Style = [] - ParentFont = False - WordWrap = True - end - object cmdInstall: TButton - Left = 147 - Top = 120 - Width = 75 - Height = 25 - Caption = 'Update' - ModalResult = 1 - TabOrder = 0 - end - object cmdLater: TButton - Left = 247 - Top = 120 - Width = 75 - Height = 25 - Caption = 'Close' - ModalResult = 8 - TabOrder = 1 - end -end diff --git a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.pas b/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.pas deleted file mode 100644 index b4b7290d5f..0000000000 --- a/windows/src/desktop/kmshell/main/Keyman.Configuration.UI.UfrmStartInstallNow.pas +++ /dev/null @@ -1,50 +0,0 @@ -{ - Keyman is copyright (C) SIL Global. MIT License. - - // TODO: #12887 Localise all the labels and captions. -} -unit Keyman.Configuration.UI.UfrmStartInstallNow; -interface - -uses - System.Classes, - System.SysUtils, - System.Variants, - Vcl.Controls, - Vcl.Dialogs, - Vcl.ExtCtrls, - Vcl.Forms, - Vcl.Graphics, - Vcl.StdCtrls, - Winapi.Messages, - Winapi.Windows, - UfrmKeymanBase, - UserMessages; - -type - TfrmStartInstallNow = class(TfrmKeymanBase) - cmdInstall: TButton; - cmdLater: TButton; - lblUpdateMessage: TLabel; - procedure FormCreate(Sender: TObject); - private - public - end; - -implementation -uses - MessageIdentifiers, - MessageIdentifierConsts; - -{$R *.dfm} - - -procedure TfrmStartInstallNow.FormCreate(Sender: TObject); -begin - inherited; - cmdInstall.Caption := MsgFromId(S_Update); - cmdLater.Caption := MsgFromId(S_Button_Close); - lblUpdateMessage.Caption := MsgFromId(S_Update_Restart_Req); -end; - -end. diff --git a/windows/src/desktop/kmshell/main/UfrmMain.pas b/windows/src/desktop/kmshell/main/UfrmMain.pas index 394cb09377..fdc1420b6b 100644 --- a/windows/src/desktop/kmshell/main/UfrmMain.pas +++ b/windows/src/desktop/kmshell/main/UfrmMain.pas @@ -194,7 +194,7 @@ uses Keyman.Configuration.System.HttpServer.App.ConfigMain, Keyman.Configuration.UI.InstallFile, Keyman.Configuration.UI.UfrmSettingsManager, - Keyman.Configuration.UI.UfrmStartInstallNow, + Keyman.Configuration.UI.UfrmStartInstall, RegistryKeys, SupportXMLRenderer, UfrmChangeHotkey, @@ -816,13 +816,13 @@ procedure TfrmMain.Update_ApplyNow; var ShellPath : string; FResult, InstallNow: Boolean; - frmStartInstallNow: TfrmStartInstallNow; + frmStartInstallNow: TfrmStartInstall; begin InstallNow := True; // Confirm User is ok that this will require a reset if HasKeymanRun then begin - frmStartInstallNow := TfrmStartInstallNow.Create(nil); + frmStartInstallNow := TfrmStartInstall.Create(nil, true); try if frmStartInstallNow.ShowModal = mrOk then InstallNow := True diff --git a/windows/src/desktop/kmshell/main/initprog.pas b/windows/src/desktop/kmshell/main/initprog.pas index e19a9db358..e91983cc8b 100644 --- a/windows/src/desktop/kmshell/main/initprog.pas +++ b/windows/src/desktop/kmshell/main/initprog.pas @@ -673,7 +673,7 @@ begin (FMode in [fmStart, fmSplash, fmMain, fmAbout, fmHelp, fmShowHelp, fmSettings, fmBoot]) then begin - frmStartInstall := TfrmStartInstall.Create(nil); + frmStartInstall := TfrmStartInstall.Create(nil, false); try Result := frmStartInstall.ShowModal = mrOk; finally