mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 12:49:09 +02:00
* Patch from Bart Broersma to fix deleting non-empty key (bug ID 0035132)
git-svn-id: trunk@41816 -
This commit is contained in:
parent
d13f0c3f80
commit
6c7da3cca4
@ -234,13 +234,23 @@ end;
|
|||||||
Function TXmlRegistry.DeleteKey(KeyPath : UnicodeString) : Boolean;
|
Function TXmlRegistry.DeleteKey(KeyPath : UnicodeString) : Boolean;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
N : TDomElement;
|
N, Curr : TDomElement;
|
||||||
|
Node: TDOMNode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
N:=FindKey(KeyPath);
|
N:=FindKey(KeyPath);
|
||||||
Result:=(N<>Nil);
|
Result:=(N<>Nil);
|
||||||
If Result then
|
If Result then
|
||||||
begin
|
begin
|
||||||
|
//if a key has subkeys, result shall be false and nothing shall be deleted
|
||||||
|
Curr:=N;
|
||||||
|
Node:=Curr.FirstChild;
|
||||||
|
While Assigned(Node) do
|
||||||
|
begin
|
||||||
|
If (Node.NodeType=ELEMENT_NODE) and (Node.NodeName=SKey) then
|
||||||
|
Exit(False);
|
||||||
|
Node:=Node.NextSibling;
|
||||||
|
end;
|
||||||
(N.ParentNode as TDomElement).RemoveChild(N);
|
(N.ParentNode as TDomElement).RemoveChild(N);
|
||||||
FDirty:=True;
|
FDirty:=True;
|
||||||
MaybeFlush;
|
MaybeFlush;
|
||||||
|
Loading…
Reference in New Issue
Block a user