TDB2
- Integrated hooks to TF2::add_task and TF2::modify_task.
This commit is contained in:
17
src/TDB2.cpp
17
src/TDB2.cpp
@@ -134,10 +134,13 @@ bool TF2::get (const std::string& uuid, Task& task)
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void TF2::add_task (const Task& task)
|
void TF2::add_task (const Task& task)
|
||||||
{
|
{
|
||||||
_tasks.push_back (task); // For subsequent queries
|
Task hookTask (task);
|
||||||
_added_tasks.push_back (task); // For commit/synch
|
context.hooks.onAdd (hookTask);
|
||||||
|
|
||||||
/* TODO handle 'add' and 'log'.
|
_tasks.push_back (hookTask); // For subsequent queries
|
||||||
|
_added_tasks.push_back (hookTask); // For commit/synch
|
||||||
|
|
||||||
|
/* TODO handle 'add' and 'log'?
|
||||||
int id = context.tdb2.next_id ();
|
int id = context.tdb2.next_id ();
|
||||||
_I2U[id] = task.get ("uuid");
|
_I2U[id] = task.get ("uuid");
|
||||||
_U2I[task.get ("uuid")] = id;
|
_U2I[task.get ("uuid")] = id;
|
||||||
@@ -156,9 +159,13 @@ bool TF2::modify_task (const Task& task)
|
|||||||
{
|
{
|
||||||
if (i->get ("uuid") == uuid)
|
if (i->get ("uuid") == uuid)
|
||||||
{
|
{
|
||||||
*i = task;
|
Task hookTask (task);
|
||||||
_modified_tasks.push_back (task);
|
context.hooks.onModify (*i, hookTask);
|
||||||
|
|
||||||
|
*i = hookTask;
|
||||||
|
_modified_tasks.push_back (hookTask);
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user