From 6b2d34231b161467da3462d5d6a02ffdce00bd04 Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Tue, 1 Apr 2025 11:06:05 +0200 Subject: [PATCH] IDE: in the Treeview Items Editor, add the ability to load a treeview from xml. Resolves issue #40806. --- components/ideintf/treeviewpropedit.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/ideintf/treeviewpropedit.pas b/components/ideintf/treeviewpropedit.pas index 0e6ba4dbb1..93cf1a389c 100644 --- a/components/ideintf/treeviewpropedit.pas +++ b/components/ideintf/treeviewpropedit.pas @@ -157,6 +157,7 @@ begin dlgOpen.Title := sccsTrEdtOpenDialog; dlgSave.Title := sccsTrEdtSaveDialog; dlgSave.Filter := 'xml files|*.xml|All files|'+GetAllFilesMask+'|'; + dlgOpen.Filter := dlgSave.Filter; // button panel ButtonPanel.ShowHint := true; @@ -410,6 +411,8 @@ begin end; procedure TTreeViewItemsEditorForm.tbOpenClick(Sender: TObject); +var + Fn: String; function ConfirmTreeReplace: boolean; begin @@ -426,8 +429,11 @@ begin if ConfirmTreeReplace and dlgOpen.Execute then begin - treEditor.LoadFromFile(dlgOpen.FileName); - + Fn := dlgOpen.FileName; + if (CompareFileExt(Fn, 'xml', False) = 0) then + TreeLoadFromXML(treEditor, Fn) + else + treEditor.LoadFromFile(Fn); treEditor.FullExpand; treEditor.Selected := treEditor.Items.GetFirstNode; treEditor.SetFocus;