Bug Fix - #209
- Not a fix, but working towards a fix. When a recurring task is edited, the other sibling tasks are not modified. This is difficult to do. Perhaps we can skip for 1.8.
This commit is contained in:
69
src/edit.cpp
69
src/edit.cpp
@@ -512,23 +512,8 @@ static void parseTask (Task& task, const std::string& after)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Introducing the Silver Bullet. This feature is the catch-all fixative for
|
void editFile (Task& task)
|
||||||
// various other ills. This is like opening up the hood and going in with a
|
|
||||||
// wrench. To be used sparingly.
|
|
||||||
std::string handleEdit ()
|
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
|
||||||
|
|
||||||
std::vector <Task> tasks;
|
|
||||||
context.tdb.lock (context.config.get ("locking", true));
|
|
||||||
handleRecurrence ();
|
|
||||||
context.tdb.loadPending (tasks, context.filter);
|
|
||||||
|
|
||||||
// Filter sequence.
|
|
||||||
context.filter.applySequence (tasks, context.sequence);
|
|
||||||
|
|
||||||
foreach (task, tasks)
|
|
||||||
{
|
|
||||||
// Check for file permissions.
|
// Check for file permissions.
|
||||||
std::string dataLocation = expandPath (context.config.get ("data.location"));
|
std::string dataLocation = expandPath (context.config.get ("data.location"));
|
||||||
if (access (dataLocation.c_str (), X_OK))
|
if (access (dataLocation.c_str (), X_OK))
|
||||||
@@ -536,10 +521,10 @@ std::string handleEdit ()
|
|||||||
|
|
||||||
// Create a temp file name in data.location.
|
// Create a temp file name in data.location.
|
||||||
std::stringstream file;
|
std::stringstream file;
|
||||||
file << dataLocation << "/task." << getpid () << "." << task->id << ".task";
|
file << dataLocation << "/task." << getpid () << "." << task.id << ".task";
|
||||||
|
|
||||||
// Format the contents, T -> text, write to a file.
|
// Format the contents, T -> text, write to a file.
|
||||||
std::string before = formatTask (*task);
|
std::string before = formatTask (task);
|
||||||
spit (file.str (), before);
|
spit (file.str (), before);
|
||||||
|
|
||||||
// Determine correct editor: .taskrc:editor > $VISUAL > $EDITOR > vi
|
// Determine correct editor: .taskrc:editor > $VISUAL > $EDITOR > vi
|
||||||
@@ -576,8 +561,7 @@ ARE_THESE_REALLY_HARMFUL:
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parseTask (*task, after);
|
parseTask (task, after);
|
||||||
context.tdb.update (*task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (std::string& e)
|
catch (std::string& e)
|
||||||
@@ -603,6 +587,51 @@ ARE_THESE_REALLY_HARMFUL:
|
|||||||
|
|
||||||
// Cleanup.
|
// Cleanup.
|
||||||
unlink (file.str ().c_str ());
|
unlink (file.str ().c_str ());
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Introducing the Silver Bullet. This feature is the catch-all fixative for
|
||||||
|
// various other ills. This is like opening up the hood and going in with a
|
||||||
|
// wrench. To be used sparingly.
|
||||||
|
std::string handleEdit ()
|
||||||
|
{
|
||||||
|
std::stringstream out;
|
||||||
|
|
||||||
|
std::vector <Task> tasks;
|
||||||
|
context.tdb.lock (context.config.get ("locking", true));
|
||||||
|
handleRecurrence ();
|
||||||
|
Filter filter;
|
||||||
|
context.tdb.loadPending (tasks, filter);
|
||||||
|
|
||||||
|
// Filter sequence.
|
||||||
|
std::vector <Task> all = tasks;
|
||||||
|
context.filter.applySequence (tasks, context.sequence);
|
||||||
|
|
||||||
|
foreach (task, tasks)
|
||||||
|
{
|
||||||
|
editFile (*task);
|
||||||
|
context.tdb.update (*task);
|
||||||
|
/*
|
||||||
|
foreach (other, all)
|
||||||
|
{
|
||||||
|
if (other->id != task.id) // Don't edit the same task again.
|
||||||
|
{
|
||||||
|
if (task.has ("parent") &&
|
||||||
|
if (other is parent of task)
|
||||||
|
{
|
||||||
|
// Transfer everything but mask, imask, uuid, parent.
|
||||||
|
}
|
||||||
|
else if (task is parent of other)
|
||||||
|
{
|
||||||
|
// Transfer everything but mask, imask, uuid, parent.
|
||||||
|
}
|
||||||
|
else if (task and other are siblings)
|
||||||
|
{
|
||||||
|
// Transfer everything but mask, imask, uuid, parent.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
context.tdb.commit ();
|
context.tdb.commit ();
|
||||||
|
|||||||
Reference in New Issue
Block a user