Merge pull request #7856 from keymanapp/fix/windows/7670/kmshell-ikl-enable-kbd

fix(windows): kmshell -ikl install language and enable keyboard
This commit is contained in:
rc-swag 2023-01-09 15:40:47 +10:00 committed by GitHub
commit fec5bbbe4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -129,9 +129,11 @@ implementation
uses
System.Types,
Vcl.Themes,
Sentry.Client,
Keyman.Configuration.UI.MitigationForWin10_1803,
Keyman.System.LanguageCodeUtils,
Keyman.System.KeymanSentryClient,
Keyman.Configuration.System.TIPMaintenance,
Keyman.UI.UfrmProgress,
MessageIdentifierConsts,
@ -147,6 +149,9 @@ uses
{ TfrmInstallKeyboardLanguage }
function InstallKeyboardLanguage(Owner: TForm; const KeyboardID, ISOCode: string; Silent: Boolean): Boolean;
var
n: Integer;
kbd: IKeymanKeyboardInstalled;
begin
Result := TTIPMaintenance.DoInstall(KeyboardID, ISOCode);
if not Result then
@ -157,7 +162,18 @@ begin
end
else
CheckForMitigationWarningFor_Win10_1803(Silent, '');
// Enable the keyboard
n := kmcom.Keyboards.IndexOf(KeyboardID);
if n < 0 then
begin
// The Keyboard was successully installed for the BCP47Code
// for some reason the index look up has failed. Still pass through
// the DoInstall reasult, however the keyboard will not be enabled.
TKeymanSentryClient.Client.MessageEvent(Sentry.Client.SENTRY_LEVEL_ERROR, 'InstallKeyboardLanguage: KeyboardID "'+KeyboardID+'" not found, attempting to install for language "'+ISOCode+'".');
Exit;
end;
kbd := kmcom.Keyboards[n];
kbd.Loaded := True;
kmcom.Apply;
Result := True;
end;