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 }
|
||||
Event.StartTime := Event.StartTime + (DragToTime - DvDragStartTime);
|
||||
Event.EndTime := Event.StartTime + Duration;
|
||||
|
||||
DataStore.PostEvents;
|
||||
|
||||
{ Force a repaint. This will update the rectangles for the event }
|
||||
@ -1704,12 +1705,8 @@ begin
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Invalidate; }
|
||||
end;
|
||||
// TVpEventDragObject(Source).EndDrag(False);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
function TVpDayView.dvCalcRowHeight(Scale: Extended;
|
||||
UseGran: TVpGranularity): Integer;
|
||||
|
@ -9,6 +9,9 @@ uses
|
||||
VpBaseDS, VpDBDS;
|
||||
|
||||
type
|
||||
|
||||
{ TVpSqlite3Datastore }
|
||||
|
||||
TVpSqlite3Datastore = class(TVpCustomDBDatastore)
|
||||
private
|
||||
FConnection: TSqlite3Connection;
|
||||
@ -38,12 +41,10 @@ type
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure CreateTables;
|
||||
function GetNextID(TableName: string): integer; override;
|
||||
procedure PostEvents; override;
|
||||
procedure PostContacts; override;
|
||||
procedure PostTasks; override;
|
||||
procedure PostResources; override;
|
||||
|
||||
property ResourceTable;
|
||||
property EventsTable;
|
||||
@ -80,15 +81,28 @@ begin
|
||||
|
||||
FContactsTable := TSQLQuery.Create(self);
|
||||
FContactsTable.SQL.Add('SELECT * FROM Contacts');
|
||||
FContactsTable.Options := FContactsTable.Options + [sqoAutoApplyUpdates];
|
||||
|
||||
FEventsTable := TSQLQuery.Create(Self);
|
||||
FEventsTable.SQL.Add('SELECT * FROM Events');
|
||||
FEventsTable.Options := FEventsTable.Options + [sqoAutoApplyUpdates];
|
||||
|
||||
FResourceTable := TSQLQuery.Create(self);
|
||||
FResourceTable.SQL.Add('SELECT * FROM Resources');
|
||||
FResourceTable.Options := FResourceTable.Options + [sqoAutoApplyUpdates];
|
||||
|
||||
FTasksTable := TSQLQuery.Create(self);
|
||||
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;
|
||||
|
||||
procedure TVpSqlite3Datastore.AddField(ATableName, AFieldName: String;
|
||||
@ -537,30 +551,6 @@ begin
|
||||
FTasksTable.Open;
|
||||
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);
|
||||
begin
|
||||
if (FConnection = nil) or (FConnection.Transaction = nil) then
|
||||
|
Reference in New Issue
Block a user