TvPlanIt: Same as prev commit with Tasks and Contacts.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8662 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-12-28 22:04:13 +00:00
parent 4234ecf141
commit 909d164864

View File

@ -239,6 +239,7 @@ type
procedure ClearEvents; procedure ClearEvents;
procedure ClearGroupEvents; procedure ClearGroupEvents;
procedure DeleteEvent(Event: TVpEvent); procedure DeleteEvent(Event: TVpEvent);
procedure DeleteEvent(AIndex: Integer);
function EventCountByDay(Value: TDateTime): Integer; function EventCountByDay(Value: TDateTime): Integer;
procedure EventsByDate(Date: TDateTime; EventList: TList); procedure EventsByDate(Date: TDateTime; EventList: TList);
procedure ExportICalFile(const AFileName: String; const AEvents: TVpEventArr); procedure ExportICalFile(const AFileName: String; const AEvents: TVpEventArr);
@ -386,6 +387,7 @@ type
function Count: Integer; function Count: Integer;
function CountByDay(Date: TDateTime): Integer; function CountByDay(Date: TDateTime): Integer;
procedure DeleteTask(Task: TVpTask); procedure DeleteTask(Task: TVpTask);
procedure DeleteTask(AIndex: Integer);
function First: TVpTask; function First: TVpTask;
function FirstByDay(Date: TDateTime): TVpTask; function FirstByDay(Date: TDateTime): TVpTask;
procedure ExportICalFile(const AFileName: String; const ATasks: TVpTaskArr); procedure ExportICalFile(const AFileName: String; const ATasks: TVpTaskArr);
@ -493,6 +495,7 @@ type
procedure ClearContacts; procedure ClearContacts;
function Count: Integer; function Count: Integer;
procedure DeleteContact(Contact: TVpContact); procedure DeleteContact(Contact: TVpContact);
procedure DeleteContact(AIndex: Integer);
function First: TVpContact; function First: TVpContact;
function FindContactByName(const AName: string; CaseInsensitive: Boolean = True): TVpContact; overload; function FindContactByName(const AName: string; CaseInsensitive: Boolean = True): TVpContact; overload;
function FindContactByName(const AFirstName, ALastName: 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; Owner.EventsDirty := true;
end; 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; function TVpSchedule.GetEvent(Index: Integer): TVpEvent;
begin begin
{ Returns an event on success or nil on failure } { Returns an event on success or nil on failure }
@ -2979,6 +2989,11 @@ begin
Contact.Free; Contact.Free;
end; end;
procedure TVpContacts.DeleteContact(AIndex: Integer);
begin
DeleteContact(GetContact(AIndex));
end;
function TVpContacts.GetContact(Index: Integer): TVpContact; function TVpContacts.GetContact(Index: Integer): TVpContact;
begin begin
result := TVpContact(FContactsList[Index]); result := TVpContact(FContactsList[Index]);
@ -3597,6 +3612,11 @@ begin
Task.Free; Task.Free;
end; end;
procedure TVpTasks.DeleteTask(AIndex: Integer);
begin
DeleteTask(GetTask(AIndex));
end;
function TVpTasks.GetTask(Index: Integer): TVpTask; function TVpTasks.GetTask(Index: Integer): TVpTask;
begin begin
result := TVpTask(FTaskList[Index]); result := TVpTask(FTaskList[Index]);