diff --git a/components/tvplanit/source/vpdata.pas b/components/tvplanit/source/vpdata.pas index fbc7a7f97..70664076a 100644 --- a/components/tvplanit/source/vpdata.pas +++ b/components/tvplanit/source/vpdata.pas @@ -239,6 +239,7 @@ type procedure ClearEvents; procedure ClearGroupEvents; procedure DeleteEvent(Event: TVpEvent); + procedure DeleteEvent(AIndex: Integer); function EventCountByDay(Value: TDateTime): Integer; procedure EventsByDate(Date: TDateTime; EventList: TList); procedure ExportICalFile(const AFileName: String; const AEvents: TVpEventArr); @@ -386,6 +387,7 @@ type function Count: Integer; function CountByDay(Date: TDateTime): Integer; procedure DeleteTask(Task: TVpTask); + procedure DeleteTask(AIndex: Integer); function First: TVpTask; function FirstByDay(Date: TDateTime): TVpTask; procedure ExportICalFile(const AFileName: String; const ATasks: TVpTaskArr); @@ -493,6 +495,7 @@ type procedure ClearContacts; function Count: Integer; procedure DeleteContact(Contact: TVpContact); + procedure DeleteContact(AIndex: Integer); function First: TVpContact; function FindContactByName(const AName: string; CaseInsensitive: Boolean = True): TVpContact; overload; function FindContactByName(const AFirstName, ALastName: string; CaseInsensitive: Boolean = True): TVpContact; overload; @@ -1861,6 +1864,13 @@ begin Owner.EventsDirty := true; end; +{ Initiates destruction of the event at the given index which also removes + it from the list. } +procedure TVpSchedule.DeleteEvent(AIndex: Integer); +begin + DeleteEvent(GetEvent(AIndex)); +end; + function TVpSchedule.GetEvent(Index: Integer): TVpEvent; begin { Returns an event on success or nil on failure } @@ -2979,6 +2989,11 @@ begin Contact.Free; end; +procedure TVpContacts.DeleteContact(AIndex: Integer); +begin + DeleteContact(GetContact(AIndex)); +end; + function TVpContacts.GetContact(Index: Integer): TVpContact; begin result := TVpContact(FContactsList[Index]); @@ -3597,6 +3612,11 @@ begin Task.Free; end; +procedure TVpTasks.DeleteTask(AIndex: Integer); +begin + DeleteTask(GetTask(AIndex)); +end; + function TVpTasks.GetTask(Index: Integer): TVpTask; begin result := TVpTask(FTaskList[Index]);