Fix copy/paste not generating unique ID

This commit is contained in:
mysticbbs 2013-01-24 10:25:51 -05:00
parent 95cf05cf53
commit 89cc968daf
1 changed files with 14 additions and 6 deletions

View File

@ -302,27 +302,32 @@ Var
List.Add('', 2); List.Add('', 2);
End; End;
Procedure AssignRecord (Email: Boolean); Function GetPermanentIndex (Start: LongInt) : LongInt;
Var
TempBase : RecMessageBase;
Begin Begin
MIndex := List.Picked; Result := Start;
Reset (MBaseFile); Reset (MBaseFile);
While Not EOF(MBaseFile) Do Begin While Not EOF(MBaseFile) Do Begin
Read (MBaseFile, MBase); Read (MBaseFile, TempBase);
If MIndex = MBase.Index Then Begin If Result = TempBase.Index Then Begin
Inc (MIndex); Inc (Result);
Reset (MBaseFile); Reset (MBaseFile);
End; End;
End; End;
End;
Procedure AssignRecord (Email: Boolean);
Begin
AddRecord (MBaseFile, List.Picked, SizeOf(RecMessageBase)); AddRecord (MBaseFile, List.Picked, SizeOf(RecMessageBase));
FillChar (MBase, SizeOf(RecMessageBase), 0); FillChar (MBase, SizeOf(RecMessageBase), 0);
With MBase Do Begin With MBase Do Begin
Index := MIndex; Index := GetPermanentIndex(List.Picked);
FileName := 'new'; FileName := 'new';
Path := Config.MsgsPath; Path := Config.MsgsPath;
Name := 'New Base'; Name := 'New Base';
@ -418,6 +423,9 @@ Begin
End; End;
'P' : If HasCopy And (List.Picked > 1) Then Begin 'P' : If HasCopy And (List.Picked > 1) Then Begin
AddRecord (MBaseFile, List.Picked, SizeOf(MBase)); AddRecord (MBaseFile, List.Picked, SizeOf(MBase));
Copied.Index := GetPermanentIndex(1);
Write (MBaseFile, Copied); Write (MBaseFile, Copied);
MakeList; MakeList;