mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-22 15:47:41 +00:00
Merge pull request #9969 from keymanapp/fix/developer/9948-show-project-upgrade-messages-in-messages-panel
fix(developer): Project upgrade messages now show in Messages panel 🦕
This commit is contained in:
commit
e77472c658
3 changed files with 29 additions and 19 deletions
|
|
@ -182,6 +182,12 @@ begin
|
|||
mi := FMessageItems[line] as TMessageItem;
|
||||
FFilename := mi.FileName;
|
||||
|
||||
if FFileName = FGlobalProject.FileName then
|
||||
begin
|
||||
frmKeymanDeveloper.ShowProject;
|
||||
Exit;
|
||||
end;
|
||||
|
||||
frm := frmKeymanDeveloper.FindEditorByFileName(FFileName);
|
||||
if not Assigned(frm) then
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -984,17 +984,6 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
{
|
||||
function IsLMDLKeyboardFile(filename: string): Boolean;
|
||||
if EndsText('.xml', filename) then
|
||||
begin
|
||||
Result := Pos('ldmlKeyboard3.dtd', ReadUtf8FileText(ff)) > 0;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
}
|
||||
|
||||
function TProject.CanUpgrade: Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
|
|
@ -1015,12 +1004,12 @@ begin
|
|||
if Options.BuildPath.Contains('$SOURCEPATH') then
|
||||
begin
|
||||
Result := False;
|
||||
FUpgradeMessages.Add('The BuildPath option contains "$SOURCEPATH"');
|
||||
FUpgradeMessages.Add('The BuildPath project setting contains the "$SOURCEPATH" tag, which is no longer supported');
|
||||
end;
|
||||
if Options.BuildPath.Contains('$VERSION') then
|
||||
begin
|
||||
Result := False;
|
||||
FUpgradeMessages.Add('The BuildPath option contains "$VERSION"');
|
||||
FUpgradeMessages.Add('The BuildPath project setting contains the "$VERSION" tag, which is no longer supported');
|
||||
end;
|
||||
|
||||
for i := 0 to Files.Count - 1 do
|
||||
|
|
@ -1037,7 +1026,7 @@ begin
|
|||
Continue;
|
||||
end;
|
||||
|
||||
FUpgradeMessages.Add('File '+Files[i].FileName+' is outside the project folder');
|
||||
FUpgradeMessages.Add('File '+Files[i].FileName+' is outside the project folder. All primary source files must be in the same folder as the project file, or in a subfolder.');
|
||||
Result := False;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -13,13 +13,18 @@ function TryUpgradeProject(Project: TProject): TUpgradeResult;
|
|||
implementation
|
||||
|
||||
uses
|
||||
System.Classes,
|
||||
System.UITypes,
|
||||
Vcl.Controls,
|
||||
Vcl.Dialogs,
|
||||
|
||||
UfrmMessages,
|
||||
Keyman.Developer.System.Project.ProjectLog,
|
||||
KeymanDeveloperOptions;
|
||||
|
||||
function TryUpgradeProject(Project: TProject): TUpgradeResult;
|
||||
var
|
||||
msg: string;
|
||||
begin
|
||||
Result := urNoAction;
|
||||
|
||||
|
|
@ -29,22 +34,32 @@ begin
|
|||
Exit;
|
||||
end;
|
||||
|
||||
{ if not FKeymanDeveloperOptions.PromptForProjectUpgrade then
|
||||
{ TODO:
|
||||
if not FKeymanDeveloperOptions.PromptForProjectUpgrade then
|
||||
begin
|
||||
// User wishes to stick with v1.0 projects
|
||||
Exit;
|
||||
end;}
|
||||
end;
|
||||
}
|
||||
|
||||
frmMessages.Clear;
|
||||
|
||||
if not Project.CanUpgrade then
|
||||
begin
|
||||
// Project has restrictions, such as files in wrong folders, so
|
||||
// we cannot upgrade. Show a message for the user
|
||||
ShowMessage('The current project cannot be upgraded to v2.0. The following errors were encountered:'#13#10+
|
||||
Project.UpgradeMessages.Text);
|
||||
for msg in Project.UpgradeMessages do
|
||||
begin
|
||||
Project.Log(plsError, Project.FileName, msg, 0, 0);
|
||||
end;
|
||||
MessageDlg('Some issues must be addressed before the current project can '+
|
||||
'be upgraded to Keyman Developer 17 format. '+
|
||||
'Details of the issues are listed in the Messages panel.', mtError, [mbOk], 0);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
case MessageDlg('The current project can be upgraded to Keyman Developer 17.0 format. Do you wish to upgrade it (recommended)?'#13#10#13#10+
|
||||
case MessageDlg('The current project can be upgraded to Keyman Developer 17.0 format. '+
|
||||
'Do you wish to upgrade it (recommended)?'#13#10#13#10+
|
||||
'Note: upgraded projects will not be readable by older versions of Keyman Developer.',
|
||||
mtConfirmation, mbYesNoCancel, 0) of
|
||||
mrNo: Exit;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue