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 cgHookUp;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure cgSpawnContactEditDialog(NewContact: Boolean);
|
procedure cgSpawnContactEditDialog(IsNewContact: Boolean);
|
||||||
procedure cgSetActiveContactByCoord(Pnt: TPoint);
|
procedure cgSetActiveContactByCoord(Pnt: TPoint);
|
||||||
function GetContactIndexByCoord(Pnt: TPoint): Integer;
|
function GetContactIndexByCoord(Pnt: TPoint): Integer;
|
||||||
procedure cgScrollHorizontal(Rows: Integer);
|
procedure cgScrollHorizontal(Rows: Integer);
|
||||||
@ -1202,15 +1202,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpContactGrid.cgSpawnContactEditDialog(NewContact: Boolean);
|
procedure TVpContactGrid.cgSpawnContactEditDialog(IsNewContact: Boolean);
|
||||||
var
|
var
|
||||||
AllowIt: Boolean;
|
AllowIt: Boolean;
|
||||||
Dlg : TVpContactEditDialog;
|
Dlg : TVpContactEditDialog;
|
||||||
begin
|
begin
|
||||||
AllowIt := false;
|
AllowIt := false;
|
||||||
if Assigned(FOwnerEditContact) then
|
if Assigned(FOwnerEditContact) then
|
||||||
FOwnerEditContact(self, FActiveContact, NewContact, DataStore.Resource, AllowIt)
|
FOwnerEditContact(self, FActiveContact, IsNewContact, DataStore.Resource, AllowIt)
|
||||||
else begin
|
else
|
||||||
|
begin
|
||||||
Dlg := TVpContactEditDialog.Create(Owner);
|
Dlg := TVpContactEditDialog.Create(Owner);
|
||||||
try
|
try
|
||||||
Dlg.DataStore := DataStore;
|
Dlg.DataStore := DataStore;
|
||||||
@ -1223,15 +1224,15 @@ begin
|
|||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
if FActiveContact.Changed = true then
|
if FActiveContact.Changed = true then
|
||||||
DataStore.PostContacts;
|
DataStore.PostContacts;
|
||||||
Invalidate;
|
end else
|
||||||
end else begin
|
begin
|
||||||
if NewContact then begin
|
if IsNewContact then begin
|
||||||
DataStore.Resource.Contacts.DeleteContact(FActiveContact);
|
DataStore.Resource.Contacts.DeleteContact(FActiveContact);
|
||||||
FActiveContact := nil;
|
FActiveContact := nil;
|
||||||
end;
|
end;
|
||||||
DataStore.PostContacts;
|
DataStore.PostContacts;
|
||||||
Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ type
|
|||||||
procedure InitializeDefaultPopup;
|
procedure InitializeDefaultPopup;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure dvSpawnEventEditDialog(NewEvent: Boolean);
|
procedure dvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||||
procedure dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean);
|
procedure dvSetActiveRowByCoord(Pnt: TPoint; Sloppy: Boolean);
|
||||||
procedure dvSetActiveColByCoord(Pnt: TPoint);
|
procedure dvSetActiveColByCoord(Pnt: TPoint);
|
||||||
procedure dvPopulate;
|
procedure dvPopulate;
|
||||||
@ -2053,7 +2053,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpDayView.dvSpawnEventEditDialog(NewEvent: Boolean);
|
procedure TVpDayView.dvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||||
var
|
var
|
||||||
AllowIt: Boolean;
|
AllowIt: Boolean;
|
||||||
EventDlg : TVpEventEditDialog;
|
EventDlg : TVpEventEditDialog;
|
||||||
@ -2061,14 +2061,14 @@ begin
|
|||||||
if (DataStore = nil) or (DataStore.Resource = nil) or ReadOnly then
|
if (DataStore = nil) or (DataStore.Resource = nil) or ReadOnly then
|
||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
if (not NewEvent) and (not FActiveEvent.CanEdit) then begin
|
if (not IsNewEvent) and (not FActiveEvent.CanEdit) then begin
|
||||||
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOK], 0);
|
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOK], 0);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AllowIt := false;
|
AllowIt := false;
|
||||||
if Assigned(FOwnerEditEvent) then
|
if Assigned(FOwnerEditEvent) then
|
||||||
FOwnerEditEvent(self, FActiveEvent, NewEvent, DataStore.Resource, AllowIt)
|
FOwnerEditEvent(self, FActiveEvent, IsNewEvent, DataStore.Resource, AllowIt)
|
||||||
else begin
|
else begin
|
||||||
EventDlg := TVpEventEditDialog.Create(nil);
|
EventDlg := TVpEventEditDialog.Create(nil);
|
||||||
try
|
try
|
||||||
@ -2082,19 +2082,18 @@ begin
|
|||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
FActiveEvent.Changed := true;
|
FActiveEvent.Changed := true;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
if Assigned(FOnAddEvent) then
|
if IsNewEvent and Assigned(FOnAddEvent) then
|
||||||
FOnAddEvent(self, FActiveEvent);
|
FOnAddEvent(self, FActiveEvent);
|
||||||
Invalidate;
|
|
||||||
end else begin
|
end else begin
|
||||||
if NewEvent then begin
|
if IsNewEvent then begin
|
||||||
FActiveEvent.Deleted := true;
|
FActiveEvent.Deleted := true;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
FActiveEvent := nil;
|
FActiveEvent := nil;
|
||||||
dvActiveEventRec := Rect(0, 0, 0, 0);
|
dvActiveEventRec := Rect(0, 0, 0, 0);
|
||||||
dvActiveIconRec := Rect(0, 0, 0, 0);
|
dvActiveIconRec := Rect(0, 0, 0, 0);
|
||||||
end;
|
end;
|
||||||
Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ type
|
|||||||
{ internal methods }
|
{ internal methods }
|
||||||
function GetDateAtCoord(APoint: TPoint): TDateTime;
|
function GetDateAtCoord(APoint: TPoint): TDateTime;
|
||||||
procedure mvPopulate;
|
procedure mvPopulate;
|
||||||
procedure mvSpawnEventEditDialog(NewEvent: Boolean);
|
procedure mvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||||
procedure mvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
|
procedure mvSpinButtonClick(Sender: TObject; Button: TUDBtnType);
|
||||||
procedure mvSetDateByCoord(APoint: TPoint);
|
procedure mvSetDateByCoord(APoint: TPoint);
|
||||||
procedure mvHookUp;
|
procedure mvHookUp;
|
||||||
@ -686,21 +686,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpMonthView.mvSpawnEventEditDialog(NewEvent: Boolean);
|
procedure TVpMonthView.mvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||||
var
|
var
|
||||||
AllowIt: Boolean;
|
AllowIt: Boolean;
|
||||||
EventDlg : TVpEventEditDialog;
|
EventDlg : TVpEventEditDialog;
|
||||||
begin
|
begin
|
||||||
if DataStore = nil then Exit;
|
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);
|
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AllowIt := false;
|
AllowIt := false;
|
||||||
if Assigned(FOwnerEditEvent) then
|
if Assigned(FOwnerEditEvent) then
|
||||||
FOwnerEditEvent(self, mvActiveEvent, NewEvent, DataStore.Resource, AllowIt)
|
FOwnerEditEvent(self, mvActiveEvent, IsNewEvent, DataStore.Resource, AllowIt)
|
||||||
else begin
|
else begin
|
||||||
EventDlg := TVpEventEditDialog.Create(nil);
|
EventDlg := TVpEventEditDialog.Create(nil);
|
||||||
try
|
try
|
||||||
@ -715,17 +715,16 @@ begin
|
|||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
mvActiveEvent.Changed := true;
|
mvActiveEvent.Changed := true;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
if Assigned(FOnAddEvent) then
|
if IsNewEvent and Assigned(FOnAddEvent) then
|
||||||
FOnAddEvent(self, mvActiveEvent);
|
FOnAddEvent(self, mvActiveEvent);
|
||||||
Invalidate;
|
|
||||||
end else begin
|
end else begin
|
||||||
if NewEvent then begin
|
if IsNewEvent then begin
|
||||||
DataStore.Resource.Schedule.DeleteEvent(mvActiveEvent);
|
DataStore.Resource.Schedule.DeleteEvent(mvActiveEvent);
|
||||||
mvActiveEvent := nil;
|
mvActiveEvent := nil;
|
||||||
end;
|
end;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
Invalidate;
|
||||||
mvActiveEvent := nil;
|
mvActiveEvent := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ type
|
|||||||
procedure tlHookUp;
|
procedure tlHookUp;
|
||||||
procedure Paint; override;
|
procedure Paint; override;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure tlSpawnTaskEditDialog(NewTask: Boolean);
|
procedure tlSpawnTaskEditDialog(IsNewTask: Boolean);
|
||||||
procedure tlSetActiveTaskByCoord(Pnt: TPoint);
|
procedure tlSetActiveTaskByCoord(Pnt: TPoint);
|
||||||
function tlVisibleTaskToTaskIndex(const VisTaskIndex: Integer) : Integer;
|
function tlVisibleTaskToTaskIndex(const VisTaskIndex: Integer) : Integer;
|
||||||
function tlTaskIndexToVisibleTask(const ATaskIndex: Integer) : Integer;
|
function tlTaskIndexToVisibleTask(const ATaskIndex: Integer) : Integer;
|
||||||
@ -907,7 +907,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
procedure TVpTaskList.tlSpawnTaskEditDialog(NewTask: Boolean);
|
procedure TVpTaskList.tlSpawnTaskEditDialog(IsNewTask: Boolean);
|
||||||
var
|
var
|
||||||
AllowIt: Boolean;
|
AllowIt: Boolean;
|
||||||
Task: TVpTask;
|
Task: TVpTask;
|
||||||
@ -920,7 +920,7 @@ begin
|
|||||||
Exit;
|
Exit;
|
||||||
|
|
||||||
AllowIt := false;
|
AllowIt := false;
|
||||||
if NewTask then begin
|
if IsNewTask then begin
|
||||||
Task := DataStore.Resource.Tasks.AddTask(DataStore.GetNextID('Tasks'));
|
Task := DataStore.Resource.Tasks.AddTask(DataStore.GetNextID('Tasks'));
|
||||||
Task.CreatedOn := now;
|
Task.CreatedOn := now;
|
||||||
Task.DueDate := Now + 7;
|
Task.DueDate := Now + 7;
|
||||||
@ -928,7 +928,7 @@ begin
|
|||||||
Task := FActiveTask;
|
Task := FActiveTask;
|
||||||
|
|
||||||
if Assigned(FOwnerEditTask) then
|
if Assigned(FOwnerEditTask) then
|
||||||
FOwnerEditTask(self, Task, NewTask, DataStore.Resource, AllowIt)
|
FOwnerEditTask(self, Task, IsNewTask, DataStore.Resource, AllowIt)
|
||||||
else begin
|
else begin
|
||||||
TaskDlg := TVpTaskEditDialog.Create(nil);
|
TaskDlg := TVpTaskEditDialog.Create(nil);
|
||||||
try
|
try
|
||||||
@ -943,14 +943,13 @@ begin
|
|||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
DataStore.PostTasks();
|
DataStore.PostTasks();
|
||||||
DataStore.NotifyDependents;
|
DataStore.NotifyDependents;
|
||||||
Invalidate;
|
|
||||||
end else begin
|
end else begin
|
||||||
if NewTask then begin
|
if IsNewTask then begin
|
||||||
DataStore.Resource.Tasks.DeleteTask(Task);
|
DataStore.Resource.Tasks.DeleteTask(Task);
|
||||||
end;
|
end;
|
||||||
DataStore.PostTasks;
|
DataStore.PostTasks;
|
||||||
Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ type
|
|||||||
function GetEventAtCoord(Pt: TPoint): TVpEvent;
|
function GetEventAtCoord(Pt: TPoint): TVpEvent;
|
||||||
function GetEventRect(AEvent: TVpEvent): TRect;
|
function GetEventRect(AEvent: TVpEvent): TRect;
|
||||||
procedure wvSetDateByCoord(Point: TPoint);
|
procedure wvSetDateByCoord(Point: TPoint);
|
||||||
procedure wvSpawnEventEditDialog(NewEvent: Boolean);
|
procedure wvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||||
|
|
||||||
{ inherited standard methods }
|
{ inherited standard methods }
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
@ -1337,21 +1337,21 @@ begin
|
|||||||
InitializeDefaultPopup;
|
InitializeDefaultPopup;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpWeekView.wvSpawnEventEditDialog(NewEvent: Boolean);
|
procedure TVpWeekView.wvSpawnEventEditDialog(IsNewEvent: Boolean);
|
||||||
var
|
var
|
||||||
AllowIt: Boolean;
|
AllowIt: Boolean;
|
||||||
EventDlg : TVpEventEditDialog;
|
EventDlg : TVpEventEditDialog;
|
||||||
begin
|
begin
|
||||||
if DataStore = nil then Exit;
|
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);
|
MessageDlg(RSCannotEditOverlayedEvent, mtInformation, [mbOk], 0);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
AllowIt := false;
|
AllowIt := false;
|
||||||
if Assigned(FOwnerEditEvent) then
|
if Assigned(FOwnerEditEvent) then
|
||||||
FOwnerEditEvent(self, ActiveEvent, NewEvent, DataStore.Resource, AllowIt)
|
FOwnerEditEvent(self, ActiveEvent, IsNewEvent, DataStore.Resource, AllowIt)
|
||||||
else begin
|
else begin
|
||||||
EventDlg := TVpEventEditDialog.Create(nil);
|
EventDlg := TVpEventEditDialog.Create(nil);
|
||||||
try
|
try
|
||||||
@ -1366,17 +1366,16 @@ begin
|
|||||||
if AllowIt then begin
|
if AllowIt then begin
|
||||||
ActiveEvent.Changed := true;
|
ActiveEvent.Changed := true;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
if Assigned(FOnAddEvent) then
|
if IsNewEvent and Assigned(FOnAddEvent) then
|
||||||
FOnAddEvent(self, ActiveEvent);
|
FOnAddEvent(self, ActiveEvent);
|
||||||
Invalidate;
|
|
||||||
end else begin
|
end else begin
|
||||||
if NewEvent then begin
|
if IsNewEvent then begin
|
||||||
DataStore.Resource.Schedule.DeleteEvent(ActiveEvent);
|
DataStore.Resource.Schedule.DeleteEvent(ActiveEvent);
|
||||||
ActiveEvent := nil;
|
ActiveEvent := nil;
|
||||||
end;
|
end;
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
Invalidate;
|
|
||||||
end;
|
end;
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user