mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 22:09:09 +02:00
* Reverted r41816 to allow TXmlRegistry.DeleteKey() delete the key and all its children. It is Delphi compatible. Windows implementation of TRegistry.DeleteKey() was fixed accordingly.
git-svn-id: trunk@48208 -
This commit is contained in:
parent
ffff24593d
commit
050a342101
@ -235,23 +235,13 @@ end;
|
|||||||
Function TXmlRegistry.DeleteKey(KeyPath : UnicodeString) : Boolean;
|
Function TXmlRegistry.DeleteKey(KeyPath : UnicodeString) : Boolean;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
N, Curr : TDomElement;
|
N : 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