TDB2
- Added an option to bypass backlog recording to TDB2::add and TDB2::modify. This is required when handling backlog data, to prevent perpetual syncing.
This commit is contained in:
10
src/TDB2.cpp
10
src/TDB2.cpp
@@ -542,7 +542,7 @@ void TDB2::set_location (const std::string& location)
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Add the new task to the appropriate file.
|
// Add the new task to the appropriate file.
|
||||||
void TDB2::add (Task& task)
|
void TDB2::add (Task& task, bool add_to_backlog /* = true */)
|
||||||
{
|
{
|
||||||
// Ensure the task is consistent, and provide defaults if necessary.
|
// Ensure the task is consistent, and provide defaults if necessary.
|
||||||
task.validate ();
|
task.validate ();
|
||||||
@@ -569,11 +569,12 @@ void TDB2::add (Task& task)
|
|||||||
undo.add_line ("---\n");
|
undo.add_line ("---\n");
|
||||||
|
|
||||||
// Add task to backlog.
|
// Add task to backlog.
|
||||||
backlog.add_task (task);
|
if (add_to_backlog)
|
||||||
|
backlog.add_task (task);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void TDB2::modify (Task& task)
|
void TDB2::modify (Task& task, bool add_to_backlog /* = true */)
|
||||||
{
|
{
|
||||||
// Ensure the task is consistent, and provide defaults if necessary.
|
// Ensure the task is consistent, and provide defaults if necessary.
|
||||||
task.validate (false);
|
task.validate (false);
|
||||||
@@ -601,7 +602,8 @@ void TDB2::modify (Task& task)
|
|||||||
undo.add_line ("---\n");
|
undo.add_line ("---\n");
|
||||||
|
|
||||||
// Add modified task to backlog.
|
// Add modified task to backlog.
|
||||||
backlog.add_task (task);
|
if (add_to_backlog)
|
||||||
|
backlog.add_task (task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,8 +101,8 @@ public:
|
|||||||
~TDB2 ();
|
~TDB2 ();
|
||||||
|
|
||||||
void set_location (const std::string&);
|
void set_location (const std::string&);
|
||||||
void add (Task&);
|
void add (Task&, bool add_to_backlog = true);
|
||||||
void modify (Task&);
|
void modify (Task&, bool add_to_backlog = true);
|
||||||
void commit ();
|
void commit ();
|
||||||
void merge (const std::string&);
|
void merge (const std::string&);
|
||||||
void revert ();
|
void revert ();
|
||||||
|
|||||||
Reference in New Issue
Block a user