mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 21:39:11 +02:00
* try to fix sitemap editor. Still the whole concept is rough, and probably also suffers from changes wrt projectdir, since the sitemaps are saved to a different directory
(cherry picked from commit c0c92c1b57
)
This commit is contained in:
parent
364afccf48
commit
1af1c06e97
@ -8,7 +8,6 @@ object SitemapEditForm: TSitemapEditForm
|
|||||||
ClientHeight = 651
|
ClientHeight = 651
|
||||||
ClientWidth = 773
|
ClientWidth = 773
|
||||||
ShowInTaskBar = stAlways
|
ShowInTaskBar = stAlways
|
||||||
LCLVersion = '2.3.0.0'
|
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
Left = 424
|
Left = 424
|
||||||
Height = 15
|
Height = 15
|
||||||
|
@ -70,12 +70,12 @@ type
|
|||||||
|
|
||||||
{ TChmTreeNode }
|
{ TChmTreeNode }
|
||||||
|
|
||||||
TChmTreeNode = class(TTreeNode)
|
TChmTreeNode = class(TTreeNode) // make pairs
|
||||||
private
|
private
|
||||||
|
FName: String;
|
||||||
FLocal: String;
|
FLocal: String;
|
||||||
FURL: String;
|
|
||||||
public
|
public
|
||||||
property URL: String read FURL write FURL;
|
property Name: String read FName write FName;
|
||||||
property Local: String read FLocal write FLocal;
|
property Local: String read FLocal write FLocal;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -145,9 +145,13 @@ procedure TSitemapEditForm.SaveBtnClick(Sender: TObject);
|
|||||||
I: Integer;
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
ChmItem := ChmItems.NewItem;
|
ChmItem := ChmItems.NewItem;
|
||||||
ChmItem.Text := TreeNode.Text;
|
// indexes typically have 3 keys per item. A name, and nested within a name-local pair.
|
||||||
ChmItem.AddURL(TreeNode.URL);
|
// the name parts are often the same. For now we fake it by issuing name twice.
|
||||||
ChmItem.AddLocal(TreeNode.Local);
|
ChmItem.Name := TreeNode.Text; // Sets name in item.
|
||||||
|
if FSiteMapType=stIndex then
|
||||||
|
ChmItem.AddName(TreeNode.Name); // sets name in first subitem
|
||||||
|
ChmItem.AddLocal(TreeNode.Local); // sets local in first subitem
|
||||||
|
|
||||||
for I := 0 to TreeNode.Count-1 do begin
|
for I := 0 to TreeNode.Count-1 do begin
|
||||||
AddItem(TChmTreeNode(TreeNode.Items[I]), ChmItem.Children);
|
AddItem(TChmTreeNode(TreeNode.Items[I]), ChmItem.Children);
|
||||||
end;
|
end;
|
||||||
@ -217,7 +221,7 @@ begin
|
|||||||
Item := TChmTreeNode(SitemapTree.Selected);
|
Item := TChmTreeNode(SitemapTree.Selected);
|
||||||
DescriptionEdit.Text := Item.Text;
|
DescriptionEdit.Text := Item.Text;
|
||||||
LocalCombo.Text := Item.Local;
|
LocalCombo.Text := Item.Local;
|
||||||
URLEdit.Text := Item.URL;
|
URLEdit.Text := ''; // Item.url; // hardly used
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
DescriptionEdit.Text := '';
|
DescriptionEdit.Text := '';
|
||||||
@ -238,7 +242,7 @@ end;
|
|||||||
procedure TSitemapEditForm.URLEditChange(Sender: TObject);
|
procedure TSitemapEditForm.URLEditChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if SitemapTree.Selected = nil then Exit;
|
if SitemapTree.Selected = nil then Exit;
|
||||||
TChmTreeNode(SitemapTree.Selected).URL := URLEdit.Text;
|
// TChmTreeNode(SitemapTree.Selected). url := URLEdit.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSitemapEditForm.InitControls;
|
procedure TSitemapEditForm.InitControls;
|
||||||
@ -265,9 +269,9 @@ procedure TSitemapEditForm.LoadFromStream(AStream: TStream);
|
|||||||
for I := 0 to Items.Count-1 do begin
|
for I := 0 to Items.Count-1 do begin
|
||||||
ChmItem := Items.Item[I];
|
ChmItem := Items.Item[I];
|
||||||
TreeNode := TChmTreeNode(SitemapTree.Items.AddChild(ParentItem, ChmItem.Text));
|
TreeNode := TChmTreeNode(SitemapTree.Items.AddChild(ParentItem, ChmItem.Text));
|
||||||
TreeNode.Local := ChmItem.Local;
|
TreeNode.Name := ChmItem.Name;
|
||||||
if ChmItem.SubItemCount > 0 then
|
if ChmItem.SubItemCount > 0 then
|
||||||
TreeNode.URL := ChmItem.SubItem[0].URL;
|
TreeNode.Local := ChmItem.Local;
|
||||||
AddItems(ChmItem.Children, TreeNode);
|
AddItems(ChmItem.Children, TreeNode);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user