You've already forked lazarus-ccr
tvplanit: Fire OnAddEvent after DavView's/WeekView's/MonthView's event editor only in case of a new event (mentioned in the discussion of issue #33749).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6431 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -177,7 +177,7 @@ type
|
||||
procedure cgHookUp;
|
||||
procedure Paint; override;
|
||||
procedure Loaded; override;
|
||||
procedure cgSpawnContactEditDialog(NewContact: Boolean);
|
||||
procedure cgSpawnContactEditDialog(IsNewContact: Boolean);
|
||||
procedure cgSetActiveContactByCoord(Pnt: TPoint);
|
||||
function GetContactIndexByCoord(Pnt: TPoint): Integer;
|
||||
procedure cgScrollHorizontal(Rows: Integer);
|
||||
@ -1202,15 +1202,16 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpContactGrid.cgSpawnContactEditDialog(NewContact: Boolean);
|
||||
procedure TVpContactGrid.cgSpawnContactEditDialog(IsNewContact: Boolean);
|
||||
var
|
||||
AllowIt: Boolean;
|
||||
Dlg : TVpContactEditDialog;
|
||||
begin
|
||||
AllowIt := false;
|
||||
if Assigned(FOwnerEditContact) then
|
||||
FOwnerEditContact(self, FActiveContact, NewContact, DataStore.Resource, AllowIt)
|
||||
else begin
|
||||
FOwnerEditContact(self, FActiveContact, IsNewContact, DataStore.Resource, AllowIt)
|
||||
else
|
||||
begin
|
||||
Dlg := TVpContactEditDialog.Create(Owner);
|
||||
try
|
||||
Dlg.DataStore := DataStore;
|
||||
@ -1223,15 +1224,15 @@ begin
|
||||
if AllowIt then begin
|
||||
if FActiveContact.Changed = true then
|
||||
DataStore.PostContacts;
|
||||
Invalidate;
|
||||
end else begin
|
||||
if NewContact then begin
|
||||
end else
|
||||
begin
|
||||
if IsNewContact then begin
|
||||
DataStore.Resource.Contacts.DeleteContact(FActiveContact);
|
||||
FActiveContact := nil;
|
||||
end;
|
||||
DataStore.PostContacts;
|
||||
Invalidate;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
@ -377,7 +377,7 @@ type
|
||||
procedure InitializeDefaultPopup;
|
||||
procedure Paint; override;
|
||||
procedure Loaded; override;
|
||||
procedure dvSpawnEventEditDialog(NewEvent: Boolean);
|
||||
procedure dvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||
procedure dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean);
|
||||
procedure dvSetActiveColByCoord(Pnt: TPoint);
|
||||
procedure dvPopulate;
|
||||
@ -2053,7 +2053,7 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpDayView.dvSpawnEventEditDialog(NewEvent: Boolean);
|
||||
procedure TVpDayView.dvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||
var
|
||||
AllowIt: Boolean;
|
||||
EventDlg : TVpEventEditDialog;
|
||||
@ -2061,14 +2061,14 @@ begin
|
||||
if (DataStore = nil) or (DataStore.Resource = nil) or ReadOnly then
|
||||
Exit;
|
||||
|
||||
if (not NewEvent) and (not FActiveEvent.CanEdit) then begin
|
||||
if (not IsNewEvent) and (not FActiveEvent.CanEdit) then begin
|
||||
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOK], 0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
AllowIt := false;
|
||||
if Assigned(FOwnerEditEvent) then
|
||||
FOwnerEditEvent(self, FActiveEvent, NewEvent, DataStore.Resource, AllowIt)
|
||||
FOwnerEditEvent(self, FActiveEvent, IsNewEvent, DataStore.Resource, AllowIt)
|
||||
else begin
|
||||
EventDlg := TVpEventEditDialog.Create(nil);
|
||||
try
|
||||
@ -2082,19 +2082,18 @@ begin
|
||||
if AllowIt then begin
|
||||
FActiveEvent.Changed := true;
|
||||
DataStore.PostEvents;
|
||||
if Assigned(FOnAddEvent) then
|
||||
if IsNewEvent and Assigned(FOnAddEvent) then
|
||||
FOnAddEvent(self, FActiveEvent);
|
||||
Invalidate;
|
||||
end else begin
|
||||
if NewEvent then begin
|
||||
if IsNewEvent then begin
|
||||
FActiveEvent.Deleted := true;
|
||||
DataStore.PostEvents;
|
||||
FActiveEvent := nil;
|
||||
dvActiveEventRec := Rect(0, 0, 0, 0);
|
||||
dvActiveIconRec := Rect(0, 0, 0, 0);
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
@ -215,7 +215,7 @@ type
|
||||
{ internal methods }
|
||||
function GetDateAtCoord(APoint: TPoint): TDateTime;
|
||||
procedure mvPopulate;
|
||||
procedure mvSpawnEventEditDialog(NewEvent: Boolean);
|
||||
procedure mvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||
procedure mvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
|
||||
procedure mvSetDateByCoord(APoint: TPoint);
|
||||
procedure mvHookUp;
|
||||
@ -686,21 +686,21 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpMonthView.mvSpawnEventEditDialog(NewEvent: Boolean);
|
||||
procedure TVpMonthView.mvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||
var
|
||||
AllowIt: Boolean;
|
||||
EventDlg : TVpEventEditDialog;
|
||||
begin
|
||||
if DataStore = nil then Exit;
|
||||
|
||||
if (not NewEvent) and (not mvActiveEvent.CanEdit) then begin
|
||||
if (not IsNewEvent) and (not mvActiveEvent.CanEdit) then begin
|
||||
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
AllowIt := false;
|
||||
if Assigned(FOwnerEditEvent) then
|
||||
FOwnerEditEvent(self, mvActiveEvent, NewEvent, DataStore.Resource, AllowIt)
|
||||
FOwnerEditEvent(self, mvActiveEvent, IsNewEvent, DataStore.Resource, AllowIt)
|
||||
else begin
|
||||
EventDlg := TVpEventEditDialog.Create(nil);
|
||||
try
|
||||
@ -715,17 +715,16 @@ begin
|
||||
if AllowIt then begin
|
||||
mvActiveEvent.Changed := true;
|
||||
DataStore.PostEvents;
|
||||
if Assigned(FOnAddEvent) then
|
||||
if IsNewEvent and Assigned(FOnAddEvent) then
|
||||
FOnAddEvent(self, mvActiveEvent);
|
||||
Invalidate;
|
||||
end else begin
|
||||
if NewEvent then begin
|
||||
if IsNewEvent then begin
|
||||
DataStore.Resource.Schedule.DeleteEvent(mvActiveEvent);
|
||||
mvActiveEvent := nil;
|
||||
end;
|
||||
DataStore.PostEvents;
|
||||
Invalidate;
|
||||
end;
|
||||
Invalidate;
|
||||
mvActiveEvent := nil;
|
||||
end;
|
||||
|
||||
|
@ -180,7 +180,7 @@ type
|
||||
procedure tlHookUp;
|
||||
procedure Paint; override;
|
||||
procedure Loaded; override;
|
||||
procedure tlSpawnTaskEditDialog(NewTask: Boolean);
|
||||
procedure tlSpawnTaskEditDialog(IsNewTask: Boolean);
|
||||
procedure tlSetActiveTaskByCoord(Pnt: TPoint);
|
||||
function tlVisibleTaskToTaskIndex(const VisTaskIndex: Integer) : Integer;
|
||||
function tlTaskIndexToVisibleTask(const ATaskIndex: Integer) : Integer;
|
||||
@ -907,7 +907,7 @@ begin
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TVpTaskList.tlSpawnTaskEditDialog(NewTask: Boolean);
|
||||
procedure TVpTaskList.tlSpawnTaskEditDialog(IsNewTask: Boolean);
|
||||
var
|
||||
AllowIt: Boolean;
|
||||
Task: TVpTask;
|
||||
@ -920,7 +920,7 @@ begin
|
||||
Exit;
|
||||
|
||||
AllowIt := false;
|
||||
if NewTask then begin
|
||||
if IsNewTask then begin
|
||||
Task := DataStore.Resource.Tasks.AddTask(DataStore.GetNextID('Tasks'));
|
||||
Task.CreatedOn := now;
|
||||
Task.DueDate := Now + 7;
|
||||
@ -928,7 +928,7 @@ begin
|
||||
Task := FActiveTask;
|
||||
|
||||
if Assigned(FOwnerEditTask) then
|
||||
FOwnerEditTask(self, Task, NewTask, DataStore.Resource, AllowIt)
|
||||
FOwnerEditTask(self, Task, IsNewTask, DataStore.Resource, AllowIt)
|
||||
else begin
|
||||
TaskDlg := TVpTaskEditDialog.Create(nil);
|
||||
try
|
||||
@ -943,14 +943,13 @@ begin
|
||||
if AllowIt then begin
|
||||
DataStore.PostTasks();
|
||||
DataStore.NotifyDependents;
|
||||
Invalidate;
|
||||
end else begin
|
||||
if NewTask then begin
|
||||
if IsNewTask then begin
|
||||
DataStore.Resource.Tasks.DeleteTask(Task);
|
||||
end;
|
||||
DataStore.PostTasks;
|
||||
Invalidate;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
@ -210,7 +210,7 @@ type
|
||||
function GetEventAtCoord(Pt: TPoint): TVpEvent;
|
||||
function GetEventRect(AEvent: TVpEvent): TRect;
|
||||
procedure wvSetDateByCoord(Point: TPoint);
|
||||
procedure wvSpawnEventEditDialog(NewEvent: Boolean);
|
||||
procedure wvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||
|
||||
{ inherited standard methods }
|
||||
procedure CreateParams(var Params: TCreateParams); override;
|
||||
@ -1337,21 +1337,21 @@ begin
|
||||
InitializeDefaultPopup;
|
||||
end;
|
||||
|
||||
procedure TVpWeekView.wvSpawnEventEditDialog(NewEvent: Boolean);
|
||||
procedure TVpWeekView.wvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||
var
|
||||
AllowIt: Boolean;
|
||||
EventDlg : TVpEventEditDialog;
|
||||
begin
|
||||
if DataStore = nil then Exit;
|
||||
|
||||
if (not NewEvent) and (not ActiveEvent.CanEdit) then begin
|
||||
if (not IsNewEvent) and (not ActiveEvent.CanEdit) then begin
|
||||
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0);
|
||||
exit;
|
||||
end;
|
||||
|
||||
AllowIt := false;
|
||||
if Assigned(FOwnerEditEvent) then
|
||||
FOwnerEditEvent(self, ActiveEvent, NewEvent, DataStore.Resource, AllowIt)
|
||||
FOwnerEditEvent(self, ActiveEvent, IsNewEvent, DataStore.Resource, AllowIt)
|
||||
else begin
|
||||
EventDlg := TVpEventEditDialog.Create(nil);
|
||||
try
|
||||
@ -1366,17 +1366,16 @@ begin
|
||||
if AllowIt then begin
|
||||
ActiveEvent.Changed := true;
|
||||
DataStore.PostEvents;
|
||||
if Assigned(FOnAddEvent) then
|
||||
if IsNewEvent and Assigned(FOnAddEvent) then
|
||||
FOnAddEvent(self, ActiveEvent);
|
||||
Invalidate;
|
||||
end else begin
|
||||
if NewEvent then begin
|
||||
if IsNewEvent then begin
|
||||
DataStore.Resource.Schedule.DeleteEvent(ActiveEvent);
|
||||
ActiveEvent := nil;
|
||||
end;
|
||||
DataStore.PostEvents;
|
||||
Invalidate;
|
||||
end;
|
||||
Invalidate;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
Reference in New Issue
Block a user