From f922598fe5b4e5110ae1ac1b512dd53a82e8f80d Mon Sep 17 00:00:00 2001 From: Alexey Kulakov Date: Tue, 9 Dec 2014 21:12:52 +0000 Subject: Actman 30:old to new setting conversion fix git-svn-id: http://svn.miranda-ng.org/main/trunk@11309 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Actman30/actman30.dpr | 2 +- plugins/Actman30/i_options.inc | 34 ++++++++++++++++++++++++++++++++-- plugins/Actman30/iac_jump.pas | 4 ++-- 3 files changed, 35 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/Actman30/actman30.dpr b/plugins/Actman30/actman30.dpr index d47d57c95a..2aa0bd834a 100644 --- a/plugins/Actman30/actman30.dpr +++ b/plugins/Actman30/actman30.dpr @@ -202,7 +202,7 @@ begin RegisterIcons; HookEvent(ME_OPT_INITIALISE ,@OnOptInitialise); - HookEvent(ME_SYSTEM_SHUTDOWN{ME_SYSTEM_OKTOEXIT},@PreShutdown); + HookEvent(ME_SYSTEM_PRESHUTDOWN{ME_SYSTEM_OKTOEXIT},@PreShutdown); NotifyEventHooks(hHookChanged,twparam(ACTM_LOADED),0); IsMultiThread:=true; diff --git a/plugins/Actman30/i_options.inc b/plugins/Actman30/i_options.inc index 7cbfe6716d..089724401c 100644 --- a/plugins/Actman30/i_options.inc +++ b/plugins/Actman30/i_options.inc @@ -46,7 +46,9 @@ var p,p1:PAnsiChar; begin // even if crap in settings, skip on read -// DBDeleteGroup(0,DBBranch,opt_group); + + DBDeleteGroup(0,DBBranch,opt_group); //!! + Macro:=MacroList[0]; i:=MacroList.Count; NumMacro:=0; @@ -101,6 +103,15 @@ const ACF_OLD_FWRITE = $00000020; // read/write file ACF_OLD_FAPPEND = $00000040; // append file +const + OldVersion = 'Your Actman settings is for old version. If you ready to upgrade settings, ' + + 'press OK. Else press Cancel and change manually Actman plugin back to old version ' + + 'or make settings backup. To keep previously expoted macros please import them back ' + + 'before conversion'; + Notes = 'Please, don''t use macro test for non-saved macros. If you had ''Advanced'' or file ' + + 'writing actions previously, check it - their logic was changed.'; + ConvResult = 'Actman settings converted to new version'; + procedure CheckActionList(Macro:pMacroRecord;num:integer); var tmplist:pActionList; @@ -395,8 +406,18 @@ begin // V2 counts actions from 1, not 0 v2:=DBReadDWord(0,DBBranch,'Group0/Action0/flags',$FFFFFFFF)=$FFFFFFFF; + if v2 then + begin + if MessageBoxW(0,TranslateW(OldVersion),'Actman',MB_OKCANCEL or MB_ICONWARNING)<>IDOK then + begin + NumMacros:=0; + MacroList:=tMacroList.Create(0); + exit; + end; + end; + // Allocate macro list - NumMacros :=DBReadWord(0,DBBranch,opt_nummacro,0); + NumMacros:=DBReadWord(0,DBBranch,opt_nummacro,0); MacroList:=tMacroList.Create(NumMacros); // read macro list settings @@ -431,4 +452,13 @@ begin inc(i); end; end; + + if v2 then + begin + DBDeleteSetting(0,DBBranch,opt_numacts); + DBWriteByte(0,DBBranch,'version' ,3); + SaveMacros; + MessageBoxW(0,TranslateW(Notes),TranslateW(ConvResult),MB_ICONINFORMATION); + end; + end; diff --git a/plugins/Actman30/iac_jump.pas b/plugins/Actman30/iac_jump.pas index 4f4176e583..97ba3e379c 100644 --- a/plugins/Actman30/iac_jump.pas +++ b/plugins/Actman30/iac_jump.pas @@ -252,7 +252,7 @@ begin if fmt<>101 then // condition begin StrCopy(pc,opt_condition); cond:=DBReadByte(0,DBBranch,section); - if (cond and $F0)=0 then + if (cond and $0F)=0 then flags:=flags or ACF_NOP else begin @@ -281,7 +281,7 @@ begin end else begin - StrCopy(pc,'oper'); oper:=DBReadByte(0,DBBranch,section) and $0F; + StrCopy(pc,'action'); oper:=DBReadByte(0,DBBranch,section) and $0F; if (oper and ADV_ACT_BREAK)<>0 then flags:= flags or ACF_BREAK else -- cgit v1.2.3