diff --git a/windows/src/desktop/kmshell/install/UfrmInstallKeyboardFromWeb.pas b/windows/src/desktop/kmshell/install/UfrmInstallKeyboardFromWeb.pas
index 7781153bf42..ed564243293 100644
--- a/windows/src/desktop/kmshell/install/UfrmInstallKeyboardFromWeb.pas
+++ b/windows/src/desktop/kmshell/install/UfrmInstallKeyboardFromWeb.pas
@@ -49,16 +49,19 @@ interface
type
TfrmInstallKeyboardFromWeb = class(TfrmWebContainer)
dlgSaveFile: TSaveDialog;
- procedure TntFormShow(Sender: TObject);
+ procedure TntFormCreate(Sender: TObject);
private
FDownloadFilename: string;
FDownloadURL: string;
frmDownloadProgress: TfrmDownloadProgress;
+ FDownloadStatusText: string;
+ FDownloadStatusCode: Integer;
procedure DoDownload(AOwner: TfrmDownloadProgress; var Result: Boolean);
procedure cefBeforeBrowse(Sender: TObject; const Url: string;
wasHandled: Boolean);
procedure cefBeforeBrowseSync(Sender: TObject; const Url: string;
out Handled: Boolean);
+ procedure cefLoadingStateChange(Sender: TObject; isLoading, canGoBack, canGoForward: Boolean);
procedure DownloadAndInstallPackage(const PackageID, BCP47: string);
procedure HttpReceiveData(const Sender: TObject; AContentLength,
AReadCount: Int64; var Abort: Boolean);
@@ -77,6 +80,9 @@ implementation
httpuploader,
GlobalProxySettings,
Keyman.Configuration.UI.InstallFile,
+ Keyman.System.LocaleStrings,
+ kmint,
+ MessageIdentifierConsts,
Upload_Settings,
utilfiletypes,
utildir,
@@ -95,17 +101,18 @@ procedure TfrmInstallKeyboardFromWeb.FireCommand(const command: WideString;
inherited;
end;
-procedure TfrmInstallKeyboardFromWeb.TntFormShow(Sender: TObject);
+procedure TfrmInstallKeyboardFromWeb.TntFormCreate(Sender: TObject);
begin
+ inherited;
// Ensures keyman.com hosted site opens locally
cef.ShouldOpenRemoteUrlsInBrowser := False;
cef.OnBeforeBrowse := cefBeforeBrowse;
cef.OnBeforeBrowseSync := cefBeforeBrowseSync;
+ cef.OnLoadingStateChange := cefLoadingStateChange;
FRenderPage := 'downloadkeyboard';
Content_Render;
- inherited;
end;
procedure TfrmInstallKeyboardFromWeb.cefBeforeBrowseSync(Sender: TObject; const Url: string; out Handled: Boolean);
@@ -113,6 +120,17 @@ procedure TfrmInstallKeyboardFromWeb.cefBeforeBrowseSync(Sender: TObject; const
Handled := TRegEx.IsMatch(Url, UrlPath_RegEx_MatchKeyboardsInstall);
end;
+procedure TfrmInstallKeyboardFromWeb.cefLoadingStateChange(Sender: TObject;
+ isLoading, canGoBack, canGoForward: Boolean);
+begin
+ if not isLoading then
+ begin
+ if canGoBack
+ then cef.cef.ExecuteJavaScript('updateBackButtonState(true)', cef.cef.Browser.MainFrame.Url)
+ else cef.cef.ExecuteJavaScript('updateBackButtonState(false)', cef.cef.Browser.MainFrame.Url);
+ end;
+end;
+
procedure TfrmInstallKeyboardFromWeb.cefBeforeBrowse(Sender: TObject; const Url: string; wasHandled: Boolean);
var
m: TMatch;
@@ -120,6 +138,7 @@ procedure TfrmInstallKeyboardFromWeb.cefBeforeBrowse(Sender: TObject; const Url:
BCP47: string;
PackageID: string;
begin
+
m := TRegEx.Match(Url, UrlPath_RegEx_MatchKeyboardsInstall);
if m.Success then
begin
@@ -151,7 +170,10 @@ procedure TfrmInstallKeyboardFromWeb.DownloadAndInstallPackage(const PackageID,
try
frmDownloadProgress.Callback := DoDownload;
if frmDownloadProgress.ShowModal <> mrOk then
+ begin
+ ShowMessage(TLocaleStrings.MsgFromIdFormat(kmcom, S_DownloadKeyboard_DownloadError, [FDownloadStatusText, FDownloadStatusCode]));
Exit;
+ end;
finally
frmDownloadProgress.Free;
end;
@@ -181,33 +203,35 @@ procedure TfrmInstallKeyboardFromWeb.DoDownload(AOwner: TfrmDownloadProgress; va
FTempFilename: string;
begin
Result := False;
- FTempFilename := FDownloadFilename + '.download';
- Client := THTTPClient.Create;
+ FTempFilename := FDownloadFilename + '.download';
+ Client := THTTPClient.Create;
+ try
+ Client.OnReceiveData := HttpReceiveData;
+
+ Stream := TFileStream.Create(FTempFilename, fmCreate);
try
- Client.OnReceiveData := HttpReceiveData;
-
- Stream := TFileStream.Create(FTempFilename, fmCreate);
- try
- Response := Client.Get(FDownloadURL, Stream);
- Result := Response.StatusCode = 200;
- finally
- Stream.Free;
- end;
+ Response := Client.Get(FDownloadURL, Stream);
+ Result := Response.StatusCode = 200;
+ FDownloadStatusText := Response.StatusText;
+ FDownloadStatusCode := Response.StatusCode;
+ finally
+ Stream.Free;
+ end;
- if FileExists(FTempFilename) then
+ if FileExists(FTempFilename) then
+ begin
+ if Result then
begin
- if Result then
- begin
- if FileExists(FDownloadFilename) then
- System.SysUtils.DeleteFile(FDownloadFilename);
- RenameFile(FTempFilename, FDownloadFilename);
- end
- else
- System.SysUtils.DeleteFile(FTempFilename);
- end;
- finally
- Client.Free;
+ if FileExists(FDownloadFilename) then
+ System.SysUtils.DeleteFile(FDownloadFilename);
+ RenameFile(FTempFilename, FDownloadFilename);
+ end
+ else
+ System.SysUtils.DeleteFile(FTempFilename);
end;
+ finally
+ Client.Free;
+ end;
end;
diff --git a/windows/src/desktop/kmshell/kmshell.dproj b/windows/src/desktop/kmshell/kmshell.dproj
index 96bd07f5134..0509db6a6f0 100644
--- a/windows/src/desktop/kmshell/kmshell.dproj
+++ b/windows/src/desktop/kmshell/kmshell.dproj
@@ -99,7 +99,7 @@
CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
true
Debug
- -splash
+ -c
@@ -413,15 +413,15 @@
true
-
+
- .\
+ kmshell.exe
true
-
+
- kmshell.exe
+ .\
true
diff --git a/windows/src/desktop/kmshell/kmshell.res b/windows/src/desktop/kmshell/kmshell.res
index a8fe854833a..4c42e0a34e5 100644
Binary files a/windows/src/desktop/kmshell/kmshell.res and b/windows/src/desktop/kmshell/kmshell.res differ
diff --git a/windows/src/desktop/kmshell/xml/config.css b/windows/src/desktop/kmshell/xml/config.css
index e23dd6c4038..bea36a38967 100644
--- a/windows/src/desktop/kmshell/xml/config.css
+++ b/windows/src/desktop/kmshell/xml/config.css
@@ -136,6 +136,12 @@ input[type='submit'], input[type='button'], button
border: none;
}
+input[type='submit']:disabled, input[type='button']:disabled, button:disabled
+{
+ color: #c0c0cf;
+ background: #80808f;
+}
+
a.hotkey:link, a.hotkey:visited
{
color: blue;
diff --git a/windows/src/desktop/kmshell/xml/downloadkeyboard.xsl b/windows/src/desktop/kmshell/xml/downloadkeyboard.xsl
index cc867d0194a..da7983487cd 100644
--- a/windows/src/desktop/kmshell/xml/downloadkeyboard.xsl
+++ b/windows/src/desktop/kmshell/xml/downloadkeyboard.xsl
@@ -12,6 +12,7 @@
+