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

View File

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