- Converted 'edit' command to TDB2.
This commit is contained in:
Paul Beckingham 2011-08-30 00:21:56 -04:00
parent 7f1e517754
commit 9fefd4f283

View file

@ -56,24 +56,18 @@ int CmdEdit::execute (std::string& output)
{ {
int rc = 0; int rc = 0;
// Get all the tasks. // Filter the tasks.
std::vector <Task> tasks;
context.tdb.lock (context.config.getBoolean ("locking"));
handleRecurrence (); handleRecurrence ();
context.tdb.load (tasks);
// Apply filter.
std::vector <Task> filtered; std::vector <Task> filtered;
filter (tasks, filtered); filter (filtered);
// Find number of matching tasks. Skip recurring parent tasks. // Find number of matching tasks. Skip recurring parent tasks.
std::vector <Task>::iterator task; std::vector <Task>::iterator task;
for (task = filtered.begin (); task != filtered.end (); ++task) for (task = filtered.begin (); task != filtered.end (); ++task)
if (editFile (*task)) if (editFile (*task))
context.tdb.update (*task); context.tdb2.modify (*task);
context.tdb.commit (); context.tdb2.commit ();
context.tdb.unlock ();
return rc; return rc;
} }