rejetto forum

must be corrected default tpl bug with [special:import]

Mars · 4 · 5554

0 Members and 1 Guest are viewing this topic.

Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2062
    • View Profile
The bug here is which appeared since the section [special:import] is active in the template by default, about is the template in the course of use, the concerned section is systematically executed, to convince itself, it is enough to choose a personalized template and to delete the group ' can exchange password ', then we save the options (in any configuration) and we restart HFS, it damned counts re-appears as if by magic.

With the following small modifications, everything becomes again normal:

The section is executed during  restore  the default template, and so only during a first installation of hfs, or in case hfs.ini is deleted and in case the base of register of hfs is empty.



Quote
function Tmainfrm.finalInit():boolean;
......
// CTRL avoids the only1instance setting
if not holdingKey(VK_CONTROL)
and only1instanceChk.checked and not mono.master then
  begin
  result:=FALSE;
  quitASAP:=TRUE;
  end;
//disable the two next lines, they are moved
//tplImport:=TRUE;  //execute import script if any
// setTplText(defaultTpl);

processParams_before(params);

.....................................

procedure TmainFrm.Restoredefault1Click(Sender: TObject);
begin
if msgDlg('Continue?', MB_ICONQUESTION+MB_YESNO) = MRNO then exit;
tplFilename:='';
tplLast:=-1;
tplImport:=TRUE; // execute import script if any   //this line was missing here
setStatusBarText('The template has been reset');
end;

.....................................

function loadCfg(var ini,tpl:string):boolean;
....
begin
result:=TRUE;
ipsEverConnected.text:=loadfile(IPS_FILE);
.......
//mars the two lines moved here
tplImport:=TRUE; // execute import script if any
setTplText(defaultTpl);
result:=FALSE;
end; // loadCfg


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
you are right, it would be nice if the default import would run only when needed,
but your solution doesn't work.
If i move the 2 lines as you say, a clean HFS (hold shift on start) will never execute.
as a temporary solution, i removed the "tplImport:=TRUE;"
and added these lines at the end of finalInit()

if not tplIsCustomized then
  runTplImport();


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2062
    • View Profile
first: this must be modified absoluty

Quote
procedure TmainFrm.Restoredefault1Click(Sender: TObject);
begin
if msgDlg('Continue?', MB_ICONQUESTION+MB_YESNO) = MRNO then exit;
tplFilename:='';
tplLast:=-1;
tplImport:=TRUE; // execute import script if any   //this line was missing here
setStatusBarText('The template has been reset');
end;

I am regarding for the rest, I launch delphi now to work on it ;)

« Last Edit: May 12, 2010, 02:04:46 PM by Mars »