You've already forked lazarus-ccr
TvPlanIt: Fix sqlite3 datastore duplicating dragged events sometimes.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8180 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1688,6 +1688,7 @@ begin
|
|||||||
according to how far the event was dragged }
|
according to how far the event was dragged }
|
||||||
Event.StartTime := Event.StartTime + (DragToTime - DvDragStartTime);
|
Event.StartTime := Event.StartTime + (DragToTime - DvDragStartTime);
|
||||||
Event.EndTime := Event.StartTime + Duration;
|
Event.EndTime := Event.StartTime + Duration;
|
||||||
|
|
||||||
DataStore.PostEvents;
|
DataStore.PostEvents;
|
||||||
|
|
||||||
{ Force a repaint. This will update the rectangles for the event }
|
{ Force a repaint. This will update the rectangles for the event }
|
||||||
@ -1704,12 +1705,8 @@ begin
|
|||||||
Break;
|
Break;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Invalidate; }
|
|
||||||
end;
|
end;
|
||||||
// TVpEventDragObject(Source).EndDrag(False);
|
|
||||||
end;
|
end;
|
||||||
{=====}
|
|
||||||
|
|
||||||
function TVpDayView.dvCalcRowHeight(Scale: Extended;
|
function TVpDayView.dvCalcRowHeight(Scale: Extended;
|
||||||
UseGran: TVpGranularity): Integer;
|
UseGran: TVpGranularity): Integer;
|
||||||
|
@ -9,6 +9,9 @@ uses
|
|||||||
VpBaseDS, VpDBDS;
|
VpBaseDS, VpDBDS;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TVpSqlite3Datastore }
|
||||||
|
|
||||||
TVpSqlite3Datastore = class(TVpCustomDBDatastore)
|
TVpSqlite3Datastore = class(TVpCustomDBDatastore)
|
||||||
private
|
private
|
||||||
FConnection: TSqlite3Connection;
|
FConnection: TSqlite3Connection;
|
||||||
@ -38,12 +41,10 @@ type
|
|||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure CreateTables;
|
procedure CreateTables;
|
||||||
function GetNextID(TableName: string): integer; override;
|
function GetNextID(TableName: string): integer; override;
|
||||||
procedure PostEvents; override;
|
|
||||||
procedure PostContacts; override;
|
|
||||||
procedure PostTasks; override;
|
|
||||||
procedure PostResources; override;
|
|
||||||
|
|
||||||
property ResourceTable;
|
property ResourceTable;
|
||||||
property EventsTable;
|
property EventsTable;
|
||||||
@ -80,15 +81,28 @@ begin
|
|||||||
|
|
||||||
FContactsTable := TSQLQuery.Create(self);
|
FContactsTable := TSQLQuery.Create(self);
|
||||||
FContactsTable.SQL.Add('SELECT * FROM Contacts');
|
FContactsTable.SQL.Add('SELECT * FROM Contacts');
|
||||||
|
FContactsTable.Options := FContactsTable.Options + [sqoAutoApplyUpdates];
|
||||||
|
|
||||||
FEventsTable := TSQLQuery.Create(Self);
|
FEventsTable := TSQLQuery.Create(Self);
|
||||||
FEventsTable.SQL.Add('SELECT * FROM Events');
|
FEventsTable.SQL.Add('SELECT * FROM Events');
|
||||||
|
FEventsTable.Options := FEventsTable.Options + [sqoAutoApplyUpdates];
|
||||||
|
|
||||||
FResourceTable := TSQLQuery.Create(self);
|
FResourceTable := TSQLQuery.Create(self);
|
||||||
FResourceTable.SQL.Add('SELECT * FROM Resources');
|
FResourceTable.SQL.Add('SELECT * FROM Resources');
|
||||||
|
FResourceTable.Options := FResourceTable.Options + [sqoAutoApplyUpdates];
|
||||||
|
|
||||||
FTasksTable := TSQLQuery.Create(self);
|
FTasksTable := TSQLQuery.Create(self);
|
||||||
FTasksTable.SQL.Add('SELECT * FROM Tasks');
|
FTasksTable.SQL.Add('SELECT * FROM Tasks');
|
||||||
|
FTaskstable.Options := FTasksTable.Options + [sqoAutoApplyUpdates];
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TVpSqlite3Datastore.Destroy;
|
||||||
|
begin
|
||||||
|
FContactsTable.Close;
|
||||||
|
FEventsTable.Close;
|
||||||
|
FTasksTable.Close;
|
||||||
|
FResourceTable.Close;
|
||||||
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpSqlite3Datastore.AddField(ATableName, AFieldName: String;
|
procedure TVpSqlite3Datastore.AddField(ATableName, AFieldName: String;
|
||||||
@ -537,30 +551,6 @@ begin
|
|||||||
FTasksTable.Open;
|
FTasksTable.Open;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpSqlite3Datastore.PostContacts;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
FContactsTable.ApplyUpdates;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TVpSqlite3Datastore.PostEvents;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
FEventsTable.ApplyUpdates;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TVpSqlite3Datastore.PostResources;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
FResourceTable.ApplyUpdates;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TVpSqlite3Datastore.PostTasks;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
FTasksTable.ApplyUpdates;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TVpSqlite3Datastore.SetConnected(const AValue: Boolean);
|
procedure TVpSqlite3Datastore.SetConnected(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if (FConnection = nil) or (FConnection.Transaction = nil) then
|
if (FConnection = nil) or (FConnection.Transaction = nil) then
|
||||||
|
Reference in New Issue
Block a user