1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-05 17:05:19 -05:00

Fixes for Settings form. Had some duplicated code.

This commit is contained in:
Merlijn Wajer 2010-04-05 11:00:53 +02:00
parent 72539efffd
commit 0cd5099196
2 changed files with 13 additions and 15 deletions

View File

@ -128,9 +128,7 @@ begin
if N.Data <> nil then if N.Data <> nil then
exit; exit;
if N.GetFirstChild = nil then if N.GetFirstChild <> nil then
exit;
if N.GetFirstChild.Data <> nil then if N.GetFirstChild.Data <> nil then
exit; exit;
@ -140,14 +138,8 @@ begin
exit; exit;
P := Settings.GetNodePath(N); P := Settings.GetNodePath(N);
if Settings.CreateKey(P + '/' + NN.Text) then if Settings.CreateKey(P + '/' + KeyName) then
begin writeln('Added key ' + KeyName);
NN := TTreeNode.Create(SettingsTreeView.Items);
NN.Text := KeyName;
NN.MoveTo(N,naAddChild);
end;
end; end;
@ -170,6 +162,8 @@ begin
if N = nil then if N = nil then
exit; exit;
Path := Settings.GetNodePath(N);
MBox := InputBox('Rename', 'Please fill in the new name', ''); MBox := InputBox('Rename', 'Please fill in the new name', '');
if MBox = '' then if MBox = '' then
exit; exit;

View File

@ -345,21 +345,25 @@ var
i : integer; i : integer;
begin begin
result := false; result := false;
writeln(oldkey);
Path := KeyNameToKeys(OldKey); Path := KeyNameToKeys(OldKey);
if length(path) = 1 then if length(path) = 1 then
exit; exit;
if pos('/',newKey) > 0 then if pos('/',newKey) > 0 then
exit; exit;
if not KeyExists(oldkey) then if not KeyExists(oldkey) then
exit; exit;
for i := length(oldKey) downto 1 do
{ for i := length(oldKey) downto 1 do
if oldkey[i] = '/' then if oldkey[i] = '/' then
begin begin
newstr:= Copy(oldkey,1,i) + NewKey; newstr:= Copy(oldkey,1,i) + NewKey;
break; break;
end; end;
if KeyExists(NewKey) then if KeyExists(NewKey) then
exit; exit; }
Node := WalkToNode(oldKey); Node := WalkToNode(oldKey);
Node.Text:= NewKey; Node.Text:= NewKey;
result := true; result := true;